shish 5 лет назад
Родитель
Сommit
7a335d0149
2 измененных файлов с 6 добавлено и 13 удалено
  1. 4 11
      app-mall/controllers/OrderController.php
  2. 2 2
      biz-mall/order/services/OrderService.php

+ 4 - 11
app-mall/controllers/OrderController.php

@@ -102,7 +102,7 @@ class OrderController extends BaseController
             $now = time();
             $expireTime = $now + 1800;//订单30分钟后过期
             $post['deadline'] = $expireTime;
-            $post['fromType'] = 1;//商城
+            $post['fromType'] = dict::getDict('fromType', 'mall');
             $post['prePrice'] = $prePrice;
             $post['actPrice'] = $actPrice;
             $order = OrderClass::addOrder($post);
@@ -252,14 +252,8 @@ class OrderController extends BaseController
         $shopId = $this->shopId;
         $post['shopId'] = $shopId;
         $post['merchantId'] = $this->sjId;
-        //默认门店订单
-        $store = isset($post['store']) ? $post['store'] : 1;
-        $post['store'] = $store;
-        //来源 0微信 1支付宝 2小程序 3朋友圈 4美团
-        $sourceType = isset($post['sourceType']) ? $post['sourceType'] : 2;
-        //兼容旧系统sourceType=3表示朋友圈来源
-        $fromType = $sourceType == 3 ? 2 : 0;
-        $fromType = isset($post['fromType']) && !empty($post['fromType']) ? $post['fromType'] : $fromType;
+        $post['store'] = 0;
+        $fromType = dict::getDict('fromType', 'shop');
         $post['customId'] = $this->customId;
         $user = $this->user;
         $post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
@@ -268,7 +262,7 @@ class OrderController extends BaseController
         $post['bookMobile'] = $bookMobile;
         $prePrice = round($post['prePrice'], 2);
         $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
-        $discountData = OrderService::getDiscountPrice(['price' => $prePrice, 'sourceType' => $sourceType, 'couponId' => $couponId, 'userId' => $this->userId]);
+        $discountData = OrderService::getDiscountPrice(['price' => $prePrice, 'sourceType' => 0, 'couponId' => $couponId, 'userId' => $this->userId]);
         $actPrice = $discountData['price'];
         $post['discountType'] = $discountData['discountType'];
         $post['discountAmount'] = $discountData['discountAmount'];
@@ -284,7 +278,6 @@ class OrderController extends BaseController
         }
         //微信支付订单提交不能修改价格
         $post['modPrice'] = $this->isWx ? 0 : 1;
-        $post['sourceType'] = $sourceType;
         $post['goodsNum'] = 1;
         $post['fromType'] = $fromType;
         $post['reachDate'] = isset($post['reachDate']) && !empty($post['reachDate']) ? $post['reachDate'] : '00-00-00';

+ 2 - 2
biz-mall/order/services/OrderService.php

@@ -170,7 +170,7 @@ class OrderService extends BaseService
         $couponId = isset($params['couponId']) ? $params['couponId'] : 0;
         $userId = isset($params['userId']) ? $params['userId'] : 0;
         $price = isset($params['price']) ? $params['price'] : 0;
-        $sourceType = isset($params['sourceType']) ? $params['sourceType'] : 0;
+        $sourceType = $params['sourceType'] ?? 0;
         $discountAmount = 0;
         $discountType = 0;
         $discountPrice = $price;
@@ -192,7 +192,7 @@ class OrderService extends BaseService
             }
         }
         //如果没有优惠券和会员优惠,并且是朋友圈收款,则进行随机优惠 ssh 2019.9.12
-        if ($discountPrice == $price && $sourceType == 3) {
+        if ($discountPrice == $price && $sourceType == 3 && 1 == 2) {
             $discountAmount = OrderClass::getRandDiscount($price);
             //开发和测试环境直接随机优惠
             $env = getenv('YII_ENV');