Quellcode durchsuchen

去掉多余注释、调整会员专区分账逻辑中分账金额字段

family vor 1 Jahr
Ursprung
Commit
92deb0e7a5

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
1 1
 public/
2 2
 .idea/
3 3
 .env
4
+runtime/

+ 7 - 232
app/command/CommercialAreaOrderIndependentAccount.php

@@ -3,19 +3,11 @@
3 3
 namespace app\command;
4 4
 
5 5
 use app\common\model\store\order\StoreOrder;
6
-use app\common\model\user\UserCertification;
7
-use app\common\repositories\merchant\order\OrderGzcRepository;
8
-use app\common\repositories\merchant\order\OrderMerchantRepository;
9 6
 use app\common\repositories\store\order\StoreOrderRepository;
10
-use app\common\repositories\store\order\StoreOrderStatusRepository;
11
-use app\common\repositories\user\UserBillRepository;
12
-use app\common\repositories\user\UserRepository;
13
-use Carbon\Carbon;
14 7
 use think\console\Command;
15 8
 use think\console\Input;
16 9
 use think\console\Output;
17 10
 use think\facade\Db;
18
-use think\facade\Log;
19 11
 
20 12
 class CommercialAreaOrderIndependentAccount extends Command
21 13
 {
@@ -46,9 +38,6 @@ class CommercialAreaOrderIndependentAccount extends Command
46 38
     {
47 39
         // 商户信息
48 40
         $merchants = [];
49
-//        $StoreOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
50
-//        $OrderMerchantRepository = app()->make(OrderMerchantRepository::class);
51
-//        $OrderGzcRepository = app()->make(OrderGzcRepository::class);
52 41
 
53 42
         /** @var StoreOrderRepository $storeOrderRepository */
54 43
         $storeOrderRepository = app()->make(StoreOrderRepository::class);
@@ -57,7 +46,7 @@ class CommercialAreaOrderIndependentAccount extends Command
57 46
         // 订单状态(0:待发货;1:待收货;2:待评价;3:已完成;4已申请退款;-1:已退款)5未支付 6已取消'
58 47
         $status = [2, 3];
59 48
         // 已支付、未结算
60
-        $where = ['paid' => 1, 'gzc' => 0, 'is_del' => 0, 'is_system_del' => 0];
49
+        $where = ['paid' => 1, 'is_independentaccount' => 0, 'is_del' => 0, 'is_system_del' => 0];
61 50
         // 普通订单 @todo 排除 特殊商户{$excludeMerId}:精彩生活区、会员区、复购区
62 51
         $cursor = Db::table('rrx_store_order')->where($where)->where('pay_type', 'in', '1,2,4')->whereIn('status', $status)
63 52
             ->whereNotIn('mer_id', $excludeMerId)->cursor();
@@ -76,229 +65,15 @@ class CommercialAreaOrderIndependentAccount extends Command
76 65
                 $isSuccessed = $storeOrderRepository->prepareExecuteIndependentAccount(
77 66
                     $value, $group_order, $independentAccount['api_key'], $independentAccount['hf_member_id'], $independentAccount['hf_platform_member_id'], $value['cost'], $value['con_pri']
78 67
                 );
79
-                Db::name("log")->insert(array('data' => '商贸区-订单分账:' . json_encode($value, JSON_FORCE_OBJECT)));//日志记录
68
+                if ($isSuccessed) {
69
+                    Db::name("log")->insert(array('data' => '商贸区-订单分账:' . json_encode($value, JSON_FORCE_OBJECT)));//日志记录
80 70
 
81
-//                Db::transaction(function () use ($certification, $online, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
82
-//                    //新增入账明细记录
83
-//                    $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
84
-//                    $create    = [
85
-//                        'uid'          => $online['uid'],
86
-//                        'platform_no'  => $orderId,
87
-//                        'account_type' => $online['pay_type'] == 1 ? 3 : 2,
88
-//                        'user_name'    => $certification['user_name'],
89
-//                        'mobile'       => $certification['mobile'],
90
-//                        'user_card'    => $certification['user_card'],
91
-//                        'pension'      => $pension,
92
-//                        'order_type'   => 2,
93
-//                        'out_trade_no' => $online['order_sn']
94
-//                    ];
95
-//                    $test_user = Db::name('user')->where('uid', $online['uid'])->value('test_user');
96
-//                    $check     = Db::name("gzc_logs")->where("out_trade_no", $online['order_sn'])->where("order_type", 2)->count();
97
-//                    if ($test_user == 0 && $check <= 0) {
98
-//                        $OrderGzcRepository->create($create);
99
-//                    }
100
-                $order = StoreOrder::getInstance()->find($value['order_id']);
101
-                $order->gzc = 1;
102
-                $order->save();
103
-//                });
71
+                    $order = StoreOrder::getInstance()->where('order_id', $value['order_id'])->find();
72
+                    $order->is_independentaccount = 1;
73
+                    $order->save();
74
+                }
104 75
             }
105 76
         }
