Parcourir la source

Merge branch 'dev' into dev-sxb

sunxbiao il y a 1 an
Parent
commit
6a66ea11d9

+ 186 - 0
app/controller/admin/order/RefundOrder.php

@@ -121,6 +121,192 @@ class RefundOrder extends BaseController
121 121
 //            Db::name('log')->insert(['data'=>'这了'. 1]);
122 122
             $this->repository->agree($id,$data,$this->request->adminId(),1);
123 123
 
124
+            // 获取订单金额
125
+            $store_order_info = Db::name('store_order')
126
+                ->where('order_id', $refund_order['order_id'])
127
+                ->find();
128
+            $group_order_map = Db::name('store_group_order')
129
+                ->where('group_order_id', $store_order_info['group_order_id'])
130
+                ->field('uid,pay_price,hf_pay_id,fzone_paytype')
131
+                ->find();
132
+            $make = '商贸区';
133
+            if ($store_order_info['mer_id'] == 439) {
134
+                $make = '精彩生活区';
135
+            } else if ($store_order_info['mer_id'] == 496) {
136
+                $make = '会员专区';
137
+            } else if ($store_order_info['mer_id'] == 491) {
138
+                $make = '复购区';
139
+            }
140
+
141
+            // 如果是组合支付 现金 + 积分 则需要把积分退回
142
+            // 参考 app\controller\api\Notify.php -- 745 $array_fzone_paytype['type']=='b2'
143
+            $array_fzone_paytype = json_decode($group_order_map['fzone_paytype'], true);
144
+            if (!empty($array_fzone_paytype)) {
145
+                if ($array_fzone_paytype['type'] == 'b1') {
146
+                    // VR+积分 {"checked":true,"note":"VR+积分","other":210.0,"price":970.0,"total":0.0,"type":"b1","vr":"47557.5"}
147
+                    $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('vr');
148
+                    $vrpri += $array_fzone_paytype['price'];
149
+                    Db::name("user")->where("uid", $group_order_map['uid'])->update(['vr' => $vrpri]);
150
+                    Db::name("user_sign_vr")->insert([
151
+                        'uid' => $store_order_info['uid'],
152
+                        'number' => $array_fzone_paytype['price'],
153
+                        'mark' => "{$make}商品申请退款退回VR",
154
+                        'desc' => "VR",
155
+                        'order_type' => 0,
156
+                        'order_id' => $store_order_info['order_id'],
157
+                        'surplus' => $vrpri,
158
+                        'type' => 1,
159
+                        'addtime' => time()
160
+                    ]);
161
+
162
+                    // {"checked":true,"note":"VR+积分","other":1.5,"price":8.5,"total":0.0,"type":"b2","vr":"48799.82"}
163
+                    $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('score');
164
+                    $vrpri += $array_fzone_paytype['other'];
165
+                    Db::name("user")->where("uid", $group_order_map['uid'])->update(['score' => $vrpri]);
166
+
167
+                    $data = [
168
+                        "uid" => $store_order_info['uid'],
169
+                        "reward_socre" => $array_fzone_paytype['other'],
170
+                        "addtime" => time(),
171
+                        "status" => 1,
172
+                        "order_id" => $store_order_info['order_id'],
173
+                        "mark" => "{$make}商品申请退款退回积分",
174
+                        "surplus" => $vrpri,
175
+                        "pm" => 1,
176
+                        "source_type" => 3
177
+                    ];
178
+                    Db::name("user_sign_score")->insert($data);//添加积分记录
179
+                } else if ($array_fzone_paytype['type'] == 'b2') {
180
+                    // {"checked":true,"note":"现金+积分","other":1.5,"price":8.5,"total":0.0,"type":"b2","vr":"48799.82"}
181
+
182
+                    $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('score');
183
+                    $vrpri += $array_fzone_paytype['other'];
184
+                    Db::name("user")->where("uid", $group_order_map['uid'])->update(['score' => $vrpri]);
185
+
186
+                    $data = [
187
+                        "uid" => $store_order_info['uid'],
188
+                        "reward_socre" => $array_fzone_paytype['other'],
189
+                        "addtime" => time(),
190
+                        "status" => 1,
191
+                        "order_id" => $store_order_info['order_id'],
192
+                        "mark" => "{$make}商品申请退款退回积分",
193
+                        "surplus" => $vrpri,
194
+                        "pm" => 1,
195
+                        "source_type" => 3
196
+                    ];
197
+                    Db::name("user_sign_score")->insert($data);//添加积分记录
198
+                } else if ($array_fzone_paytype['type'] == 'b3') {
199
+                    // VR+积分 {"checked":true,"note":"VR+积分","other":210.0,"price":970.0,"total":0.0,"type":"b1","vr":"47557.5"}
200
+                    $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('vr');
201
+                    $vrpri += $array_fzone_paytype['price'];
202
+                    Db::name("user")->where("uid", $group_order_map['uid'])->update(['vr' => $vrpri]);
203
+                    Db::name("user_sign_vr")->insert([
204
+                        'uid' => $store_order_info['uid'],
205
+                        'number' => $array_fzone_paytype['price'],
206
+                        'mark' => "{$make}商品申请退款退回VR",
207
+                        'desc' => "VR",
208
+                        'order_type' => 0,
209
+                        'order_id' => $store_order_info['order_id'],
210
+                        'surplus' => $vrpri,
211
+                        'type' => 1,
212
+                        'addtime' => time()
213
+                    ]);
214
+
215
+                    // {"checked":true,"note":"VR+积分","other":1.5,"price":8.5,"total":0.0,"type":"b2","vr":"48799.82"}
216
+                    $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('jingdou');
217
+                    $vrpri += $array_fzone_paytype['other'];
218
+                    Db::name("user")->where("uid", $group_order_map['uid'])->update(['jingdou' => $vrpri]);
219
+
220
+                    Db::name('user_sign_jingdou')->insert([
221
+                        'uid' => $store_order_info['uid'],
222
+                        'number' => $array_fzone_paytype['other'],
223
+                        'status' => 1,
224
+                        'mark' => "{$make}商品申请退款退回京豆",
225
+                        'addtime' => time(),
226
+                        'surplus' => $vrpri,
227
+                        'settlement_time' => date('Y-m-d H:i:s'),
228
+                        'type' => 1,
229
+                        'order_type' => 0,
230
+                        'order_id' => $store_order_info['order_id']
231
+                    ]);
232
+                } else if ($array_fzone_paytype['type'] == 'b4') {
233
+                    // {"checked":true,"note":"现金+积分","other":1.5,"price":8.5,"total":0.0,"type":"b2","vr":"48799.82"}
234
+
235
+                    $jingdoupri = Db::name("user")->where("uid", $group_order_map['uid'])->value('jingdou');
236
+                    $jingdoupri += $array_fzone_paytype['other'];
237
+                    Db::name("user")->where("uid", $group_order_map['uid'])->update(['jingdou' => $jingdoupri]);
238
+
239
+                    Db::name('user_sign_jingdou')->insert([
240
+                        'uid' => $store_order_info['uid'],
241
+                        'number' => $array_fzone_paytype['other'],
242
+                        'status' => 1,
243
+                        'mark' => "{$make}商品申请退款退回京豆",
244
+                        'addtime' => time(),
245
+                        'surplus' => $jingdoupri,
246
+                        'settlement_time' => date('Y-m-d H:i:s'),
247
+                        'type' => 1,
248
+                        'order_type' => 0,
249
+                        'order_id' => $store_order_info['order_id']
250
+                    ]);
251
+                } else if ($array_fzone_paytype['type'] == 'b5') {
252
+                    // {"checked":true,"note":"VR","other":0.0,"price":1.0,"total":0.0,"type":"b5","vr":"10"}
253
+                    $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('vr');
254
+                    $vrpri += $array_fzone_paytype['price'];
255
+                    Db::name("user")->where("uid", $group_order_map['uid'])->update(['vr' => $vrpri]);
256
+                    Db::name("user_sign_vr")->insert([
257
+                        'uid' => $store_order_info['uid'],
258
+                        'number' => $array_fzone_paytype['price'],
259
+                        'mark' => "{$make}商品申请退款退回VR",
260
+                        'desc' => "VR",
261
+                        'order_type' => 0,
262
+                        'order_id' => $store_order_info['order_id'],
263
+                        'surplus' => $vrpri,
264
+                        'type' => 1,
265
+                        'addtime' => time()
266
+                    ]);
267
+                } else if ($array_fzone_paytype['type'] == 'a3') {
268
+                    // {"checked":true,"note":"现金+VR","other":1.5,"price":8.5,"total":0.0,"type":"a3","vr":"48799.82"}
269
+                    $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('vr');
270
+                    $vrpri += $array_fzone_paytype['other'];
271
+                    Db::name("user")->where("uid", $group_order_map['uid'])->update(['vr' => $vrpri]);
272
+
273
+                    //VR入账
274
+                    $insertdata = [
275
+                        'uid'=> $store_order_info['uid'],
276
+                        'number' =>  $array_fzone_paytype['other'],
277
+                        'surplus' => $vrpri,
278
+                        'mark' => "{$make}商品申请退款退回VR",
279
+                        'order_id'=> $store_order_info['order_id'],
280
+                        'type' => 2,
281
+                        'addtime' => time(),
282
+                        'settlement_time'=> date('Y-m-d H:i:s', time())
283
+                    ];
284
+                    Db::name('user_sign_vr')->insert($insertdata);
285
+
286
+                }
287
+                // else if ($array_fzone_paytype['type'] == 'c1') {
288
+                //     // {"checked":true,"note":"复购金","other":1.5,"price":8.5,"total":0.0,"type":"c1","vr":"48799.82"}
289
+                //     $vrpri = Db::name("user")->where("uid", $group_order_map['uid'])->value('fugou');
290
+                //     $vrpri += $array_fzone_paytype['other'];
291
+                //     Db::name("user")->where("uid", $group_order_map['uid'])->update(['fugou' => $vrpri]);
292
+                //     //支出账号存到log日志
293
+                //     $log_data = [
294
+                //         'uid' => $store_order_info['uid'],
295
+                //         'number' => $array_fzone_paytype['price'],
296
+                //         'mark' => "复购区商品申请退款退回复购金:" . $array_fzone_paytype['price'],
297
+                //         'desc' => "复购金",
298
+                //         'order_id' =>  $store_order_info['order_id'],
299
+                //         'surplus' => $vrpri,
300
+                //         'order_type' => 0,
301
+                //         'type' => 2,
302
+                //         'addtime' => time()
303
+                //     ];
304
+                //     $user_res_log = Db::name("user_sign_fugou")->insert($log_data);
305
+                // }
306
+            }
307
+
308
+            // 取消 订单所发放的福利
309
+            $this->repository->cancelOrderBonus($id);
124 310
         }else{
125 311
             $fail_message = $this->request->param('fail_message','');
126 312
             if($status == -1 && empty($fail_message)){

+ 20 - 40
app/controller/api/store/merchant/Taskorderguquan.php

@@ -18,50 +18,30 @@ class Taskorderguquan
18 18
     {
19 19
 
20 20
         /**
21
-         * 请根据内容:
22
-         * 6250元补贴下面人员
23
-         * 13231658486周行体1000
24
-         * 13333069689魏惠新1500
25
-         * 13959100621周金花300
26
-         * 13701061395李素红300
27
-         * 17501006833邢艳丽300
28
-         * 15631982690魏震洪300
29
-         * 18603401312黄金花200
30
-         * 13521438652徐立苹200
31
-         * 15832971815孟晓玮300
32
-         * 18600200909陈冠霖300
33
-         * 15810064711 王   玲 300
34
-         * 13932925303会强300
35
-         * 13601071082隋彩云200
36
-         * 13161909228刘银霞50
37
-         * 18760167163刘春梅50
38
-         * 18911752386魏利琴50
39
-         * 13215917919李小秋50
40
-         * 15332507711张传莲50
41
-         * 18715313601大饼500
42
-         * 23750元做合伙人分红
43
-         * 共计3万
44
- */
21
+        13231658486周行体300
22
+        13333069689魏惠新300
23
+        15832971815孟晓玮300
24
+        13959100621周金花300
25
+        13701061395李素红100
26
+        15810064711 王   玲 200
27
+        13521438652徐立苹100
28
+        18760167163刘春梅50
29
+        15332507711张传莲50
30
+        15960349661吕丽娣50
31
+        18715313601大饼200
32
+        */
45 33
         $data = [
46
-            '13231658486' => 1000,
47
-            '13333069689' => 1500,
48
-            '13959100621' => 300,
49
-            '13701061395' => 300,
50
-            '17501006833' => 300,
51
-            '15631982690' => 300,
52
-            '18603401312' => 200,
53
-            '13521438652' => 200,
34
+            '13231658486' => 300,
35
+            '13333069689' => 300,
54 36
             '15832971815' => 300,
55
-            '18600200909' => 300,
56
-            '15810064711' => 300,
57
-            '13932925303' => 300,
58
-            '13601071082' => 200,
59
-            '13161909228' => 50,
37
+            '13959100621' => 300,
38
+            '13701061395' => 100,
39
+            '15810064711' => 200,
40
+            '13521438652' => 100,
60 41
             '18760167163' => 50,
61
-            '18911752386' => 50,
62
-            '13215917919' => 50,
63 42
             '15332507711' => 50,
64
-            '18715313601' => 500
43
+            '15960349661' => 50,
44
+            '18715313601' => 200,
65 45
         ];
66 46
 
67 47
         $result = Db::name("user")