|
|
@@ -161,14 +161,18 @@ class Other extends BaseController
|
|
161
|
161
|
//1多多进宝2唯品会3苏宁易购4网易考拉5淘宝客6京东联盟7饿了么
|
|
162
|
162
|
switch ($params['type']) {
|
|
163
|
163
|
case 1://多多进宝
|
|
164
|
|
- $list = Db::name('order_pdd')
|
|
165
|
|
- ->field('order_pdd_id id,goods_id,goods_sign,order_sn,goods_num,goods_img,goods_name,goods_price,pin_order_status other_status,pin_order_status_desc other_status_desc,order_money,pay_money,create_time,commission,bill_status,bill_end_time')
|
|
|
164
|
+ $list = Db::name('user_bill')
|
|
|
165
|
+ ->field('number,order_sn')
|
|
166
|
166
|
->where('uid', $userId)
|
|
|
167
|
+ ->where('commission_type',5)
|
|
167
|
168
|
->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
|
|
168
|
169
|
->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
|
|
169
|
|
- ->order('id', 'desc')
|
|
|
170
|
+ ->order('bill_id', 'desc')
|
|
170
|
171
|
->page($page, $limit)->select()
|
|
171
|
172
|
->each(function ($value) {
|
|
|
173
|
+ $pdd_list = Db::name("order_pdd")->where("order_sn",$value['order_sn'])->field('order_pdd_id id,goods_id,goods_sign,order_sn,goods_num,goods_img,goods_name,goods_price,pin_order_status other_status,pin_order_status_desc other_status_desc,order_money,pay_money,create_time,commission,bill_status,bill_end_time');
|
|
|
174
|
+ $value = array_merge($value,$pdd_list);
|
|
|
175
|
+ $yanglao = $value['number'];
|
|
172
|
176
|
$value['source'] = 1;
|
|
173
|
177
|
$billEndTime = $value['bill_end_time'];
|
|
174
|
178
|
$value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
|
|
|
@@ -176,10 +180,6 @@ class Other extends BaseController
|
|
176
|
180
|
$statusName = ['未结算', '已结算', '失效'];
|
|
177
|
181
|
$value['status_name'] = $statusName[$value['bill_status']];
|
|
178
|
182
|
$commission = $value['commission'];
|
|
179
|
|
- $yanglao = 0;
|
|
180
|
|
- if ($commission) {
|
|
181
|
|
- $yanglao = Db::name("user_bill") -> where("order_sn",$value['order_sn']) -> value("number");
|
|
182
|
|
- }
|
|
183
|
183
|
if (!$yanglao|| $yanglao <= 0){
|
|
184
|
184
|
$yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
|
|
185
|
185
|
}
|
|
|
@@ -188,14 +188,18 @@ class Other extends BaseController
|
|
188
|
188
|
});
|
|
189
|
189
|
break;
|
|
190
|
190
|
case 2://唯品会(没有商品价格)
|
|
191
|
|
- $list = Db::name('order_vip')
|
|
192
|
|
- ->field('order_vip_id id,goods_id,order_sn,goods_count goods_num,goods_thumb goods_img,goods_name,order_status other_status_desc,order_time create_time,commission,bill_status,bill_end_time,pay_money')
|
|
|
191
|
+ $list = Db::name('user_bill')
|
|
|
192
|
+ ->field('number,order_sn')
|
|
193
|
193
|
->where('uid', $userId)
|
|
|
194
|
+ ->where('commission_type',5)
|
|
194
|
195
|
->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
|
|
195
|
196
|
->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
|
|
196
|
|
- ->order('id', 'desc')
|
|
|
197
|
+ ->order('bill_id', 'desc')
|
|
197
|
198
|
->page($page, $limit)->select()
|
|
198
|
199
|
->each(function ($value) {
|
|
|
200
|
+ $vip_list = Db::name("order_vip")->where("order_sn",$value['order_sn'])->field('order_vip_id id,goods_id,order_sn,goods_count goods_num,goods_thumb goods_img,goods_name,order_status other_status_desc,order_time create_time,commission,bill_status,bill_end_time,pay_money');
|
|
|
201
|
+ $value = array_merge($value,$vip_list);
|
|
|
202
|
+ $yanglao = $value['number'];
|
|
199
|
203
|
$value['source'] = 2;
|
|
200
|
204
|
$billEndTime = $value['bill_end_time'];
|
|
201
|
205
|
$value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
|
|
|
@@ -203,10 +207,6 @@ class Other extends BaseController
|
|
203
|
207
|
$statusName = ['未结算', '已结算', '失效'];
|
|
204
|
208
|
$value['status_name'] = $statusName[$value['bill_status']];
|
|
205
|
209
|
$commission = $value['commission'];
|
|
206
|
|
- $yanglao = 0;
|
|
207
|
|
- if ($commission) {
|
|
208
|
|
- $yanglao = Db::name("user_bill") -> where("order_sn",$value['order_sn']) -> value("number");
|
|
209
|
|
- }
|
|
210
|
210
|
if (!$yanglao|| $yanglao <= 0){
|
|
211
|
211
|
$yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
|
|
212
|
212
|
}
|
|
|
@@ -215,14 +215,18 @@ class Other extends BaseController
|
|
215
|
215
|
});
|
|
216
|
216
|
break;
|
|
217
|
217
|
case 3://苏宁订单列表
|
|
218
|
|
- $list = Db::name('order_su')
|
|
219
|
|
- ->field('order_su_id id,goods_id,order_sn,goods_count goods_num,goods_thumb goods_img,goods_name,status other_status_desc,order_time create_time,commission,bill_status,bill_end_time,pay_amount')
|
|
|
218
|
+ $list = Db::name('user_bill')
|
|
|
219
|
+ ->field('number,order_sn')
|
|
220
|
220
|
->where('uid', $userId)
|
|
|
221
|
+ ->where('commission_type',5)
|
|
221
|
222
|
->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
|
|
222
|
223
|
->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
|
|
223
|
|
- ->order('id', 'desc')
|
|
|
224
|
+ ->order('bill_id', 'desc')
|
|
224
|
225
|
->page($page, $limit)->select()
|
|
225
|
226
|
->each(function ($value) {
|
|
|
227
|
+ $su_list = Db::name("order_su")->where("order_sn",$value['order_sn'])->field('order_su_id id,goods_id,order_sn,goods_count goods_num,goods_thumb goods_img,goods_name,status other_status_desc,order_time create_time,commission,bill_status,bill_end_time,pay_amount');
|
|
|
228
|
+ $value = array_merge($value,$su_list);
|
|
|
229
|
+ $yanglao = $value['number'];
|
|
226
|
230
|
$value['source'] = 3;
|
|
227
|
231
|
$billEndTime = $value['bill_end_time'];
|
|
228
|
232
|
$value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
|
|
|
@@ -230,10 +234,6 @@ class Other extends BaseController
|
|
230
|
234
|
$statusName = ['未结算', '已结算', '失效'];
|
|
231
|
235
|
$value['status_name'] = $statusName[$value['bill_status']];
|
|
232
|
236
|
$commission = $value['commission'];
|
|
233
|
|
- $yanglao = 0;
|
|
234
|
|
- if ($commission) {
|
|
235
|
|
- $yanglao = Db::name("user_bill") -> where("order_sn",$value['order_sn']) -> value("number");
|
|
236
|
|
- }
|
|
237
|
237
|
if (!$yanglao|| $yanglao <= 0){
|
|
238
|
238
|
$yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
|
|
239
|
239
|
}
|
|
|
@@ -242,14 +242,18 @@ class Other extends BaseController
|
|
242
|
242
|
});
|
|
243
|
243
|
break;
|
|
244
|
244
|
case 5://淘宝客
|
|
245
|
|
- $list = Db::name('order_tb')
|
|
246
|
|
- ->field('order_tb_id id,item_id goods_id,order_sn,item_num goods_num,item_img goods_img,item_title goods_name,item_price goods_price,tk_status,create_time,commission,commission_rate,alipay_total_price pay_money,bill_status,bill_end_time')
|
|
|
245
|
+ $list = Db::name('user_bill')
|
|
|
246
|
+ ->field('number,order_sn')
|
|
247
|
247
|
->where('uid', $userId)
|
|
|
248
|
+ ->where('commission_type',5)
|
|
248
|
249
|
->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
|
|
249
|
250
|
->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
|
|
250
|
|
- ->order('id', 'desc')
|
|
|
251
|
+ ->order('bill_id', 'desc')
|
|
251
|
252
|
->page($page, $limit)->select()
|
|
252
|
253
|
->each(function ($value) {
|
|
|
254
|
+ $tb_list = Db::name("order_tb")->where("order_sn",$value['order_sn'])->field('order_tb_id id,item_id goods_id,order_sn,item_num goods_num,item_img goods_img,item_title goods_name,item_price goods_price,tk_status,create_time,commission,commission_rate,alipay_total_price pay_money,bill_status,bill_end_time');
|
|
|
255
|
+ $value = array_merge($value,$tb_list);
|
|
|
256
|
+ $yanglao = $value['number'];
|
|
253
|
257
|
$otherStatus = $value['tk_status'];
|
|
254
|
258
|
$value['other_status_desc'] = TbOrderModel::$statusName[$otherStatus] ?? '未知类型';
|
|
255
|
259
|
$value['source'] = 5;
|
|
|
@@ -262,10 +266,6 @@ class Other extends BaseController
|
|
262
|
266
|
if ($commission == 0) {
|
|
263
|
267
|
$commission = sprintf('%.2f', $value['commission_rate'] * $value['pay_money'] / 100);
|
|
264
|
268
|
}
|
|
265
|
|
- $yanglao = 0;
|
|
266
|
|
- if ($commission) {
|
|
267
|
|
- $yanglao = Db::name("user_bill") -> where("order_sn",$value['order_sn']) -> value("number");
|
|
268
|
|
- }
|
|
269
|
269
|
if (!$yanglao|| $yanglao <= 0){
|
|
270
|
270
|
$yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
|
|
271
|
271
|
}
|
|
|
@@ -277,14 +277,18 @@ class Other extends BaseController
|
|
277
|
277
|
});
|
|
278
|
278
|
break;
|
|
279
|
279
|
case 6://京东订单
|
|
280
|
|
- $list = Db::name('order_jd')
|
|
281
|
|
- ->field('order_jd_id id,sku_id goods_id,order_sn,sku_num goods_num,image_url goods_img,sku_name goods_name,pay_money,price goods_price,status,create_time,commission,bill_status,bill_end_time')
|
|
|
280
|
+ $list = Db::name('user_bill')
|
|
|
281
|
+ ->field('number,order_sn')
|
|
282
|
282
|
->where('uid', $userId)
|
|
|
283
|
+ ->where('commission_type',5)
|
|
283
|
284
|
->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
|
|
284
|
285
|
->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
|
|
285
|
|
- ->order('id', 'desc')
|
|
|
286
|
+ ->order('bill_id', 'desc')
|
|
286
|
287
|
->page($page, $limit)->select()
|
|
287
|
288
|
->each(function ($value) {
|
|
|
289
|
+ $jd_list = Db::name("order_jd")->where("order_sn",$value['order_sn'])->field('order_jd_id id,sku_id goods_id,order_sn,sku_num goods_num,image_url goods_img,sku_name goods_name,pay_money,price goods_price,status,create_time,commission,bill_status,bill_end_time');
|
|
|
290
|
+ $value = array_merge($value,$jd_list);
|
|
|
291
|
+ $yanglao = $value['number'];
|
|
288
|
292
|
$otherStatus = $value['status'];
|
|
289
|
293
|
$value['other_status_desc'] = JdOrderModel::$statusName[$otherStatus] ?? '未知订单状态';
|
|
290
|
294
|
$value['source'] = 6;
|
|
|
@@ -294,10 +298,6 @@ class Other extends BaseController
|
|
294
|
298
|
$statusName = ['未结算', '已结算', '失效'];
|
|
295
|
299
|
$value['status_name'] = $statusName[$value['bill_status']];
|
|
296
|
300
|
$commission = $value['commission'];
|
|
297
|
|
- $yanglao = 0;
|
|
298
|
|
- if ($commission) {
|
|
299
|
|
- $yanglao = Db::name("user_bill") -> where("order_sn",$value['order_sn']) -> value("number");
|
|
300
|
|
- }
|
|
301
|
301
|
if (!$yanglao|| $yanglao <= 0){
|
|
302
|
302
|
$yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
|
|
303
|
303
|
}
|
|
|
@@ -306,14 +306,18 @@ class Other extends BaseController
|
|
306
|
306
|
});
|
|
307
|
307
|
break;
|
|
308
|
308
|
case 9: //抖音
|
|
309
|
|
- $list = Db::name('order_dy')
|
|
310
|
|
- ->field('order_dy_id id,product_id goods_id,order_sn,product_num goods_num,product_img goods_img,product_name goods_name,commission,total_pay_amount pay_money,bill_status,bill_end_time,create_time,flow_point status,pay_success_time')
|
|
|
309
|
+ $list = Db::name('user_bill')
|
|
|
310
|
+ ->field('number,order_sn')
|
|
311
|
311
|
->where('uid', $userId)
|
|
|
312
|
+ ->where('commission_type',5)
|
|
312
|
313
|
->where('pay_success_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
|
|
313
|
314
|
->where('pay_success_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
|
|
314
|
|
- ->order('id', 'desc')
|
|
|
315
|
+ ->order('bill_id', 'desc')
|
|
315
|
316
|
->page($page, $limit)->select()
|
|
316
|
317
|
->each(function ($value) {
|
|
|
318
|
+ $dy_list = Db::name("order_dy")->where("order_sn",$value['order_sn'])->field('order_dy_id id,product_id goods_id,order_sn,product_num goods_num,product_img goods_img,product_name goods_name,commission,total_pay_amount pay_money,bill_status,bill_end_time,create_time,flow_point status,pay_success_time')->find();
|
|
|
319
|
+ $value = array_merge($value,$dy_list);
|
|
|
320
|
+ $yanglao = $value['number'];
|
|
317
|
321
|
$otherStatus = $value['status'];
|
|
318
|
322
|
$value['other_status_desc'] = DyOrderModel::$statusName[$otherStatus] ?? '未知订单状态';
|
|
319
|
323
|
$value['source'] = 9;
|
|
|
@@ -323,10 +327,6 @@ class Other extends BaseController
|
|
323
|
327
|
$statusName = ['未结算', '已结算', '失效'];
|
|
324
|
328
|
$value['status_name'] = $statusName[$value['bill_status']];
|
|
325
|
329
|
$commission = $value['commission'];
|
|
326
|
|
- $yanglao = 0;
|
|
327
|
|
- if ($commission) {
|
|
328
|
|
- $yanglao = Db::name("user_bill") -> where("order_sn",$value['order_sn']) -> value("number");
|
|
329
|
|
- }
|
|
330
|
330
|
if (!$yanglao|| $yanglao <= 0){
|
|
331
|
331
|
$yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
|
|
332
|
332
|
}
|
|
|
@@ -335,14 +335,17 @@ class Other extends BaseController
|
|
335
|
335
|
});
|
|
336
|
336
|
break;
|
|
337
|
337
|
case 10: //话费
|
|
338
|
|
- $list = Db::name('order_huafei')
|
|
339
|
|
- ->field('order_huafei_id id,order_sn,commission,amount_price pay_money,bill_status,bill_end_time,create_time,finish_time')
|
|
|
338
|
+ $list = Db::name('user_bill')
|
|
|
339
|
+ ->field('number,order_sn')
|
|
340
|
340
|
->where('uid', $userId)
|
|
|
341
|
+ ->where('commission_type',5)
|
|
341
|
342
|
->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
|
|
342
|
343
|
->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
|
|
343
|
|
- ->order('id', 'desc')
|
|
|
344
|
+ ->order('bill_id', 'desc')
|
|
344
|
345
|
->page($page, $limit)->select()
|
|
345
|
346
|
->each(function ($value) {
|
|
|
347
|
+ $huafei_list = Db::name("order_huafei")->where("order_sn",$value['order_sn'])->field('order_huafei_id id,order_sn,commission,amount_price pay_money,bill_status,bill_end_time,create_time,finish_time')->find();
|
|
|
348
|
+ $value = array_merge($value,$huafei_list);
|
|
346
|
349
|
$value['source'] = 10;
|
|
347
|
350
|
$billEndTime = $value['bill_end_time'];
|
|
348
|
351
|
$value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
|
|
|
@@ -350,10 +353,7 @@ class Other extends BaseController
|
|
350
|
353
|
$statusName = ['未结算', '已结算', '失效'];
|
|
351
|
354
|
$value['status_name'] = $statusName[$value['bill_status']];
|
|
352
|
355
|
$commission = $value['commission'];
|
|
353
|
|
- $yanglao = 0;
|
|
354
|
|
- if ($commission) {
|
|
355
|
|
- $yanglao = Db::name("user_bill")->where("order_sn",$value['order_sn']) -> value("number");
|
|
356
|
|
- }
|
|
|
356
|
+ $yanglao = $value['number'];
|
|
357
|
357
|
if (!$yanglao|| $yanglao <= 0){
|
|
358
|
358
|
$systemvalueObj = Db::name('system_config_value')->where('config_key','sanfangfenpei')->find();
|
|
359
|
359
|
$sanfangfenpei=json_decode($systemvalueObj['value'],true);
|