106
-
107
-        // 普通订单(红包,积分,京东,佣金,复购金,养老金,贡献值)
108
-//        $cursor = Db::table('rrx_store_order')->where('paid', 1)->where('is_settlement', 0)->where('pay_type', 'in', '0,1,2,4')->cursor();
109
-//        $StoreOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
110
-//        $OrderMerchantRepository    = app()->make(OrderMerchantRepository::class);
111
-//        $OrderGzcRepository         = app()->make(OrderGzcRepository::class);
112
-//        foreach ($cursor as $online) {
113
-//            $status = $StoreOrderStatusRepository->getWhere(['order_id' => $online['order_id'], 'change_type' => 'take']);
114
-//            if ($online['mer_id'] == 496) {
115
-//                if (!in_array($online['status'], [0, 1, 2, 3])) {
116
-//                    continue;
117
-//                }
118
-//                if (time() < strtotime($online['pay_time']) + 3600 * 24) {
119
-//                    Log::info('还没有到收货后' . $timeLimit . '天');
120
-//                    continue;
121
-//                }
122
-//            } else {
123
-//                if (!in_array($online['status'], [2, 3])) {
124
-//                    continue;
125
-//                }
126
-//                if (Carbon::now()->modify("-{$timeLimit} days")->lt($status->change_time ?? $status['change_time'])) {
127
-//                    Log::info('还没有到收货后' . $timeLimit . '天');
128
-//                    continue;
129
-//                }
130
-//            }
131
-//
132
-//            $StoreOrderRepository = app()->make(StoreOrderRepository::class);
133
-//            Db::transaction(function () use ($online, $StoreOrderRepository) {
134
-//                $order = StoreOrder::getInstance()->find($online['order_id']);
135
-//                $order->is_settlement   = 1;
136
-//                $order->settlement_time = date('Y-m-d H:i:s');
137
-//                $order->save();
138
-//
139
-//                // 结算积分
140
-//                $user_sign_score_list = Db::name('user_sign_score')
141
-//                    ->where('status', -1)
142
-//                    ->where('order_id', $online['order_id'])
143
-//                    ->whereIn('type', [1, 2])
144
-//                    ->select()
145
-//                    ->toArray();
146
-//                foreach ($user_sign_score_list as $user_sign_score) {
147
-//                    // 修改积分
148
-//                    Db::name('user')
149
-//                        ->where('uid', $user_sign_score['uid'])
150
-//                        ->inc('score', (float)$user_sign_score['reward_socre'])
151
-//                        ->update();
152
-//                    Db::name('user_sign_score')
153
-//                        ->where('status', -1)
154
-//                        ->where('id', $user_sign_score['id'])
155
-//                        ->update([
156
-//                            'status'          => 1,
157
-//                            'settlement_time' => date('Y-m-d H:i:s')
158
-//                        ]);
159
-//                }
160
-//
161
-//                // 结算红包
162
-//                $user_sign_hongbao_list = Db::name('user_sign_hongbao')
163
-//                    ->where('status', -1)
164
-//                    ->where('order_id', $online['order_id'])
165
-//                    ->whereIn('type', [1, 2])
166
-//                    ->select()
167
-//                    ->toArray();
168
-//                foreach ($user_sign_hongbao_list as $user_sign_hongbao) {
169
-//                    // 修改红包
170
-//                    Db::name('user')
171
-//                        ->where('uid', $user_sign_hongbao['uid'])
172
-//                        ->inc('hongbao', (float)$user_sign_hongbao['number'])
173
-//                        ->update();
174
-//                    Db::name('user_sign_hongbao')
175
-//                        ->where('status', -1)
176
-//                        ->where('id', $user_sign_hongbao['id'])
177
-//                        ->update([
178
-//                            'status'          => 1,
179
-//                            'settlement_time' => date('Y-m-d H:i:s')
180
-//                        ]);
181
-//                }
182
-//
183
-//
184
-//                // 结算京豆
185
-//                $user_sign_jingdou_list = Db::name('user_sign_jingdou')
186
-//                    ->where('status', -1)
187
-//                    ->where('order_id', $online['order_id'])
188
-//                    ->whereIn('type', [1, 2])
189
-//                    ->select()
190
-//                    ->toArray();
191
-//                foreach ($user_sign_jingdou_list as $user_sign_jingdou) {
192
-//                    // 修改京豆
193
-//                    Db::name('user')
194
-//                        ->where('uid', $user_sign_jingdou['uid'])
195
-//                        ->inc('jingdou', (float)$user_sign_jingdou['number'])
196
-//                        ->update();
197
-//                    Db::name('user_sign_jingdou')
198
-//                        ->where('status', -1)
199
-//                        ->where('id', $user_sign_jingdou['id'])
200
-//                        ->update([
201
-//                            'status'          => 1,
202
-//                            'settlement_time' => date('Y-m-d H:i:s')
203
-//                        ]);
204
-//                }
205
-//
206
-//
207
-//
208
-//                // 结算复购金
209
-//                $user_sign_fugou_list = Db::name('user_sign_fugou')
210
-//                    ->where('status', -1)
211
-//                    ->where('order_id', $online['order_id'])
212
-//                    ->whereIn('type', [1, 2])
213
-//                    ->select()
214
-//                    ->toArray();
215
-//                foreach ($user_sign_fugou_list as $user_sign_fugou) {
216
-//                    // 修改复购金
217
-//                    Db::name('user')
218
-//                        ->where('uid', $user_sign_fugou['uid'])
219
-//                        ->inc('fugou', (float)$user_sign_fugou['number'])
220
-//                        ->update();
221
-//                    Db::name('user_sign_fugou')
222
-//                        ->where('status', -1)
223
-//                        ->where('id', $user_sign_fugou['id'])
224
-//                        ->update([
225
-//                            'status'          => 1,
226
-//                            'settlement_time' => date('Y-m-d H:i:s')
227
-//                        ]);
228
-//                }
229
-//
230
-//
231
-//                // 结算贡献值
232
-//                $user_sign_gongxian_list = Db::name('user_sign_gongxian')
233
-//                    ->where('status', -1)
234
-//                    ->where('order_id', $online['order_id'])
235
-//                    ->whereIn('type', [1, 2])
236
-//                    ->select()
237
-//                    ->toArray();
238
-//                foreach ($user_sign_gongxian_list as $user_sign_gongxian) {
239
-//                    // 修改贡献值
240
-//                    Db::name('user')
241
-//                        ->where('uid', $user_sign_gongxian['uid'])
242
-//                        ->inc('contribute', (float)$user_sign_gongxian['number'])
243
-//                        ->update();
244
-//                    Db::name('user_sign_gongxian')
245
-//                        ->where('status', -1)
246
-//                        ->where('id', $user_sign_gongxian['id'])
247
-//                        ->update([
248
-//                            'status'          => 1,
249
-//                            'settlement_time' => date('Y-m-d H:i:s')
250
-//                        ]);
251
-//                }
252
-//
253
-//
254
-//                // 结算佣金
255
-//                $user_bill_list = Db::name('user_bill')
256
-//                    ->where('status', 0)
257
-//                    ->where('commission_type','<>', 5)
258
-//                    ->where([ 'link_id' => $online['order_id'], 'order_sn' => $online['order_sn']])
259
-//                    ->select()
260
-//                    ->toArray();
261
-//                foreach ($user_bill_list as $user_bill) {
262
-//                    if ($user_bill['commission_type'] != 5) {
263
-//                        if (in_array($user_bill['commission_type'], [7,12,19])) {
264
-//                            Db::name("merchant")
265
-//                                ->where("mer_id", $user_bill['mer_id'])
266
-//                                ->inc('brokerage_price', (float)$user_bill['number'])
267
-//                                ->update();
268
-//                        } else {
269
-//                            Db::name('user')
270
-//                                ->where('uid', $user_bill['uid'])
271
-//                                ->inc('brokerage_price', (float)$user_bill['number'])
272
-//                                ->update();
273
-//                        }
274
-//                    }
275
-//                    if ($online['pay_type'] == 0 && $user_bill['commission_type'] == 5) {
276
-//                    } else {
277
-//                        // 虚拟支付的养老金不修改不结算
278
-//                        Db::name('user_bill')
279
-//                            ->where('status', 0)
280
-//                            ->where('bill_id', $user_bill['bill_id'])
281
-//                            ->update([
282
-//                                'status'    => 1,
283
-//                                'take_time' => time()
284
-//                            ]);
285
-//                    }
286
-//                    if ($online['pay_type'] == 0 && $user_bill['commission_type'] == 5) {
287
-//                    } else {
288
-//                        // 虚拟支付的养老金不修改不结算
289
-//                        Db::name('user_bill')
290
-//                            ->where('status', 0)
291
-//                            ->where('bill_id', $user_bill['bill_id'])
292
-//                            ->update([
293
-//                                'status'    => 1,
294
-//                                'take_time' => time()
295
-//                            ]);
296
-//                    }
297
-//                }
298
-//                //按角色结算
299
-//                $StoreOrderRepository->close_order($online['order_id']);
300
-//            });
301
-//        }
302 77
     }
