|
|
@@ -120,6 +120,85 @@ class RefundOrder extends BaseController
|
|
120
|
120
|
$data['status'] = $status;
|
|
121
|
121
|
$this->repository->agree($id,$data,$this->request->adminId(),1);
|
|
122
|
122
|
|
|
|
123
|
+ // 获取订单金额
|
|
|
124
|
+ $store_order_info = Db::name('store_order')
|
|
|
125
|
+ ->where('order_id', $refund_order['order_id'])
|
|
|
126
|
+ ->find();
|
|
|
127
|
+ $group_order_map = Db::name('store_group_order')
|
|
|
128
|
+ ->where('group_order_id', $store_order_info['group_order_id'])
|
|
|
129
|
+ ->field('uid,pay_price,hf_pay_id,fzone_paytype')
|
|
|
130
|
+ ->find();
|
|
|
131
|
+ $make = '商贸区';
|
|
|
132
|
+ if ($store_order_info['mer_id'] == 439) {
|
|
|
133
|
+ $make = '精彩生活';
|
|
|
134
|
+ } else if ($store_order_info['mer_id'] == 496) {
|
|
|
135
|
+ $make = '会员专区';
|
|
|
136
|
+ }
|
|
|
137
|
+
|
|
|
138
|
+ // 如果是组合支付 现金 + 积分 则需要把积分退回
|
|
|
139
|
+ // 参考 app\controller\api\Notify.php -- 745 $array_fzone_paytype['type']=='b2'
|
|
|
140
|
+ $array_fzone_paytype = json_decode($group_order_map['fzone_paytype'], true);
|
|
|
141
|
+ if (!empty($array_fzone_paytype)) {
|
|
|
142
|
+ if ($array_fzone_paytype['type'] == 'b2') {
|
|
|
143
|
+ // {"checked":true,"note":"现金+积分","other":1.5,"price":8.5,"total":0.0,"type":"b2","vr":"48799.82"}
|
|
|
144
|
+
|
|
|
145
|
+ $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('score');
|
|
|
146
|
+ $vrpri += $array_fzone_paytype['other'];
|
|
|
147
|
+ Db::name("user")->where("uid", $group_order_map['uid'])->update(['score' => $vrpri]);
|
|
|
148
|
+
|
|
|
149
|
+ $data = [
|
|
|
150
|
+ "uid" => $store_order_info['uid'],
|
|
|
151
|
+ "reward_socre" => $array_fzone_paytype['other'],
|
|
|
152
|
+ "addtime" => time(),
|
|
|
153
|
+ "status" => 1,
|
|
|
154
|
+ "order_id" => $store_order_info['order_id'],
|
|
|
155
|
+ "mark" => "{$make}商品申请退款退回积分",
|
|
|
156
|
+ "surplus" => $vrpri,
|
|
|
157
|
+ "pm" => 1,
|
|
|
158
|
+ "source_type" => 3
|
|
|
159
|
+ ];
|
|
|
160
|
+ Db::name("user_sign_score")->insert($data);//添加积分记录
|
|
|
161
|
+ } else if ($array_fzone_paytype['type'] == 'a3') {
|
|
|
162
|
+ // {"checked":true,"note":"现金+VR","other":1.5,"price":8.5,"total":0.0,"type":"a3","vr":"48799.82"}
|
|
|
163
|
+ $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('vr');
|
|
|
164
|
+ $vrpri += $array_fzone_paytype['other'];
|
|
|
165
|
+ Db::name("user")->where("uid", $group_order_map['uid'])->update(['vr' => $vrpri]);
|
|
|
166
|
+
|
|
|
167
|
+ //VR入账
|
|
|
168
|
+ $insertdata = [
|
|
|
169
|
+ 'uid'=> $store_order_info['uid'],
|
|
|
170
|
+ 'number' => $array_fzone_paytype['other'],
|
|
|
171
|
+ 'surplus' => $vrpri,
|
|
|
172
|
+ 'mark' => "{$make}商品申请退款退回VR",
|
|
|
173
|
+ 'order_id'=> $store_order_info['order_id'],
|
|
|
174
|
+ 'type' => 2,
|
|
|
175
|
+ 'addtime' => time(),
|
|
|
176
|
+ 'settlement_time'=> date('Y-m-d H:i:s', time())
|
|
|
177
|
+ ];
|
|
|
178
|
+ Db::name('user_sign_vr')->insert($insertdata);
|
|
|
179
|
+
|
|
|
180
|
+ }
|
|
|
181
|
+ // else if ($array_fzone_paytype['type'] == 'c1') {
|
|
|
182
|
+ // // {"checked":true,"note":"复购金","other":1.5,"price":8.5,"total":0.0,"type":"c1","vr":"48799.82"}
|
|
|
183
|
+ // $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('fugou');
|
|
|
184
|
+ // $vrpri += $array_fzone_paytype['other'];
|
|
|
185
|
+ // Db::name("user")->where("uid", $group_order_map['uid'])->update(['fugou' => $vrpri]);
|
|
|
186
|
+ // //支出账号存到log日志
|
|
|
187
|
+ // $log_data = [
|
|
|
188
|
+ // 'uid' => $store_order_info['uid'],
|
|
|
189
|
+ // 'number' => $array_fzone_paytype['price'],
|
|
|
190
|
+ // 'mark' => "复购区商品申请退款退回复购金:" . $array_fzone_paytype['price'],
|
|
|
191
|
+ // 'desc' => "复购金",
|
|
|
192
|
+ // 'order_id' => $store_order_info['order_id'],
|
|
|
193
|
+ // 'surplus' => $vrpri,
|
|
|
194
|
+ // 'order_type' => 0,
|
|
|
195
|
+ // 'type' => 2,
|
|
|
196
|
+ // 'addtime' => time()
|
|
|
197
|
+ // ];
|
|
|
198
|
+ // $user_res_log = Db::name("user_sign_fugou")->insert($log_data);
|
|
|
199
|
+ // }
|
|
|
200
|
+ }
|
|
|
201
|
+
|
|
123
|
202
|
// 取消 订单所发放的福利
|
|
124
|
203
|
$this->repository->cancelOrderBonus($id);
|
|
125
|
204
|
}else{
|