|
|
@@ -2,8 +2,8 @@
|
|
2
|
2
|
|
|
3
|
3
|
namespace app\controller\api\store\product;
|
|
4
|
4
|
|
|
5
|
|
-use app\common\model\system\admin\Log;
|
|
6
|
|
-use app\common\model\user\User;
|
|
|
5
|
+//use app\common\model\system\admin\Log;
|
|
|
6
|
+use think\facade\Log;
|
|
7
|
7
|
use app\common\model\user\UserThird;
|
|
8
|
8
|
use app\common\model\user\UserThirdOrder;
|
|
9
|
9
|
use app\common\repositories\store\product\ProductRepository;
|
|
|
@@ -510,10 +510,20 @@ class Vip extends BaseController
|
|
510
|
510
|
try{
|
|
511
|
511
|
$uid = $this->request->uid();
|
|
512
|
512
|
} catch (\Exception $e) {
|
|
|
513
|
+ g::info($e);
|
|
513
|
514
|
$uid=0;
|
|
514
|
515
|
}
|
|
515
|
516
|
$param = $this->request->param(['goodsId']);
|
|
516
|
517
|
$chanTag = $repository->getDetail(['uid' =>$uid, 'type' => 2], 'pid');
|
|
|
518
|
+ log::info("uid ={$uid}");
|
|
|
519
|
+ if(!$chanTag){
|
|
|
520
|
+ log::info("不存在");
|
|
|
521
|
+ $this->create_pid($uid);
|
|
|
522
|
+ $chanTag = $repository->getDetail(['uid' =>$uid, 'type' => 2], 'pid');
|
|
|
523
|
+ }
|
|
|
524
|
+ log::info("获取第三方pid");
|
|
|
525
|
+ log::info($chanTag);
|
|
|
526
|
+
|
|
517
|
527
|
$apiName = 'com.vip.adp.api.open.service.UnionGoodsService';
|
|
518
|
528
|
$params = [
|
|
519
|
529
|
'goodsIdList' => [$param['goodsId']],
|
|
|
@@ -724,7 +734,7 @@ class Vip extends BaseController
|
|
724
|
734
|
'orderTimeEnd' => time() * 1000,
|
|
725
|
735
|
];
|
|
726
|
736
|
*/
|
|
727
|
|
- $startTime = strtotime('-5minute') * 1000;
|
|
|
737
|
+ $startTime = strtotime('-50minute') * 1000;
|
|
728
|
738
|
$endTime = time() * 1000;
|
|
729
|
739
|
$type = ['order', 'update'];
|
|
730
|
740
|
$orderList = [];
|
|
|
@@ -733,6 +743,9 @@ class Vip extends BaseController
|
|
733
|
743
|
"{$value}TimeStart" => $startTime,
|
|
734
|
744
|
"{$value}TimeEnd" => $endTime,
|
|
735
|
745
|
];
|
|
|
746
|
+ log::info("====VIP 订单===");
|
|
|
747
|
+ log::info($params);
|
|
|
748
|
+
|
|
736
|
749
|
$result = $this->doOrderVip($params);
|
|
737
|
750
|
$result && $orderList[] = $result;
|
|
738
|
751
|
}
|
|
|
@@ -765,6 +778,7 @@ class Vip extends BaseController
|
|
765
|
778
|
//实际执行从vip拉取订单的方法
|
|
766
|
779
|
public function doOrderVip(array $params)
|
|
767
|
780
|
{
|
|
|
781
|
+
|
|
768
|
782
|
$page = 1;
|
|
769
|
783
|
$pageSize = 20;
|
|
770
|
784
|
$queryModel = array_merge($params, [
|
|
|
@@ -777,6 +791,8 @@ class Vip extends BaseController
|
|
777
|
791
|
do {
|
|
778
|
792
|
$request = ['queryModel' => $queryModel];
|
|
779
|
793
|
$result = $this->getUrlResult($apiName, "orderList", $request);
|
|
|
794
|
+ log::info("vip===返回订单数据");
|
|
|
795
|
+ log::info($result);
|
|
780
|
796
|
$lists = $result['result']['orderInfoList'] ?? [];
|
|
781
|
797
|
$countList = count($lists);
|
|
782
|
798
|
if (!empty($countList)) {
|
|
|
@@ -784,7 +800,7 @@ class Vip extends BaseController
|
|
784
|
800
|
}
|
|
785
|
801
|
$page++;
|
|
786
|
802
|
} while ($countList == $pageSize);
|
|
787
|
|
- if (!empty($orderLists)) {
|
|
|
803
|
+ if (!empty($orderLists)) {
|
|
788
|
804
|
//格式化从唯品会拉取的订单列表
|
|
789
|
805
|
$formatLists = $this->formatOrderList($orderLists);
|
|
790
|
806
|
//将唯品会订单进行处理
|
|
|
@@ -797,6 +813,7 @@ class Vip extends BaseController
|
|
797
|
813
|
//格式化从拼多多拉取的订单列表
|
|
798
|
814
|
public function formatOrderList($orderLists)
|
|
799
|
815
|
{
|
|
|
816
|
+ log::info("====唯品会订单拉取=====");
|
|
800
|
817
|
$user = app()->make(UserThirdRepository::class);
|
|
801
|
818
|
$formatLists = [];
|
|
802
|
819
|
foreach ($orderLists as $order) {
|
|
|
@@ -884,11 +901,23 @@ class Vip extends BaseController
|
|
884
|
901
|
$localOrder['commission'],
|
|
885
|
902
|
$localOrder['uid'],
|
|
886
|
903
|
$localOrder['order_sn'],
|
|
887
|
|
- $localOrder['bill_end_time'],
|
|
888
|
904
|
2
|
|
889
|
905
|
);
|
|
890
|
906
|
} else {
|
|
891
|
|
- $localOrder->save($order);//更新订单信息
|
|
|
907
|
+ log::info("lorder==={$localOrder['status']}====ooder+{$order['status']}");
|
|
|
908
|
+ if($localOrder['status']!=$order['status']){
|
|
|
909
|
+// log::info("进入修改lorder==={$localOrder['status']}======");
|
|
|
910
|
+// log::info("====ooder+{$order['status']}=======");
|
|
|
911
|
+ //修改积分和贡献,yanglaojin值记录
|
|
|
912
|
+ $orderThird->updateJilu(
|
|
|
913
|
+ $localOrder['uid'],
|
|
|
914
|
+ $localOrder['order_sn'],
|
|
|
915
|
+ 2);
|
|
|
916
|
+ $localOrder->save($order);//更新订单信息
|
|
|
917
|
+
|
|
|
918
|
+ }
|
|
|
919
|
+
|
|
|
920
|
+
|
|
892
|
921
|
}
|
|
893
|
922
|
}
|
|
894
|
923
|
}
|