303 78
 
304 79
 }

+ 8 - 227
app/command/GreatLifeOrderIndependentAccount.php

@@ -49,17 +49,13 @@ class GreatLifeOrderIndependentAccount extends Command
49 49
 
50 50
         $time = time();
51 51
         // 已支付、未结算
52
-        $where = ['paid' => 1, 'gzc' => 0, 'is_del' => 0, 'is_system_del' => 0];
52
+        $where = ['paid' => 1, 'is_independentaccount' => 0, 'is_del' => 0, 'is_system_del' => 0];
53 53
         // 订单状态(0:待发货;1:待收货;2:待评价;3:已完成;4已申请退款;-1:已退款)5未支付 6已取消'
54 54
         $status = [2, 3];
55 55
         // 普通订单
56 56
         $cursor = Db::table('rrx_store_order')->where($where)->where('pay_type', 'in', '1,2,4')->whereIn('status', $status)
57 57
             ->whereIn('mer_id', $merId)->cursor();
58 58
 
59
-//        $StoreOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
60
-//        $OrderMerchantRepository    = app()->make(OrderMerchantRepository::class);
61
-//        $OrderGzcRepository         = app()->make(OrderGzcRepository::class);
62
-
63 59
         /** @var StoreOrderRepository $storeOrderRepository */
