hefei vor 1 Jahr
Ursprung
Commit
dc065bbfa3
2 geänderte Dateien mit 230 neuen und 0 gelöschten Zeilen
  1. 228 0
      app/controller/api/store/product/Other.php
  2. 2 0
      route/api.php

+ 228 - 0
app/controller/api/store/product/Other.php

@@ -161,6 +161,234 @@ 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')
166
+                    ->where('uid', $userId)
167
+                    ->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
168
+                    ->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
169
+                    ->order('id', 'desc')
170
+                    ->page($page, $limit)->select()
171
+                    ->each(function ($value) {
172
+                        $value['source'] = 1;
173
+                        $billEndTime = $value['bill_end_time'];
174
+                        $value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
175
+                        //'0平台未结算1已结算2失效
176
+                        $statusName = ['未结算', '已结算', '失效'];
177
+                        $value['status_name'] = $statusName[$value['bill_status']];
178
+                        $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
+                        if (!$yanglao|| $yanglao <= 0){
184
+                            $yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
185
+                        }
186
+                        $value['yanglao'] = $yanglao;
187
+                        return $value;
188
+                    });
189
+                break;
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')
193
+                    ->where('uid', $userId)
194
+                    ->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
195
+                    ->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
196
+                    ->order('id', 'desc')
197
+                    ->page($page, $limit)->select()
198
+                    ->each(function ($value) {
199
+                        $value['source'] = 2;
200
+                        $billEndTime = $value['bill_end_time'];
201
+                        $value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
202
+                        //'0平台未结算1已结算2失效
203
+                        $statusName = ['未结算', '已结算', '失效'];
204
+                        $value['status_name'] = $statusName[$value['bill_status']];
205
+                        $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
+                        if (!$yanglao|| $yanglao <= 0){
211
+                            $yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
212
+                        }
213
+                        $value['yanglao'] = $yanglao;
214
+                        return $value;
215
+                    });
216
+                break;
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')
220
+                    ->where('uid', $userId)
221
+                    ->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
222
+                    ->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
223
+                    ->order('id', 'desc')
224
+                    ->page($page, $limit)->select()
225
+                    ->each(function ($value) {
226
+                        $value['source'] = 3;
227
+                        $billEndTime = $value['bill_end_time'];
228
+                        $value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
229
+                        //'0平台未结算1已结算2失效
230
+                        $statusName = ['未结算', '已结算', '失效'];
231
+                        $value['status_name'] = $statusName[$value['bill_status']];
232
+                        $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
+                        if (!$yanglao|| $yanglao <= 0){
238
+                            $yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
239
+                        }
240
+                        $value['yanglao'] = $yanglao;
241
+                        return $value;
242
+                    });
243
+                break;
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')
247
+                    ->where('uid', $userId)
248
+                    ->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
249
+                    ->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
250
+                    ->order('id', 'desc')
251
+                    ->page($page, $limit)->select()
252
+                    ->each(function ($value) {
253
+                        $otherStatus = $value['tk_status'];
254
+                        $value['other_status_desc'] = TbOrderModel::$statusName[$otherStatus] ?? '未知类型';
255
+                        $value['source'] = 5;
256
+                        $billEndTime = $value['bill_end_time'];
257
+                        $value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
258
+                        //'0平台未结算1已结算2失效
259
+                        $statusName = ['未结算', '已结算', '失效'];
260
+                        $value['status_name'] = $statusName[$value['bill_status']];
261
+                        $commission = $value['commission'];
262
+                        if ($commission == 0) {
263
+                            $commission = sprintf('%.2f', $value['commission_rate'] * $value['pay_money'] / 100);
264
+                        }
265
+                        $yanglao = 0;
266
+                        if ($commission) {
267
+                            $yanglao = Db::name("user_bill") -> where("order_sn",$value['order_sn']) -> value("number");
268
+                        }
269
+                        if (!$yanglao|| $yanglao <= 0){
270
+                            $yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
271
+                        }
272
+                        if (strpos($value['goods_img'], 'http') === false){
273
+                            $value['goods_img'] = "http:".$value['goods_img'];
274
+                        }
275
+                        $value['yanglao'] = $yanglao;
276
+                        return $value;
277
+                    });
278
+                break;
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')
282
+                    ->where('uid', $userId)
283
+                    ->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
284
+                    ->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
285
+                    ->order('id', 'desc')
286
+                    ->page($page, $limit)->select()
287
+                    ->each(function ($value) {
288
+                        $otherStatus = $value['status'];
289
+                        $value['other_status_desc'] = JdOrderModel::$statusName[$otherStatus] ?? '未知订单状态';
290
+                        $value['source'] = 6;
291
+                        $billEndTime = $value['bill_end_time'];
292
+                        $value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
293
+                        //'0平台未结算1已结算2失效
294
+                        $statusName = ['未结算', '已结算', '失效'];
295
+                        $value['status_name'] = $statusName[$value['bill_status']];
296
+                        $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
+                        if (!$yanglao|| $yanglao <= 0){
302
+                            $yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
303
+                        }
304
+                        $value['yanglao'] = $yanglao;
305
+                        return $value;
306
+                    });
307
+                break;
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')
311
+                    ->where('uid', $userId)
312
+                    ->where('pay_success_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
313
+                    ->where('pay_success_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
314
+                    ->order('id', 'desc')
315
+                    ->page($page, $limit)->select()
316
+                    ->each(function ($value) {
317
+                        $otherStatus = $value['status'];
318
+                        $value['other_status_desc'] = DyOrderModel::$statusName[$otherStatus] ?? '未知订单状态';
319
+                        $value['source'] = 9;
320
+                        $billEndTime = $value['bill_end_time'];
321
+                        $value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
322
+                        //'0平台未结算1已结算2失效
323
+                        $statusName = ['未结算', '已结算', '失效'];
324
+                        $value['status_name'] = $statusName[$value['bill_status']];
325
+                        $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
+                        if (!$yanglao|| $yanglao <= 0){
331
+                            $yanglao = app()->make(ProductRepository::class)->yanglaojin(0, $commission);
332
+                        }
333
+                        $value['yanglao'] = $yanglao;
334
+                        return $value;
335
+                    });
336
+                break;
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')
340
+                    ->where('uid', $userId)
341
+                    ->where('create_time', '>', date('Y-m-d H:i:s', strtotime($startTime)))
342
+                    ->where('create_time', '<', date('Y-m-d H:i:s', strtotime($endTime)))
343
+                    ->order('id', 'desc')
344
+                    ->page($page, $limit)->select()
345
+                    ->each(function ($value) {
346
+                        $value['source'] = 10;
347
+                        $billEndTime = $value['bill_end_time'];
348
+                        $value['bill_end_time'] = $billEndTime ? date('Y-m-d H:i:s', $billEndTime) : '';
349
+                        //'0平台未结算1已结算2失效
350
+                        $statusName = ['未结算', '已结算', '失效'];
351
+                        $value['status_name'] = $statusName[$value['bill_status']];
352
+                        $commission = $value['commission'];
353
+                        $yanglao = 0;
354
+                        if ($commission) {
355
+                            $yanglao = Db::name("user_bill")->where("order_sn",$value['order_sn']) -> value("number");
356
+                        }
357
+                        if (!$yanglao|| $yanglao <= 0){
358
+                            $systemvalueObj = Db::name('system_config_value')->where('config_key','sanfangfenpei')->find();
359
+                            $sanfangfenpei=json_decode($systemvalueObj['value'],true);
360
+                            $yanglao=$commission*$sanfangfenpei['yanglaojin']; //新的养老金
361
+                        }
362
+                        $value['yanglao'] = $yanglao;
363
+                        return $value;
364
+                    });
365
+                break;
366
+            default:
367
+                $list = [];
368
+        }
369
+        return self::returnInfo(true, '获取订单列表成功', ['list' => $list]);
370
+    }
371
+
372
+    //获取用第三方订单养老金列表
373
+    public function otherOrderBill()
374
+    {
375
+        $params = request()->param();
376
+        if (empty($params['type'])) {
377
+            return self::returnInfo(false, "type类型不能为空");
378
+        }
379
+        $startTime = date("Y-m-d H:i:s", 1);
380
+        $endTime = date('Y-m-d H:i:s', time());
381
+        if (isset($params['date']) && !empty($params['date'])) {
382
+            $date = $params['date'];
383
+            list($startTime, $endTime) = explode("-", $date);
384
+        }
385
+
386
+
387
+        $userId = $this->uid;
388
+        [$page, $limit] = $this->getPage();
389
+        //1多多进宝2唯品会3苏宁易购4网易考拉5淘宝客6京东联盟7饿了么
390
+        switch ($params['type']) {
391
+            case 1://多多进宝
164 392
                 $list = Db::name('user_bill')
165 393
                     ->field('number,order_sn')
166 394
                     ->where('uid', $userId)

+ 2 - 0
route/api.php

@@ -539,6 +539,8 @@ Route::group('api/', function () {
539 539
         Route::get('h5/cps_link', 'api.store.product.Other/getCpsInfo');
540 540
         //查询某个用户的第三方订单列表
541 541
         Route::get('user/third_order', 'api.store.product.Other/otherOrder');
542
+        // 三方养老金列表
543
+        Route::get('user/third_order_bill', 'api.store.product.Other/otherOrderBill');
542 544
         //第三方平台养老金明细记录
543 545
         Route::any('third/all', 'api.store.product.Other/allThirdOrders');
544 546