hehaiqiang 1 год назад
Родитель
Сommit
b3f262d3d7

+ 1 - 0
app/common/repositories/store/product/ProductRepository.php

@@ -1751,6 +1751,7 @@ class ProductRepository extends BaseRepository
1751 1751
                         'gong_sku_id'      => $value['sku_id'],
1752 1752
                         'price'            => $value['edit_price'],
1753 1753
                         'plate_mer_profit' => $plate_mer_profit,
1754
+                        'concession_pri'    => $plate_mer_profit,
1754 1755
                         'cost'             => $attrInfo[$value['sku_id']]['cost'],
1755 1756
                         'ot_price'         => $attrInfo[$value['sku_id']]['ot_price'],
1756 1757
                         'gong_pension'     => $attrInfo[$value['sku_id']]['gong_pension']

+ 1 - 1
app/common/repositories/user/UserThirdRepository.php

@@ -820,7 +820,7 @@ class UserThirdRepository extends BaseRepository
820 820
 
821 821
                 //添加推荐献值
822 822
                 $tuigangongxian_data = [
823
-                    "uid"           =>$user_id,
823
+                    "uid"           =>$sprerdUser['uid'],
824 824
                     "number"  =>    $tuiguanyongjin,
825 825
                     "addtime"       =>time(),
826 826
                     "status"        =>-1,

+ 1 - 0
app/controller/api/Auth.php

@@ -1162,6 +1162,7 @@ $data=$user->toArray();
1162 1162
     public function checkSmsCode($phone, $code)
1163 1163
     {
1164 1164
         $sms_key = 'api.auth.sms.' . $phone;
1165
+        log::info("sdfsd =={$sms_key}");
1165 1166
         if (!$cache_code = Cache::get($sms_key)) return false;
1166 1167
         if ($code != $cache_code) return false;
1167 1168
         Cache::delete($sms_key);

+ 159 - 53
app/controller/api/merchant/sxy/Access.php

@@ -17,7 +17,7 @@ use crmeb\exceptions\AuthException;
17 17
 use think\Exception;
18 18
 use think\facade\Db;
19 19
 use think\facade\Request;
20
-
20
+use think\facade\Log;
21 21
 class Access
22 22
 {
23 23
     use HuiPay;
@@ -205,20 +205,20 @@ class Access
205 205
 
206 206
 
207 207
 //                        Db::name('merchant_annual_cost_order') -> where('order_no',$requestId[0]) -> update(['rand'=>$requestId[1],'serialNumber'=>$res['serialNumber']]);
208
-                        $order_data=Db::name('activation_code_order') -> where('order_no',$requestId[0]) -> find();
209
-                        Db::name('channel_user')->where('uid',$order_data['uid'])->update(['status'=>1]);
210
-                        if($order_data['status']==1){
211
-                            return false;
212
-                        }
213
-                        $id=Db::name('activation_code')->insertGetId([
214
-                            'uid'=>$order_data['uid'],
215
-                            'code'=>$this->randomFromDev(20),
216
-                            'ctime'=>time(),
217
-                            'status'=>1,
218
-                            'utime'=>time(),
219
-                            'use_uid'=>0,
220
-                            'type'=>1
221
-                        ]);
208
+                            $order_data=Db::name('activation_code_order') -> where('order_no',$requestId[0]) -> find();
209
+                            Db::name('channel_user')->where('uid',$order_data['uid'])->update(['status'=>1]);
210
+                            if($order_data['status']==1){
211
+                                return false;
212
+                            }
213
+                            $id=Db::name('activation_code')->insertGetId([
214
+                                'uid'=>$order_data['uid'],
215
+                                'code'=>$this->randomFromDev(20),
216
+                                'ctime'=>time(),
217
+                                'status'=>1,
218
+                                'utime'=>time(),
219
+                                'use_uid'=>0,
220
+                                'type'=>1
221
+                            ]);
222 222
 //                        $code_data=Db::name('activation_code')->where('status',0)->where('uid',0)->select();
223 223
 //                        if(!$code_data->isEmpty()){
224 224
 //                            $data=$code_data->toArray();
@@ -684,16 +684,16 @@ class Access
684 684
     {
685 685
 //        $domain = $this->request->domain();
686 686
 //        if(strpos($domain, 'test.hebeiyhc.com') !== false){
687
-            $requestId[0]=input('order_sn');
687
+        $requestId[0]=input('order_sn');
688 688
 //        $pay_type=5;
689
-            Db::name('store_group_order') -> where('group_order_sn',$requestId[0]) -> update(['rand'=>mt_rand(1000,9999)]);
689
+        Db::name('store_group_order') -> where('group_order_sn',$requestId[0]) -> update(['rand'=>mt_rand(1000,9999)]);
690 690
 
691
-            $orderSn = $requestId[0];
692
-            $groupOrder = app()->make(StoreGroupOrderRepository::class)->getWhere(['group_order_sn' => $orderSn]);
693
-            if (!$groupOrder || $groupOrder->paid == 1) return;
694
-            app()->make(StoreOrderRepository::class)->paySuccess($groupOrder);
691
+        $orderSn = $requestId[0];
692
+        $groupOrder = app()->make(StoreGroupOrderRepository::class)->getWhere(['group_order_sn' => $orderSn]);
693
+        if (!$groupOrder || $groupOrder->paid == 1) return;
694
+        app()->make(StoreOrderRepository::class)->paySuccess($groupOrder);
695 695
 //        event('pay_success_order', ['order_sn' => $requestId[0],'pay_type'=>$pay_type]);
696
-            dump('成功');
696
+        dump('成功');
697 697
 //        dump($this->randomFromDev(20));
698 698
 //        }
699 699
     }
@@ -720,11 +720,117 @@ class Access
720 720
         $result=rtrim($result,' ');
721 721
         return $result;
722 722
     }
723
+
723 724
     //小程序支付
724 725
     public function pay_wechat_mp(StoreGroupOrderRepository $groupOrderRepository){
725 726
         try {
727
+            log::info("微信小程序回调");
728
+            Db::name('log')->insert(['data'=>'汇付订单支付pay_wechat_mp-66666666---发起支付']);
729
+            $oid = Request::param('oid','');
730
+            $code = Request::param('code','');
731
+            $type = Request::param('type','');
732
+            $pay_open_id = Request::param('pay_open_id','');
733
+            if($oid == '')
734
+                return app('json')->fail("请检查参数是否正确");
735
+            $groupOrder = $groupOrderRepository->detail_noUid((int)$oid);
736
+            if (!$groupOrder)
737
+                return app('json')->fail('订单不存在或已支付');
738
+
739
+            $cart = Db::name("store_order")->where(['group_order_id'=>$oid]) -> value("cart_id");//日志记录
740
+            if($cart){
741
+                Db::name("log")->insert(array('data'=>json_encode($cart)));//日志记录
742
+                $cart = explode(",",$cart);
743
+                $cart_id = $cart[0];
744
+                $product = Db::name("store_product")
745
+                    ->alias('sp')
746
+                    ->join('store_cart sc', 'sp.product_id = sc.product_id')
747
+                    ->where(["sc.cart_id"=>$cart_id])
748
+                    ->value('sp.store_name');
749
+            }
750
+            $res = $this -> pay_huifu($type,$code,$groupOrder,$product ?? "储蓄保",env('APP_URL')."/api/hf_notify/pay",'delay');
751
+            Db::name('log')->insert(['data'=>'汇付订单支付--- 返回参数'.json_encode($res)]);
752
+            if (isset($res['id'])) {
753
+                Db::name('store_group_order')->where('group_order_id', $oid)->update(['hf_pay_id' => $res['id'],'pay_wx'=>systemConfig('pay_wx')]);
754
+                if($pay_open_id)
755
+                    Db::name('store_order')->where('group_order_id', $oid)->update(['pay_open_id' => $pay_open_id]);
756
+                return app('json')->success($res);
757
+            }
758
+            return app('json')->fail($res);
759
+//////////////////////////////////////////////首信易/////////////////////////////////////////////////////////
760
+
761
+            if($type == 'wx'){
762
+                if(!$code || $code == '' || $code =='undefined')
763
+                    return app('json')->fail("授权失败,code为空");
764
+                $url = "https://api.weixin.qq.com/sns/jscode2session?appid=".env('WECHAT_MP.APPID')."&secret=".env('WECHAT_MP.SECRET')."&js_code=".$code."&grant_type=authorization_code";
765
+                $get = curlGet($url);
766
+                if(!isset($get['openid']) || empty($get['openid'])){
767
+                    return app('json')->fail('授权失败');
768
+                }
769
+                $openid = $get['openid'];
770
+//            $openid = 'ow5su5GbH-RhPFfJv0JUPrMfvPfE';
771
+                $datas['openId'] = $openid;
772
+                $datas['paymentModeCode'] = "MINIAPPS-WEIXIN_PAY-P2P";
773
+            }else{
774
+                $datas['paymentModeCode'] = "ALIPAY-OFFICIAL";
775
+            }
776
+
777
+
778
+            $datas['requestId'] = $groupOrder['group_order_sn']."_".rand(1000,9999);//订单号
779
+            $datas['orderAmount'] = strval($groupOrder['pay_price'] * 100);//金额。单位分
780
+            $datas['callbackUrl'] = 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzg4NzQ4NDgzNQ==&scene=124&uin=&key=&devicetype=Windows+10+x64&version=6302019c&lang=zh_CN&a8scene=7&fontgear=2';//同步地址微信公众号
781
+
782
+            $cart = Db::name("store_order")->where(['group_order_id'=>$oid]) -> value("cart_id");//日志记录
783
+            Db::name("log")->insert(array('data'=>json_encode($cart)));//日志记录
784
+            $cart = explode(",",$cart);
785
+            $cart_id = $cart[0];
786
+            $product = Db::name("store_product")
787
+                ->alias('sp')
788
+                ->join('store_cart sc', 'sp.product_id = sc.product_id')
789
+                ->where(["sc.cart_id"=>$cart_id])
790
+                ->value('sp.store_name');
791
+
792
+            Db::name("log")->insert(array('data'=>Db::name("store_product")->getLastSql()));//日志记录
793
+
794
+            $productDetails = array(
795
+                'name' => $product ?? "储蓄保",//商品名称。需传递真实产品名称。
796
+                'quantity' => 1,//商品数量
797
+                'amount' => strval($groupOrder['pay_price'] * 100),//商品单价
798
+            );
799
+            $datas['productDetails'] = [$productDetails];//商品信息
800
+
801
+            $datas['clientIp'] = $this -> getRealIP();//客户端外网IP
802
+            $datas['notifyUrl']='/api/notify/pay_5upay';
803
+            $res = ShouxinyiApiRequest::onlinePay($datas);
804
+            $return = array(
805
+                'redirectUrl' => $res['redirectUrl'] ?? '',//重定向地址
806
+                'status' => $res['status'],
807
+                'scanCode' => $res['scanCode'] ?? '',//Base64二维码
808
+                'appParams' => $res['appParams'] ?? '',//App调用码
809
+                'jsString' => $res['jsString'] ?? '',//微信小程序及公众号支付调用串
810
+                'wechatId' => $res['wechatId'] ?? '',//微信原始ID串
811
+                'tradeNo' => $res['tradeNo'] ?? '',//支付宝生活号调用id
812
+                'token' => $res['token'] ?? '',    //微包支付调用token
813
+            );
814
+            Db::name("log")->insert(array('data'=>'支付回调---'.json_encode($return)));//日志记录
815
+
816
+            return app('json')->success($return);
817
+
818
+        }catch (Exception $exception){
819
+            log::info("支付异常======");
820
+            log::info($exception);
821
+            Db::name("log")->insert(array('data'=>$exception->getFile().':'.$exception->getLine().'【'.$exception->getMessage().'】'));//日志记录
822
+            return app('json')->fail("异常");
823
+        }
824
+
825
+    }
826
+
827
+
828
+    //小程序支付
829
+
830
+    public function pay_wechat_mp_copy(StoreGroupOrderRepository $groupOrderRepository){
831
+        try {
726 832
 
727
-            Db::name('log')->insert(['data'=>'汇付订单支付pay_wechat_mp---发起支付']);
833
+            Db::name('log')->insert(['data'=>'汇付订单支付pay_wechat_mp6666666---发起支付']);
728 834
             $oid = Request::param('oid','');
729 835
             $code = Request::param('code','');
730 836
             $type = Request::param('type','');
@@ -1069,7 +1175,7 @@ class Access
1069 1175
             if($payType == 'wx'){
1070 1176
                 Db::name('log')->insert(['data'=>'code---'.$code]);
1071 1177
                 if(!$code || $code == '' || $code =='undefined')
1072
-                return app('json')->fail("授权失败,code为空");
1178
+                    return app('json')->fail("授权失败,code为空");
1073 1179
                 $url = "https://api.weixin.qq.com/sns/jscode2session?appid=".env('WECHAT_MP.APPID')."&secret=".env('WECHAT_MP.SECRET')."&js_code=".$code."&grant_type=authorization_code";
1074 1180
                 $get = curlGet($url);
1075 1181
                 Db::name('log')->insert(['data'=>'open_id---'.json_encode($get)]);
@@ -1155,7 +1261,7 @@ class Access
1155 1261
             if($payType == 'wx'){
1156 1262
                 Db::name('log')->insert(['data'=>'code---'.$code]);
1157 1263
                 if(!$code || $code == '' || $code =='undefined')
1158
-                return app('json')->fail("授权失败,code为空");
1264
+                    return app('json')->fail("授权失败,code为空");
1159 1265
                 $url = "https://api.weixin.qq.com/sns/jscode2session?appid=".env('WECHAT_MP.APPID')."&secret=".env('WECHAT_MP.SECRET')."&js_code=".$code."&grant_type=authorization_code";
1160 1266
                 $get = curlGet($url);
1161 1267
                 Db::name('log')->insert(['data'=>'open_id---'.json_encode($get)]);
@@ -1874,34 +1980,34 @@ class Access
1874 1980
         Db::name('user_bill')->insert($billData);
1875 1981
         Db::name('user')->where('uid',$uid)->inc('brokerage_price',$price)->update();
1876 1982
         if($is_implement){
1877
-           if($channelrecommend['recommend_uid']!=0){
1878
-               $price=bcmul($order_data['pay_price'],'0.05',3);
1879
-               $price=round($price,2);
1880
-               $mark = '邀请渠道商获得' . $price . '佣金';
1881
-               $title='佣金';
1882
-               $tuijian=Db::name('channel_user')->where('uid',Db::name('channel_user')->where('uid',$channelrecommend['recommend_uid'])->value('recommend_uid'))->find();
1883
-               if($tuijian){
1884
-                   $billData=[
1885
-                       'uid'=>$tuijian['uid'],
1886
-                       'link_id'=>$order_data['id'],
1887
-                       'pm'=>1,
1888
-                       'title'=>$title,
1889
-                       'category'=>'now_money',
1890
-                       'type'=>'commission',
1891
-                       'number'=>$price,
1892
-                       'balance'=>0,
1893
-                       'mark'=>$mark,
1894
-                       'create_time'=>date("Y-m-d H:i:s",time()),
1895
-                       'status'=>1,
1896
-                       'order_sn'=>$order_sn,
1897
-                       'type_shop'=>0,
1898
-                       'commission_type'=>9,
1899
-                       'order_type'=>1
1900
-                   ];
1901
-                   Db::name('user_bill')->insert($billData);
1902
-                   Db::name('user')->where('uid',$tuijian['uid'])->inc('brokerage_price',$price)->update();
1903
-               }
1904
-           }
1983
+            if($channelrecommend['recommend_uid']!=0){
1984
+                $price=bcmul($order_data['pay_price'],'0.05',3);
1985
+                $price=round($price,2);
1986
+                $mark = '邀请渠道商获得' . $price . '佣金';
1987
+                $title='佣金';
1988
+                $tuijian=Db::name('channel_user')->where('uid',Db::name('channel_user')->where('uid',$channelrecommend['recommend_uid'])->value('recommend_uid'))->find();
1989
+                if($tuijian){
1990
+                    $billData=[
1991
+                        'uid'=>$tuijian['uid'],
1992
+                        'link_id'=>$order_data['id'],
1993
+                        'pm'=>1,
1994
+                        'title'=>$title,
1995
+                        'category'=>'now_money',
1996
+                        'type'=>'commission',
1997
+                        'number'=>$price,
1998
+                        'balance'=>0,
1999
+                        'mark'=>$mark,
2000
+                        'create_time'=>date("Y-m-d H:i:s",time()),
2001
+                        'status'=>1,
2002
+                        'order_sn'=>$order_sn,
2003
+                        'type_shop'=>0,
2004
+                        'commission_type'=>9,
2005
+                        'order_type'=>1
2006
+                    ];
2007
+                    Db::name('user_bill')->insert($billData);
2008
+                    Db::name('user')->where('uid',$tuijian['uid'])->inc('brokerage_price',$price)->update();
2009
+                }
2010
+            }
1905 2011
         }
1906 2012
 
1907 2013
 

+ 6 - 4
app/controller/api/store/product/Jt.php

@@ -276,8 +276,9 @@ class Jt extends BaseController
276 276
                 -> where('config_key','sanfangfenpei')->find();;
277 277
 
278 278
             $sanfangfenpei=json_decode($systemvalueObj['value'],true);
279
-            $pv=$commissionMoney*$sanfangfenpei['pv'];  //PV
280
-            $yanglaojin=$commissionMoney*$sanfangfenpei['yanglaojin']; //新的养老金
279
+            $commissionMoney80=$commissionMoney*0.8;
280
+            $pv=$commissionMoney80*$sanfangfenpei['pv'];  //PV
281
+            $yanglaojin=$commissionMoney80*$sanfangfenpei['yanglaojin']; //新的养老金
281 282
 
282 283
             
283 284
             //养老金
@@ -543,8 +544,9 @@ class Jt extends BaseController
543 544
                 -> where('config_key','sanfangfenpei')->find();;
544 545
 
545 546
             $sanfangfenpei=json_decode($systemvalueObj['value'],true);
546
-            $pv=$commissionMoney*$sanfangfenpei['pv'];  //PV
547
-            $yanglaojin=$commissionMoney*$sanfangfenpei['yanglaojin']; //新的养老金
547
+            $commissionMoney80=$commissionMoney*0.8;
548
+            $pv=$commissionMoney80*$sanfangfenpei['pv'];  //PV
549
+            $yanglaojin=$commissionMoney80*$sanfangfenpei['yanglaojin']; //新的养老金
548 550
 
549 551
 
550 552
 //            $pv=$commission * 0.5;  //PV

+ 42 - 40
app/controller/api/store/product/Vip.php

@@ -185,7 +185,7 @@ class Vip extends BaseController
185 185
                     //     continue;
186 186
                     // }
187 187
 
188
-                    
188
+
189 189
                     //记录分类id到本地数据库
190 190
                     $cid=$goods['cat1stId'];
191 191
                     $c_name=$goods['cat1stName'];
@@ -297,13 +297,11 @@ class Vip extends BaseController
297 297
 
298 298
         $keyword = $this->request->param('keyword');
299 299
         $_cid = $this->request->param('cid');
300
-        log::info("2222222222222222222222222");
301 300
 
302
-        
301
+
302
+
303 303
         $goods_obj = Db::name('third_party_goods')
304 304
             ->where('type', 5);
305
-//        Log::info("vip=================");
306
-//        Log::info($goods_obj);
307 305
         if($keyword){
308 306
             $goods_obj=$goods_obj->where('json', 'like', '%' . $keyword . '%');
309 307
         }
@@ -313,7 +311,8 @@ class Vip extends BaseController
313 311
         $data=$goods_obj->page($page, $limit)
314 312
             ->select()->toArray();
315 313
 
316
-
314
+        Log::info("vip=================");
315
+        log::info($data);
317 316
 
318 317
         // 获取列表数据
319 318
         // $data = Db::name('third_party_goods')->where('type', 5)->page($page, $limit)->select()->toArray();
@@ -327,14 +326,14 @@ class Vip extends BaseController
327 326
                 $json['price']=set_price_rtrim($json['price']);
328 327
 
329 328
                 $json['pension'] = $json['pension']??'0';
330
-                
329
+
331 330
                 $json['pv'] = isset($json['pv'])?$json['pv']:0;
332 331
                 $json['gongxian'] = isset($json['gongxian'])?$json['gongxian']:0;
333 332
                 $json['jifen'] = isset($json['jifen'])?$json['jifen']:0;
334 333
                 $json['yanglaojin'] =isset($json['yanglaojin'])?$json['yanglaojin']:0;
335 334
 
336 335
 
337
-                
336
+
338 337
                 $json['shopName'] = isset($json['shopName'])?$json['shopName']:"";
339 338
                 $json['monthSales'] = isset($json['monthSales'])?$json['monthSales']:0;
340 339
                 $json['cid'] = isset($value['cid'])?$value['cid']:0;
@@ -414,7 +413,7 @@ class Vip extends BaseController
414 413
         //     ->page($page, $limit)
415 414
         //     ->select()->toArray();
416 415
 
417
-        
416
+
418 417
         $goods_obj = Db::name('third_party_goods')
419 418
             ->where('type', 5);
420 419
         if($keyword){
@@ -518,33 +517,34 @@ class Vip extends BaseController
518 517
         try{
519 518
             $uid = $this->request->uid();
520 519
         } catch (\Exception $e) {
521
-            log::info($e);
520
+            // log::info($e);
522 521
             $uid=0;
523 522
         }
524 523
         $param = $this->request->param(['goodsId']);
525
-        $chanTag = $repository->getDetail(['uid' =>$uid, 'type' => 2], 'pid');
526
-        log::info("uid ={$uid}");
527
-        if(!$chanTag){
524
+        $opid = $repository->getDetail(['uid' =>$uid, 'type' => 2], 'pid');//获取pid
525
+        $chanTag="5ca89a43e569c3415c68680bd5bd393c";
526
+//        log::info("uid ={$uid}");
527
+        if(!$opid){
528 528
             log::info("不存在");
529 529
             $this->create_pid($uid);
530
-           $chanTag = $repository->getDetail(['uid' =>$uid, 'type' => 2], 'pid');
530
+            $opid = $repository->getDetail(['uid' =>$uid, 'type' => 2], 'pid');
531 531
         }
532
-        log::info("获取第三方pid");
533
-        log::info($chanTag);
534
-
535 532
         $apiName = 'com.vip.adp.api.open.service.UnionGoodsService';
536 533
         $params = [
537 534
             'goodsIdList' => [$param['goodsId']],
538
-            'chanTag' => $chanTag['pid'] ?? '1207081e8a6f721709a18a9401e32b1e',
535
+            'chanTag' =>  '5ca89a43e569c3415c68680bd5bd393c',
539 536
             'requestId' => time() . rand(1000, 9999),
540 537
         ];
538
+
541 539
         $requestIn = [
542
-            'openId'   => 'default_open_id',
540
+            'openId'   => $opid['pid'],
543 541
             'realCall' => 'true',
544 542
         ];
545 543
 
544
+        log::info($requestIn);
546 545
         $params['request'] = $requestIn;
547 546
         $result = $this->getUrlResult($apiName, "getByGoodsIds", $params);
547
+//        log::info($result);
548 548
         if(empty($result))
549 549
             return app('json')->fail('商品下架不存在', null, 401);
550 550
         // $result['yanglao'] = app()->make(ProductRepository::class)
@@ -561,7 +561,7 @@ class Vip extends BaseController
561 561
 
562 562
         $gongxian=$pv; //新的养老金
563 563
         $jifen=$pv; //新的养老金
564
-        
564
+
565 565
 
566 566
         $result['pv']=round($pv,2);
567 567
         $result['yanglaojin']=round($yanglaojin,2);
@@ -569,7 +569,7 @@ class Vip extends BaseController
569 569
         $result['jifen']=round($jifen,2);
570 570
 
571 571
 
572
-        $result['wphlink'] = $this->vip_link($param['goodsId'], $chanTag['pid']);//获取唯品会联盟链接
572
+        $result['wphlink'] = $this->vip_link($param['goodsId'], $opid['pid']);//获取唯品会联盟链接
573 573
         return app('json')->success($result);
574 574
     }
575 575
 
@@ -584,13 +584,14 @@ class Vip extends BaseController
584 584
         $apiName = 'com.vip.adp.api.open.service.UnionUrlService';
585 585
         $params = [
586 586
             'goodsIdList' => ["$goodsId"],
587
-            'chanTag' => $chanTag?:'default_pid',
587
+            'chanTag' => '5ca89a43e569c3415c68680bd5bd393c',
588 588
             'requestId' => time() . rand(1000, 9999),
589 589
         ];
590 590
         $requestIn = [
591
-            'openId'   => 'default_open_id',
591
+            'openId'   => $chanTag,
592 592
             'realCall' => 'true',
593 593
             'adCode'   => 'oldversion',
594
+            'genAuthorityUrl' => 'true',
594 595
         ];
595 596
 
596 597
         $params['urlGenByGoodsIdRequest'] = $requestIn;
@@ -680,7 +681,7 @@ class Vip extends BaseController
680 681
     }
681 682
 
682 683
     /*
683
-     * 给用户创建广告位*/
684
+     * 给用户创建广告位 创建用户openid */
684 685
     public function create_pid(string $uid)
685 686
     {
686 687
 
@@ -688,21 +689,22 @@ class Vip extends BaseController
688 689
         if ($this->userThird->getDetail(['uid' => $uid, 'type' => 2])) {
689 690
             return true;
690 691
         }
691
-        $apiName = 'com.vip.adp.api.open.service.UnionPidService';
692
-        $params = [
693
-            'pidGenRequest' => [
694
-                'pidNameList' => ["vip" . $uid],
695
-                'requestId' => time() . rand(1000, 9999)
696
-            ]
697
-        ];
698
-        $result = $this->getUrlResult($apiName, "genPid", $params);
699
-        log::info();
700
-        if ($result) {
692
+//        $apiName = 'com.vip.adp.api.open.service.UnionPidService';
693
+//        $params = [
694
+//            'pidGenRequest' => [
695
+//                'pidNameList' => ["vip" . $uid],
696
+//                'requestId' => time() . rand(1000, 9999)
697
+//            ]
698
+//        ];
699
+//        $result = $this->getUrlResult($apiName, "genPid", $params);
700
+//	log::info("================vip====");
701
+//	log::info($result);
702
+        else {
701 703
             $data =
702 704
                 [
703
-                    'pid' => $result['result']['pidInfoList'][0]['pid'],
704
-                    'pid_name' => $result['result']['pidInfoList'][0]['pidName'],
705
-                    'create_time' => $result['result']['pidInfoList'][0]['createTime'],
705
+                    'pid' => 'xinfubaoopen'.$uid,
706
+                    'pid_name' => 'xinfubaoopen'.$uid,
707
+                    'create_time' => time()*1000,
706 708
                     'type' => 2,
707 709
                     'uid' => $uid,
708 710
                 ];
@@ -748,7 +750,7 @@ class Vip extends BaseController
748 750
                 'orderTimeEnd' => time() * 1000,
749 751
             ];
750 752
             */
751
-            $startTime = strtotime('-50minute') * 1000;
753
+            $startTime = strtotime('-30minute') * 1000;
752 754
             $endTime = time() * 1000;
753 755
             $type = ['order', 'update'];
754 756
             $orderList = [];
@@ -814,7 +816,7 @@ class Vip extends BaseController
814 816
             }
815 817
             $page++;
816 818
         } while ($countList == $pageSize);
817
-                if (!empty($orderLists)) {
819
+        if (!empty($orderLists)) {
818 820
             //格式化从唯品会拉取的订单列表
819 821
             $formatLists = $this->formatOrderList($orderLists);
820 822
             //将唯品会订单进行处理
@@ -834,7 +836,7 @@ class Vip extends BaseController
834 836
             //订单关联推广位ID
835 837
             $pid = $order['pid'] ?: '';
836 838
             if (empty($pid)) continue;
837
-            $chanTag = $user->getDetail(['pid' => $order['pid'], 'type' => 2], 'uid,pid');
839
+            $chanTag = $user->getDetail(['pid' => $order['openId'], 'type' => 2], 'uid,pid');
838 840
             $goodsInfo = reset($order['detailList']);
839 841
             $createTime = $order['orderTime'] / 1000;
840 842
             //订单状态:0-不合格,1-待定,2-已完结

+ 1 - 0
app/controller/merchant/gong/Goods.php

@@ -275,6 +275,7 @@ class Goods extends BaseController
275 275
                 'spu_id'=>$data['spu_id'],
276 276
                 'temp_id' => 105,
277 277
                 'plate_mer_profit' => $data['mer_profit'],
278
+                'concession_pri' => $data['mer_profit'],
278 279
                 'yanglaojin_scale' => $yanglaojin_scale
279 280
             ];
280 281
             $insert_id=Db::name('store_product')->insertGetId($product_insert_data);

+ 6 - 3
app/traits/GongApiRequest.php

@@ -11,9 +11,12 @@ trait GongApiRequest
11 11
 {
12 12
     //接口文档:https://kdocs.cn/l/cov4HdLPYVgV
13 13
     private static $path = 'https://www.douhuomall.com';
14
-    private static $app_id = 'YS112May13bb673b251a';
15
-    private static $app_secret = '38971362a8965c9135cb147d53e52706';
16
-    private static $mobile = '13911251783';
14
+//    private static $app_id = 'YS112May13bb673b251a';
15
+//    private static $app_secret = '38971362a8965c9135cb147d53e52706';
16
+//    private static $mobile = '13911251783';
17
+    private static $app_id = 'YS3a8ab661406e47bb86';
18
+    private static $app_secret = '41d8b8e1dd9a454a1abc4534297e33c3';
19
+    private static $mobile = '17855366921';
17 20
 
18 21
     public static function get_access_token(){
19 22
         $url = '/api/noAuth/access_token';