64 60
         $storeOrderRepository = app()->make(StoreOrderRepository::class);
65 61
 
@@ -77,232 +73,17 @@ class GreatLifeOrderIndependentAccount extends Command
77 73
 
78 74
                 // @todo 预分账处理 496:表示{会员专区}账户,精彩生活区分账到{会员专区}账户,故:hf_platform_member_id 为入账账户
79 75
                 $isSuccessed = $storeOrderRepository->prepareExecuteIndependentAccount(
80
-                    $value, $group_order, $independentAccount['api_key'], $independentAccount['hf_platform_member_id'], '', $value['con_pri'], 0
76
+                    $value, $group_order, $independentAccount['api_key'], $independentAccount['hf_platform_member_id'], '', $value['pay_price'], 0
81 77
                 );
78
+                if ($isSuccessed) {
79
+                    Db::name("log")->insert(array('data' => '精彩生活区-订单分账:' . json_encode($value, JSON_FORCE_OBJECT)));//日志记录
82 80
 
83
-                Db::name("log")->insert(array('data' => '精彩生活区-订单分账:' . json_encode($value, JSON_FORCE_OBJECT)));//日志记录
84
-
85
-//                Db::transaction(function () use ($certification, $online, $pension, $OrderGzcRepository, $OrderMerchantRepository, $StoreOrderRepository) {
86
-//                    //新增入账明细记录
87
-//                    $orderId   = $OrderMerchantRepository->getNewOrderId('IN10');
88
-//                    $create    = [
89
-//                        'uid'          => $online['uid'],
90
-//                        'platform_no'  => $orderId,
91
-//                        'account_type' => $online['pay_type'] == 1 ? 3 : 2,
92
-//                        'user_name'    => $certification['user_name'],
93
-//                        'mobile'       => $certification['mobile'],
94
-//                        'user_card'    => $certification['user_card'],
95
-//                        'pension'      => $pension,
96
-//                        'order_type'   => 2,
97
-//                        'out_trade_no' => $online['order_sn']
98
-//                    ];
99
-//                    $test_user = Db::name('user')->where('uid', $online['uid'])->value('test_user');
100
-//                    $check     = Db::name("gzc_logs")->where("out_trade_no", $online['order_sn'])->where("order_type", 2)->count();
101
-//                    if ($test_user == 0 && $check <= 0) {
102
-//                        $OrderGzcRepository->create($create);
103
-//                    }
104
-                $order = StoreOrder::getInstance()->find($value['order_id']);
105
-                $order->gzc = 1;
106
-                $order->save();
107
-//                });
81
+                    $order = StoreOrder::getInstance()->where('order_id', $value['order_id'])->find();
82
+                    $order->is_independentaccount = 1;
83
+                    $order->save();
84
+                }
108 85
             }
