Kaynağa Gözat

Merge branch 'master' of https://git.bjtdba.com/shop/php

chengzhiyixia 1 yıl önce
ebeveyn
işleme
e9363966a0

+ 67 - 3
app/common/repositories/store/order/StoreOrderRepository.php

@@ -91,6 +91,10 @@ class StoreOrderRepository extends BaseRepository
91 91
     private $source;
92 92
     private $merId;
93 93
 
94
+    const commercetrade_cash_integral = 'commercetrade_cash_integral'; // 商贸区:现金+积分
95
+    const commercetrade_cash_peking_bean = 'commercetrade_cash_peking_bean'; // 商贸区:现金+京豆
96
+    const commercetrade_cash = 'commercetrade_cash'; // 商贸区:现金
97
+
94 98
     /**
95 99
      * StoreOrderRepository constructor.
96 100
      * @param StoreOrderDao $dao
@@ -1963,7 +1967,7 @@ class StoreOrderRepository extends BaseRepository
1963 1967
      * @author xaboy
1964 1968
      * @day 2020/6/9
1965 1969
      */
1966
-    public function cartIdByOrderInfo($uid, array $cartId, int $addressId = null, $confirm = true, $psType = true, $payType = 0, $youhui_price_key = '')
1970
+    public function cartIdByOrderInfo($uid, array $cartId, int $addressId = null, $confirm = true, $psType = true, $payType = 0, $youhui_price_key = '',$is_commercetrade=0)
1967 1971
     {
1968 1972
         $address = null;
1969 1973
         if ($psType) {//是否需要地址
@@ -2356,6 +2360,64 @@ class StoreOrderRepository extends BaseRepository
2356 2360
                     ['type' => 'c1', 'price' => $orderpri, 'other' => 0, 'note' => "复购金"],
2357 2361
                 ];
2358 2362
 
2363
+            }// 商贸区
2364
+            elseif ($is_commercetrade){
2365
+
2366
+                $jf = $orderpri - round($store_product_datas['concession_pri'] * 0.3, 2) . ' + ' . round($store_product_datas['concession_pri'] * 0.3, 2);
2367
+                $jd = $orderpri - round($store_product_datas['concession_pri'] * 0.35, 2) . ' + ' . round($store_product_datas['concession_pri'] * 0.35, 2);
2368
+                if ($store_product_datas['concession_pri'] != null || $store_product_datas['concession_pri'] != 0) {
2369
+                    $yanglao = round($store_product_datas['concession_pri'] * 0.3, 2);
2370
+                    $pv = round($store_product_datas['concession_pri'] * 0.35, 2);
2371
+                    $srtArry['jfduihuan'] = $jf;
2372
+                    $srtArry['jdduihuan'] = $jd;
2373
+                    $jifen = round($store_product_datas['concession_pri'] * 0.35, 2);
2374
+                    $gongxian = round($store_product_datas['concession_pri'] * 0.35, 2);
2375
+
2376
+                    $jcvr = round($orderpri - round($store_product_datas['concession_pri'] * 0.3, 2), 2);
2377
+                    $jcjf = round($store_product_datas['concession_pri'] * 0.3, 2);
2378
+                    $jcprice = round($orderpri - round($store_product_datas['concession_pri'] * 0.3, 2), 2);
2379
+                    $jcjf1 = round($store_product_datas['concession_pri'] * 0.3, 2);
2380
+                    $jcvr1 = round($orderpri - round($store_product_datas['concession_pri'] * 0.35, 2), 2);
2381
+                    $jcjd = round($store_product_datas['concession_pri'] * 0.35, 2);
2382
+                    $jcprice1 = round($orderpri - round($store_product_datas['concession_pri'] * 0.35, 2), 2);
2383
+                    $jcjd1 = round($store_product_datas['concession_pri'] * 0.35, 2);
2384
+
2385
+                    //var_dump($cartInfo['list'][$_k]);
2386
+                    //支付组合
2387
+                    // $fzone_paytype= [
2388
+
2389
+                    //     2=>[
2390
+                    //         1=>[$jcvr,$jcjf],//VR+积分
2391
+                    //         2=>[$jcprice,$jcjf1],//现金+积分
2392
+                    //         3=>[$jcvr1,$jcjd],//VR+京豆
2393
+                    //         4=>[$jcprice1,$jcjd1],//现金+金豆
2394
+                    //         5=>$orderpri,//VR
2395
+                    //         6=>$orderpri,//现金
2396
+                    //     ]
2397
+                    // ];
2398
+
2399
+                    $cartInfo['list'][$_k]['fzone_paytype'] = [
2400
+
2401
+                        // ['type'=>'a1','price'=>100,'other'=>0,'note'=>"VR"],
2402
+                        // ['type'=>'a2','price'=>100,'other'=>0,"note"=>"现金"],
2403
+                        // ['type'=>'a3','price'=>0,'other'=>0,"note"=>"现金+VR"],
2404
+
2405
+//                        ['type' => 'b1', 'price' => $jcvr, 'other' => $jcjf, 'note' => "VR+积分"],
2406
+                        ['type' => 'b2', 'price' => $jcprice, 'other' => $jcjf1, "note" => "现金+积分"],
2407
+                        // ['type'=>'b3','price'=>$jcvr1,'other'=>$jcjd,"note"=>"VR+京豆"],
2408
+                        ['type'=>'b4','price'=>$jcvr1,'other'=>$jcjd,"note"=>"现金+京豆"],
2409
+//                        ['type' => 'b5', 'price' => $orderpri, 'other' => 0, "note" => "VR"],
2410
+                        ['type' => 'b6', 'price' => $orderpri, 'other' => 0, "note" => "现金"],
2411
+
2412
+                        // ['type'=>'c1','price'=>100,'other'=>0,'note'=>"复购金"],
2413
+                        // ['type'=>'c2','price'=>100,'other'=>0,"note"=>"VR"],
2414
+                        // ['type'=>'c3','price'=>100,'other'=>0,"note"=>"现金"],
2415
+
2416
+
2417
+                    ];
2418
+
2419
+
2420
+                }
2359 2421
             }