109 86
         }
110
-
111
-        // 普通订单(红包,积分,京东,佣金,复购金,养老金,贡献值)
112
-//        $cursor = Db::table('rrx_store_order')->where('paid', 1)->where('is_settlement', 0)->where('pay_type', 'in', '0,1,2,4')->cursor();
113
-//        $StoreOrderStatusRepository = app()->make(StoreOrderStatusRepository::class);
114
-//        $OrderMerchantRepository    = app()->make(OrderMerchantRepository::class);
115
-//        $OrderGzcRepository         = app()->make(OrderGzcRepository::class);
116
-//        foreach ($cursor as $online) {
117
-//            $status = $StoreOrderStatusRepository->getWhere(['order_id' => $online['order_id'], 'change_type' => 'take']);
118
-//            if ($online['mer_id'] == 496) {
119
-//                if (!in_array($online['status'], [0, 1, 2, 3])) {
120
-//                    continue;
121
-//                }
122
-//                if (time() < strtotime($online['pay_time']) + 3600 * 24) {
123
-//                    Log::info('还没有到收货后' . $timeLimit . '天');
124
-//                    continue;
125
-//                }
126
-//            } else {
127
-//                if (!in_array($online['status'], [2, 3])) {
128
-//                    continue;
129
-//                }
130
-//                if (Carbon::now()->modify("-{$timeLimit} days")->lt($status->change_time ?? $status['change_time'])) {
131
-//                    Log::info('还没有到收货后' . $timeLimit . '天');
132
-//                    continue;
133
-//                }
134
-//            }
135
-//
136
-//            $StoreOrderRepository = app()->make(StoreOrderRepository::class);
137
-//            Db::transaction(function () use ($online, $StoreOrderRepository) {
138
-//                $order = StoreOrder::getInstance()->find($online['order_id']);
139
-//                $order->is_settlement   = 1;
140
-//                $order->settlement_time = date('Y-m-d H:i:s');
141
-//                $order->save();
142
-//
143
-//                // 结算积分
144
-//                $user_sign_score_list = Db::name('user_sign_score')
145
-//                    ->where('status', -1)
146
-//                    ->where('order_id', $online['order_id'])
147
-//                    ->whereIn('type', [1, 2])
148
-//                    ->select()
149
-//                    ->toArray();
150
-//                foreach ($user_sign_score_list as $user_sign_score) {
151
-//                    // 修改积分
152
-//                    Db::name('user')
153
-//                        ->where('uid', $user_sign_score['uid'])
154
-//                        ->inc('score', (float)$user_sign_score['reward_socre'])
155
-//                        ->update();
156
-//                    Db::name('user_sign_score')
157
-//                        ->where('status', -1)
158
-//                        ->where('id', $user_sign_score['id'])
159
-//                        ->update([
160
-//                            'status'          => 1,
161
-//                            'settlement_time' => date('Y-m-d H:i:s')
162
-//                        ]);
163
-//                }
164
-//
165
-//                // 结算红包
166
-//                $user_sign_hongbao_list = Db::name('user_sign_hongbao')
167
-//                    ->where('status', -1)
168
-//                    ->where('order_id', $online['order_id'])
169
-//                    ->whereIn('type', [1, 2])
170
-//                    ->select()
171
-//                    ->toArray();
172
-//                foreach ($user_sign_hongbao_list as $user_sign_hongbao) {
173
-//                    // 修改红包
174
-//                    Db::name('user')
175
-//                        ->where('uid', $user_sign_hongbao['uid'])
176
-//                        ->inc('hongbao', (float)$user_sign_hongbao['number'])
177
-//                        ->update();
178
-//                    Db::name('user_sign_hongbao')
179
-//                        ->where('status', -1)
180
-//                        ->where('id', $user_sign_hongbao['id'])
181
-//                        ->update([
182
-//                            'status'          => 1,
183
-//                            'settlement_time' => date('Y-m-d H:i:s')
184
-//                        ]);
185
-//                }
186
-//
187
-//
188
-//                // 结算京豆
189
-//                $user_sign_jingdou_list = Db::name('user_sign_jingdou')
190
-//                    ->where('status', -1)
191
-//                    ->where('order_id', $online['order_id'])
192
-//                    ->whereIn('type', [1, 2])
193
-//                    ->select()
194
-//                    ->toArray();
195
-//                foreach ($user_sign_jingdou_list as $user_sign_jingdou) {
196
-//                    // 修改京豆
197
-//                    Db::name('user')
198
-//                        ->where('uid', $user_sign_jingdou['uid'])
199
-//                        ->inc('jingdou', (float)$user_sign_jingdou['number'])
200
-//                        ->update();
201
-//                    Db::name('user_sign_jingdou')
202
-//                        ->where('status', -1)
203
-//                        ->where('id', $user_sign_jingdou['id'])
204
-//                        ->update([
205
-//                            'status'          => 1,
206
-//                            'settlement_time' => date('Y-m-d H:i:s')
207
-//                        ]);
208
-//                }
209
-//
210
-//
211
-//
212
-//                // 结算复购金
213
-//                $user_sign_fugou_list = Db::name('user_sign_fugou')
214
-//                    ->where('status', -1)
215
-//                    ->where('order_id', $online['order_id'])
216
-//                    ->whereIn('type', [1, 2])
217
-//                    ->select()
218
-//                    ->toArray();
219
-//                foreach ($user_sign_fugou_list as $user_sign_fugou) {
220
-//                    // 修改复购金
221
-//                    Db::name('user')
222
-//                        ->where('uid', $user_sign_fugou['uid'])
223
-//                        ->inc('fugou', (float)$user_sign_fugou['number'])
224
-//                        ->update();
225
-//                    Db::name('user_sign_fugou')
226
-//                        ->where('status', -1)
227
-//                        ->where('id', $user_sign_fugou['id'])
228
-//                        ->update([
229
-//                            'status'          => 1,
230
-//                            'settlement_time' => date('Y-m-d H:i:s')
231
-//                        ]);
232
-//                }
233
-//
234
-//
235
-//                // 结算贡献值
236
-//                $user_sign_gongxian_list = Db::name('user_sign_gongxian')
237
-//                    ->where('status', -1)
238
-//                    ->where('order_id', $online['order_id'])
239
-//                    ->whereIn('type', [1, 2])
240
-//                    ->select()
241
-//                    ->toArray();
242
-//                foreach ($user_sign_gongxian_list as $user_sign_gongxian) {
243
-//                    // 修改贡献值
244
-//                    Db::name('user')
245
-//                        ->where('uid', $user_sign_gongxian['uid'])
246
-//                        ->inc('contribute', (float)$user_sign_gongxian['number'])
247
-//                        ->update();
248
-//                    Db::name('user_sign_gongxian')
249
-//                        ->where('status', -1)
250
-//                        ->where('id', $user_sign_gongxian['id'])
251
-//                        ->update([
252
-//                            'status'          => 1,
253
-//                            'settlement_time' => date('Y-m-d H:i:s')
254
-//                        ]);
255
-//                }
256
-//
257
-//
258
-//                // 结算佣金
259
-//                $user_bill_list = Db::name('user_bill')
260
-//                    ->where('status', 0)
261
-//                    ->where('commission_type','<>', 5)
262
-//                    ->where([ 'link_id' => $online['order_id'], 'order_sn' => $online['order_sn']])
263
-//                    ->select()
264
-//                    ->toArray();
265
-//                foreach ($user_bill_list as $user_bill) {
266
-//                    if ($user_bill['commission_type'] != 5) {
267
-//                        if (in_array($user_bill['commission_type'], [7,12,19])) {
268
-//                            Db::name("merchant")
269
-//                                ->where("mer_id", $user_bill['mer_id'])
270
-//                                ->inc('brokerage_price', (float)$user_bill['number'])
271
-//                                ->update();
272
-//                        } else {
273
-//                            Db::name('user')
274
-//                                ->where('uid', $user_bill['uid'])
275
-//                                ->inc('brokerage_price', (float)$user_bill['number'])
276
-//                                ->update();
277
-//                        }
278
-//                    }
279
-//                    if ($online['pay_type'] == 0 && $user_bill['commission_type'] == 5) {
280
-//                    } else {
281
-//                        // 虚拟支付的养老金不修改不结算
282
-//                        Db::name('user_bill')
283
-//                            ->where('status', 0)
284
-//                            ->where('bill_id', $user_bill['bill_id'])
285
-//                            ->update([
286
-//                                'status'    => 1,
287
-//                                'take_time' => time()
288
-//                            ]);
289
-//                    }
290
-//                    if ($online['pay_type'] == 0 && $user_bill['commission_type'] == 5) {
291
-//                    } else {
292
-//                        // 虚拟支付的养老金不修改不结算
293
-//                        Db::name('user_bill')
294
-//                            ->where('status', 0)
295
-//                            ->where('bill_id', $user_bill['bill_id'])
296
-//                            ->update([
297
-//                                'status'    => 1,
298
-//                                'take_time' => time()
299
-//                            ]);
300
-//                    }
301
-//                }
302
-//                //按角色结算
303
-//                $StoreOrderRepository->close_order($online['order_id']);
304
-//            });
305
-//        }
306 87
     }
307 88
 
308 89
 }

+ 20 - 13
app/common/repositories/movie/MovieRepository.php

@@ -155,9 +155,7 @@ class MovieRepository extends BaseRepository
155 155
             $group = Db::transaction(function () use ($userinfo, $_order) {
156 156
                 $_order = $this->dao->create($_order);
157 157
                 if ($_order) return ['code' => ApiResponseService::DEFAULT_SUCCESS_CODE, 'msg' => '下单成功', 'data' => ['order_sn' => $_order['order_sn']]];
158
-//                return $this->pay(
159
-//                    $_order['pay_type'], $userinfo->wechat_user_id, $_order, $_order['film_name'], env('APP_URL') . "/api/hf_notify/movie",
160
-//                    'delay');
158
+
161 159
                 throw new ValidateException('下单失败');
162 160
             });
163 161
             return $group;
@@ -167,6 +165,25 @@ class MovieRepository extends BaseRepository
167 165
     }
168 166
 
169 167
     /**
168
+     * @param $userinfo
169
+     * @param $order_sn
170
+     * @return mixed|string
171
+     */
172
+    public function confirmOrder($userinfo, $order_sn)
173
+    {
174
+        $orderinfo = $this->dao->getWhere(['order_sn' => $order_sn, 'uid' => $userinfo->uid])->find();
175
+        if (empty($orderinfo)) throw new ValidateException('订单不存在');
176
+        if ($orderinfo['paid'] == 0 && $orderinfo['status'] == 2) throw new ValidateException('订单已超时');
177
+        if ($orderinfo['paid'] == 0 && $orderinfo['status'] == 3) throw new ValidateException('订单已取消');
178
+        if ($orderinfo['paid'] == 1) throw new ValidateException('订单已支付');
179
+
180
+//                return $this->pay(
181
+//                    $_order['pay_type'], $userinfo->wechat_user_id, $_order, $_order['film_name'], env('APP_URL') . "/api/hf_notify/movie",
182
+//                    'delay');
183
+        return DouHuoMallFilmApiRequest::confirmOrder($third_order, $order_price);
184
+    }
185
+
186
+    /**
170 187
      * 支付
171 188
      *
172 189
      * @param $payType
@@ -243,16 +260,6 @@ class MovieRepository extends BaseRepository
243 260
     }
244 261
 
245 262
     /**
246
-     * @param $third_order
247
-     * @param $order_price
248
-     * @return mixed|string
249
-     */
250
-    public function confirmOrder($third_order, $order_price)
251
-    {
252
-        return DouHuoMallFilmApiRequest::confirmOrder($third_order, $order_price);
253
-    }
254
-
255
-    /**
256 263
      * @param $userinfo
257 264
      * @param $order_sn
258 265
      * @return mixed|string

+ 14 - 11
app/common/repositories/store/order/StoreOrderRepository.php

@@ -10530,15 +10530,15 @@ class StoreOrderRepository extends BaseRepository
10530 10530
     {
10531 10531
         if ($order['pay_type'] == 1) {
10532 10532
             //微信
10533
-            if ($group_order['pay_wx'] == 3) {
10534
-                $hf_member_id = Db::name('merchant_member')->where('mer_id', $order['mer_id'])->where("type", 3)->value('member_id');
10535
-                $api_key = 'api_live_b0a687ec-5450-4ada-a0e4-65bac0f46871';
10536
-                $type = 3;
10537
-            } else {
10538
-                $hf_member_id = Db::name('merchant_member')->where('mer_id', $order['mer_id'])->where("type", 2)->value('member_id');
10539
-                $api_key = 'api_live_90ef02e4-54ac-41ee-adf1-e4927d23d58f';
10540
-                $type = 2;
10541
-            }
10533
+//            if ($group_order['pay_wx'] == 3) {
10534
+//            } else {
10535
+//                $hf_member_id = Db::name('merchant_member')->where('mer_id', $order['mer_id'])->where("type", 2)->value('member_id');
10536
+//                $api_key = 'api_live_90ef02e4-54ac-41ee-adf1-e4927d23d58f';
10537
+//                $type = 2;
10538
+//            }
10539
+            $hf_member_id = Db::name('merchant_member')->where('mer_id', $order['mer_id'])->where("type", 3)->value('member_id');
10540
+            $api_key = 'api_live_b0a687ec-5450-4ada-a0e4-65bac0f46871';
10541
+            $type = 3;
10542 10542
 
10543 10543
             // 平台特殊账户
10544 10544
             $hf_platform_member_id = Db::name('merchant_member')->where(['mer_id' => $dst_mer_id, 'type' => $type])->value('member_id');
@@ -10660,10 +10660,13 @@ class StoreOrderRepository extends BaseRepository
10660 10660
 
10661 10661
             // @todo 预分账处理 496:表示{会员专区}账户,本区分账到{会员专区}账户,故:hf_platform_member_id 为入账账户
10662 10662
             $isSuccessed = $this->prepareExecuteIndependentAccount(
10663
-                $order, $order_group_data, $independentAccount['api_key'], $independentAccount['hf_platform_member_id'], '', $order['con_pri'], 0
10663
+                $order, $order_group_data, $independentAccount['api_key'], $independentAccount['hf_platform_member_id'], '',
10664
+                $order['pay_price'], 0
10664 10665
             );
10666
+            if ($isSuccessed) {
10667
+                Db::name("log")->insert(array('data' => '会员专区-订单分账:' . json_encode($order, JSON_FORCE_OBJECT)));//日志记录
10668
+            }
10665 10669
 
10666
-            Db::name("log")->insert(array('data' => '会员专区-订单分账:' . json_encode($order, JSON_FORCE_OBJECT)));//日志记录
10667 10670
         }
10668 10671
     }
10669 10672
 

+ 4 - 7
app/controller/api/movie/Movie.php

@@ -172,13 +172,10 @@ class Movie extends BaseController
172 172
      */