2360 2422
 
2361 2423
 
@@ -6544,6 +6606,7 @@ class StoreOrderRepository extends BaseRepository
6544 6606
 
6545 6607
     public function douhuomall_delivery()
6546 6608
     {
6609
+        set_time_limit(0);
6547 6610
         try {
6548 6611
             $order = Db::name('store_order')->where('status', 0)->where('pay_type', '>', 0)->where('douhuomall', 1)->where('douhuomall_status', 9)->select();
6549 6612
             if ($order) {
@@ -6572,7 +6635,7 @@ class StoreOrderRepository extends BaseRepository
6572 6635
 //                        $address_id = $address_id[0];
6573 6636
                     }
6574 6637
 //                    $address_id = $value['address_id'];
6575
-                    $cart_id = $value['cart_id'];
6638
+                    $cart_id = [$value['cart_id']];
6576 6639
                     $cartIds = Db::name('store_cart')->where('cart_id', 'in', $cart_id)->select()->toArray();
6577 6640
 //                    $address = $value['user_address'];
6578 6641
                     log::info("传参数据22========");
@@ -6591,7 +6654,7 @@ class StoreOrderRepository extends BaseRepository
6591 6654
                         log::info("传参数据11111========");
6592 6655
                         log::info($address);
6593 6656
                         $res = GongApiRequest::submit($address_id, $sku_id, $address, $third_order, $other, $receiver, $receiver_phone);
6594
-
6657
+                        echo "传参数据11111========";
6595 6658
                         $u['douhuomall_status'] = 0;
6596 6659
                         $u['douhuomall_msg'] = $res['error_msg'] ?? '';
6597 6660
                         if ($res['error_code'] == 0) {
@@ -6611,6 +6674,7 @@ class StoreOrderRepository extends BaseRepository
6611 6674
             $this->douhuomall_order();
6612 6675
         } catch (Exception $e) {
6613 6676
             Db::name('log')->insert(['data' => '供应链发货:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】']);
6677
+            echo '供应链发货:' . $e->getFile() . ':' . $e->getLine() . '【' . $e->getMessage() . '】';
6614 6678
         }
6615 6679
     }
6616 6680
 

+ 3 - 0
app/common/repositories/store/product/ProductAttrValueRepository.php

@@ -122,6 +122,7 @@ class ProductAttrValueRepository extends BaseRepository
122 122
         //查询商品是否有货
123 123
         $stock = GongApiRequest::stock($sku_id,$address_id,$num);
124 124
         if($stock != '有货'){
125
+            Db::name('store_product')->where('product_id',$product_id)->update(['is_show' => 0, 'argument' => '此商品无货']);
125 126
             if($delivery){
126 127
                 return false;
127 128
             }else{
@@ -132,6 +133,7 @@ class ProductAttrValueRepository extends BaseRepository
132 133
         //查询商品上下架
133 134
         $goods_status = GongApiRequest::goods_status($spu_id);
134 135
         if(!isset($goods_status[0]['status']) || $goods_status[0]['status'] != 1){
136
+            Db::name('store_product')->where('product_id',$product_id)->update(['is_show' => 0, 'argument' => '此商品已下架'.json_encode($goods_status)]);
135 137
             if($delivery){
136 138
                 return false;
137 139
             }else{
@@ -142,6 +144,7 @@ class ProductAttrValueRepository extends BaseRepository
142 144
         //查询库存
143 145
         $sku_stock = GongApiRequest::sku_stock(json_encode($sku),$address_id);
144 146
         if(!isset($sku_stock[0]['stock']) || $sku_stock[0]['stock'] != '有货'){
147
+            Db::name('store_product')->where('product_id',$product_id)->update(['is_show' => 0, 'argument' => '此商品规格无货']);
145 148
             if($delivery){
146 149
                 return false;
147 150
             }else {

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

@@ -11,6 +11,7 @@ use app\common\model\store\order\StoreOrder;
11 11
 use app\common\model\store\product\Product;
12 12
 use app\common\model\store\product\ProductContent;
13 13
 use app\common\model\user\User;
14
+use app\common\repositories\merchant\MerchantRepository;
14 15
 use app\common\repositories\store\coupon\StoreCouponRepository;
15 16
 use app\common\repositories\store\order\StoreOrderRepository;
16 17
 use app\common\repositories\store\order\StoreRefundOrderRepository;
@@ -1755,6 +1756,44 @@ class ProductRepository extends BaseRepository
1755 1756
                         3=>$product['price']//复购金
1756 1757
                     ]
1757 1758
                 ];
1759
+            } else {
1760
+                // 商贸区
1761
+                /** @var MerchantRepository $merchant */
1762
+                $merchant = app()->make(MerchantRepository::class);
1763
+                $merchantInfo = $merchant->get($product['mer_id']);
1764
+                // 1企业2个体3个人
1765
+                if ($merchantInfo && in_array($merchantInfo['type'],[2,3])) {
1766
+                    //商贸区
1767
+                    $jf = $product['price'] - round($product['concession_pri']*0.3, 2) . ' + ' . round($product['concession_pri']*0.3, 2);
1768
+                    $jd = $product['price'] - round($product['concession_pri']*0.35, 2) . ' + ' . round($product['concession_pri']*0.35, 2);
1769
+                    if($product['concession_pri'] !=null || $product['concession_pri'] !=0){
1770
+                        $yanglao = round($product['concession_pri'] * 0.3, 2);
1771
+                        $pv = round($product['concession_pri'] * 0.35, 2);
1772
+                        $srtArry['jfduihuan'] =$jf;
1773
+                        $srtArry['jdduihuan'] = $jd;
1774
+                        $jifen = round($product['concession_pri'] * 0.35, 2);
1775
+                        $gongxian = round($product['concession_pri'] * 0.35, 2);
1776
+
1777
+                        $jcvr = $product['price'] - round($product['concession_pri']*0.3, 2);
1778
+                        $jcjf = round($product['concession_pri']*0.3, 2);
1779
+                        $jcprice = $product['price'] - round($product['concession_pri']*0.3, 2);
1780
+                        $jcjf1 = round($product['concession_pri']*0.3, 2);
1781
+                        $jcvr1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1782
+                        $jcjd = round($product['concession_pri']*0.35, 2);
1783
+                        $jcprice1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1784
+                        $jcjd1 = round($product['concession_pri']*0.35, 2);
1785
+
1786
+                        $fzone_paytype= [
1787
+//                ['type'=>'b1','price'=>$jcvr,'other'=>$jcjf],
1788
+                            ['type'=>'b2','price'=>$jcprice,'other'=>$jcjf1],
1789
+//                ['type'=>'b3','price'=>$jcvr1,'other'=>$jcjd],
1790
+                            ['type'=>'b4','price'=>$jcprice1,'other'=>$jcjd1],
1791
+//                ['type'=>'b5','price'=>$product['price'],'other'=>0],
1792
+                            ['type'=>'b6','price'=>$product['price'],'other'=>0],
1793
+                        ];
1794
+
1795
+                    }
1796
+                }
1758 1797
             }
1759 1798
 
1760 1799
 

+ 3 - 0
app/common/repositories/store/product/ThirdPartyCategoryRepository.php

@@ -122,6 +122,7 @@ class ThirdPartyCategoryRepository extends BaseRepository
122 122
         //查询商品是否有货
123 123
         $stock = GongApiRequest::stock($sku_id,$address_id,$num);
124 124
         if($stock != '有货'){
125
+            Db::name('store_product')->where('product_id',$product_id)->update(['is_show' => 0, 'argument' => '此商品无货']);
125 126
             if($delivery){
126 127
                 return false;
127 128
             }else{
@@ -132,6 +133,7 @@ class ThirdPartyCategoryRepository extends BaseRepository
132 133
         //查询商品上下架
133 134
         $goods_status = GongApiRequest::goods_status($spu_id);
134 135
         if(!isset($goods_status[0]['status']) || $goods_status[0]['status'] != 1){
136
+            Db::name('store_product')->where('product_id',$product_id)->update(['is_show' => 0, 'argument' => '此商品已下架']);
135 137
             if($delivery){
136 138
                 return false;
137 139
             }else{
@@ -142,6 +144,7 @@ class ThirdPartyCategoryRepository extends BaseRepository
142 144
         //查询库存
143 145
         $sku_stock = GongApiRequest::sku_stock(json_encode($sku),$address_id);
144 146
         if(!isset($sku_stock[0]['stock']) || $sku_stock[0]['stock'] != '有货'){
147
+            Db::name('store_product')->where('product_id',$product_id)->update(['is_show' => 0, 'argument' => '此商品规格无货']);
145 148
             if($delivery){
146 149
                 return false;
147 150
             }else {

+ 2 - 2
app/common/repositories/system/merchant/MerchantRepository.php

@@ -413,7 +413,7 @@ class MerchantRepository extends BaseRepository
413 413
      * @param $userInfo
414 414
      * @return mixed
415 415
      */
416
-    public function productList($merId, $where, $page, $limit, $userInfo,$type439=false)
416
+    public function productList($merId, $where, $page, $limit, $userInfo,$type439=false,$is_commercetrade = 0)
417 417
     {
418 418
         log::info("========j进入prodctList");
419 419
         log::info($merId);
@@ -467,7 +467,7 @@ class MerchantRepository extends BaseRepository
467 467
                     ]
468 468
                 ];
469 469
 
470
-            }else if($merId == 439){
470
+            }else if($merId == 439 || $is_commercetrade){
471 471
                 //精彩生活和商贸区
472 472
                 $jf = $v['price'] - round($v['concession_pri']*0.3, 2) . ' + ' . round($v['concession_pri']*0.3, 2);
473 473
                 $jd = $v['price'] - round($v['concession_pri']*0.35, 2) . ' + ' . round($v['concession_pri']*0.35, 2);

+ 4 - 0
app/common/repositories/user/UserOfflineRechargeRepository.php

@@ -153,6 +153,9 @@ class UserOfflineRechargeRepository extends BaseRepository
153 153
                     ]);
154 154
                     $user->annuity += $order->pension;
155 155
                     $user->annuity_num += 1;
156
+                    if (!$user->mer_id || !$user->locktime) {
157
+                        Db::name('user')->where('uid', $unionUser->uid)->update(['mer_id' => $order->mer_id, 'locktime' => date('Y-m-d H:i:s')]);
158
+                    }
156 159
                     $user->save();
157 160
 
158 161
                     //同步用户部分------------------------------------
@@ -184,6 +187,7 @@ class UserOfflineRechargeRepository extends BaseRepository
184 187
                     ];
185 188
                     $user = Db::name('user')->where('uid', $unionUser->uid)->find();
186 189
                     $userRepository->feidacang_fenyong($user, $order_data, 0);
190
+                    $userRepository->feidacang_fenyong_mer($user, $order_data, 0);
187 191
 
188 192
                     OrderMerchant::getDB()->where('pay_user_id', $unionUser->unionid)->update(['uid' => $unionUser->uid, 'binds' => 1]);
189 193
                 }

+ 6 - 0
app/controller/api/cron/CommissionCron.php

@@ -1303,4 +1303,10 @@ where o.paid=1 and o.is_settlement=1 and settlement_time between '$this->startMo
1303 1303
         $this->sendEMail(['389123492@qq.com', '420132441@qq.com'], '结算定时', "执行结束<br/>" . $mallStr . date('Y-m-d H:i:s'), '如果邮件客户端不支持HTML则显示此内容');
1304 1304
     }
1305 1305
 
1306
+
1307
+
1308
+    public function cesexx(){
1309
+        // $storeOrderRepository = app()->make(StoreOrderRepository::class);
1310
+        // $storeOrderRepository->douhuomall_delivery();
1311
+    }
1306 1312
 }

+ 8 - 2
app/controller/api/store/merchant/Merchant.php

@@ -92,12 +92,13 @@ class Merchant extends BaseController
92 92
 
93 93
     public function productTypeList()
94 94
     {
95
-        $params= $this->request->params(['type','mer_cate_id','pageNum','pageSize']);
95
+        $params= $this->request->params(['type','mer_cate_id','pageNum','pageSize','mer_id']);
96 96
         $name=$params['type'];
97 97
 
98 98
         $domain = $this->request->domain();
99 99
         $id=0;
100 100
         $type439=true;
101
+        $is_commercetrade = 0;
101 102
         if($name=='dingsheng'){
102 103
             $id=486;
103 104
         }else if($name=='jingpin'){
@@ -114,6 +115,11 @@ class Merchant extends BaseController
114 115
             }
115 116
         }else if($name=='fugou'){
116 117
             $id=491;
118
+        }// 商贸区
119
+        else if($name=='commercetrade'){
120
+            if (empty($params['mer_id'])) return app('json')->fail('店铺不存在');
121
+            $id=$this->merId = $params['mer_id'];
122
+            $is_commercetrade = 1;
117 123
         }
118 124
         [$page, $limit] = $this->getPage();
119 125
         if($params['pageNum']!=''){
@@ -132,7 +138,7 @@ class Merchant extends BaseController
132 138
             $where['cate_id'] = $params['mer_cate_id'];
133 139
         }
134 140
 
135
-        return app('json')->success($this->repository->productList($id,$where, $page, $limit,$this->userInfo,$type439));
141
+        return app('json')->success($this->repository->productList($id,$where, $page, $limit,$this->userInfo,$type439,$is_commercetrade));
136 142
     }
137 143
 
138 144
     /**

+ 7 - 5
app/controller/api/store/order/StoreOrder.php

@@ -70,12 +70,13 @@ class StoreOrder extends BaseController
70 70
     {
71 71
         $cartId = (array)$this->request->param('cart_id', []);
72 72
         $addressId = (int)$this->request->param('address_id');
73
+        $is_commercetrade = (int)$this->request->param('is_commercetrade',0);
73 74
         $psType = $this->request->param('type',true);//是否需要地址 boolean
74 75
         $uid = $this->request->uid();
75 76
 
76 77
         if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid)))
77 78
             return app('json')->fail('已失效或已下单');
78
-        $orderInfo = $this->repository->cartIdByOrderInfo($uid, $cartId, $addressId,true,$psType);
79
+        $orderInfo = $this->repository->cartIdByOrderInfo($uid, $cartId, $addressId,true,$psType,'','',$is_commercetrade);
79 80
         $orderInfo['product_type']=0;
80 81
         if($this->source=='yhc'){
81 82
             $product_type=Db::name('store_cart')->alias('c')->join('store_product p','c.product_id=p.product_id')->whereIn('cart_id',$cartId)->column('p.type');
@@ -203,10 +204,10 @@ class StoreOrder extends BaseController
203 204
 
204 205
         //log::info("计算养老金 good_id: {$good_id},price{$total_price},yanglao:{$yanglao}");
205 206
         // $price = $decScore = $decJingScore =  0;
206
-        //foreach ($cartIds as $k=>$item){
207
+        foreach ($cartIds as $k=>$item){
207 208
 
208
-        // $checkGong = $gong -> checkGong($item['product_id'],$item['product_attr_unique'],$item['cart_num'],$uid,$addressId);
209
-        // if(isset($checkGong['code']) && $checkGong['code'] == -1) return app('json')->fail($checkGong['message']);
209
+        $checkGong = $gong -> checkGong($item['product_id'],$item['product_attr_unique'],$item['cart_num'],$uid,$addressId);
210
+        if(isset($checkGong['code']) && $checkGong['code'] == -1) return app('json')->fail($checkGong['message']);
210 211
         // $money=Db::name('store_product_attr_value')->where('unique',$item['product_attr_unique'])->value('price');
211 212
         // $price += bcmul($money, $item['cart_num'], 2);
212 213
 
@@ -227,7 +228,7 @@ class StoreOrder extends BaseController
227 228
         //     }
228 229
         //     $decJingScore += $productDecJingdou;
229 230
         // }
230
-        //}
231
+        }
231 232
 
232 233
 
233 234
         // if (!$decScore && !$decJingScore) {
@@ -475,6 +476,7 @@ class StoreOrder extends BaseController
475 476
 
476 477
             }else if(!empty($array_fzone_paytype['type'] == 'b2')){
477 478
                 //精彩生活现金+积分
479
+                //商贸区:现金+积分
478 480
 
479 481
                 $vrpri = $userdatas['score'] -  $array_fzone_paytype['other'];
480 482
 

+ 4 - 1
app/controller/api/store/product/StoreProduct.php

@@ -161,10 +161,13 @@ class StoreProduct extends BaseController
161 161
      */
162 162
     public function recommendList()
163 163
     {
164
+        $mer_id = (int)$this->request->param('mer_id',0);
164 165
         [$page, $limit] = $this->getPage();
165 166
         if($this->source=='yhc' && $this->merId){
166 167
             $merId=$this->merId;
167
-        }else{
168
+        } elseif($mer_id){
169
+            $merId=$mer_id;
170
+        } else{
168 171
             $merId=321;
169 172
         }
170 173
         return app('json')->success($this->repository->recommend($this->userInfo, $merId, $page, $limit, null, 'create_time', 5));

+ 1 - 0
route/api.php

@@ -1259,6 +1259,7 @@ Route::group('api/', function () {
1259 1259
     Route::get('platform_income_detail_get', 'api.cron.CommissionCron/platform_income_detail_get');//插入平台收支明细
1260 1260
     Route::get('clear_platform_income_detail', 'api.cron.CommissionCron/clear_platform_income_detail');//删除平台收支明细
1261 1261
     Route::get('take', 'api.cron.CommissionCron/take');//插入平台收支明细
1262
+    Route::get('cesexx', 'api.cron.CommissionCron/cesexx');
1262 1263
     Route::get('order/group_detail/:id', 'api.store.order.StoreOrder/group_detail');//订单详情
1263 1264
     Route::get('commission_cron_bonus', 'api.cron.CommissionCron/bonus');
1264 1265