173 173
     public function confirmOrder()
174 174
     {
175
-        $relation_id = $this->request->param(['relation_id']);
176
-        if (empty($cinema_sign)) return app('json')->fail('请选择场次');
177
-
178
-        $sched_sign = $this->request->param(['sched_sign']);
179
-        if (empty($film_sign)) return app('json')->fail('请选择场次');
175
+        $order_sn = $this->request->param(['order_sn']);
176
+        if (empty($order_sn)) return app('json')->fail('订单不存在');
180 177
 
181
-        return app('json')->success($this->repository->confirmOrder($relation_id, $sched_sign));
178
+        return app('json')->success($this->repository->confirmOrder($this->request->userInfo(), $order_sn));
182 179
     }
183 180
 
184 181
     /**
@@ -188,7 +185,7 @@ class Movie extends BaseController
188 185
      */
189 186
     public function getOrderInfo()
190 187
     {
191
-        $order_sn = $this->request->param('order_sn','');
188
+        $order_sn = $this->request->param('order_sn', '');
192 189
         if (empty($order_sn)) return app('json')->fail('订单不存在');
193 190
 
194 191
         return app('json')->success($this->repository->getOrderInfo($this->request->userInfo(), $order_sn));

+ 2 - 0
config/console.php

@@ -20,5 +20,7 @@ return [
20 20
         'ln:import_store' => 'app\command\test\ln\ImportStore',
21 21
         'ln:user_bill' => 'app\command\test\ln\UserBill',
22 22
         'ln:import_user_cxb' => 'app\command\test\ln\ImportUser2',
23
+//        'great_life_order_independent_account' => 'app\command\GreatLifeOrderIndependentAccount',
24
+//        'commercial-\_area_order_independent_account' => 'app\command\CommercialAreaOrderIndependentAccount'
23 25
     ],
24 26
 ];