Explorar o código

Merge branch 'master' of http://git.huaml.com/zhh/huahuibao

shish hai 11 meses
pai
achega
e4896341e2

+ 6 - 3
app-ghs/controllers/IntraCityController.php

@@ -393,7 +393,8 @@ class IntraCityController extends BaseController
                 // store_order_id 门店订单编号, 即 orderId。如果是重新配送的第n次,订单编号的命名规则为:orderId_copy_n
                 $query = (new Query())
                     ->from('xhExpressOrder')
-                    ->where(new \yii\db\Expression('storeOrderId LIKE CONCAT(:prefix, "%")', [':prefix' => $orderId . '_copy_%']));
+                    ->where(new \yii\db\Expression('storeOrderId LIKE CONCAT(:prefix, "%")', [':prefix' => $orderId . '_copy_%']))
+                    ->andWhere(['mainId' => $this->mainId]);
                 // $command = $query->createCommand();
                 // $sql = $command->sql;
                 $copyOrderCount = $query->count();
@@ -484,7 +485,8 @@ class IntraCityController extends BaseController
                 ->where(['and',
                     new \yii\db\Expression('storeOrderId LIKE CONCAT(:prefix, "%")', [':prefix' => $orderId . '_copy_']),
                     ['status' => 1]
-                ])->orderBy('addTime DESC');
+                ])->andWhere(['mainId' => $this->mainId])
+                ->orderBy('addTime DESC');
             $esDatas = $query->all();
             $count = count($esDatas);
             if ($count > 0) {
@@ -545,7 +547,8 @@ class IntraCityController extends BaseController
                 ->where(['and',
                     new \yii\db\Expression('storeOrderId LIKE CONCAT(:prefix, "%")', [':prefix' => $orderId . '_copy_']),
                     ['status' => 1]
-                ])->orderBy('addTime DESC');
+                ])->andWhere(['mainId' => $this->mainId])
+                ->orderBy('addTime DESC');
             // $command = $query->createCommand();
             // $sql = $command->sql;
             $esDatas = $query->all();

+ 2 - 1
app-hd/controllers/ExpressController.php

@@ -87,7 +87,8 @@ class ExpressController extends BaseController
         $query = (new Query())
             ->from('xhExpressOrder')
             ->where(['and',
-                new \yii\db\Expression('storeOrderId LIKE CONCAT(:prefix, "%")', [':prefix' => $orderId])
+                new \yii\db\Expression('storeOrderId LIKE CONCAT(:prefix, "%")', [':prefix' => $orderId]),
+                ['mainId' => $this->mainId]
             ])->orderBy('addTime DESC');
         $esDatas = $query->all();
 

+ 2 - 1
app-hd/controllers/GoodsController.php

@@ -6,6 +6,7 @@ use biz\shop\classes\ShopExtClass;
 use bizGhs\order\classes\OrderItemClass;
 use bizHd\goods\classes\GoodsCategoryClass;
 use bizHd\goods\classes\GoodsClass;
+use bizHd\goods\classes\GoodsSettingClass;
 use bizHd\goods\services\CategoryService;
 use bizHd\goods\services\GoodsCategoryService;
 use bizHd\goods\services\GoodsSettingService;
@@ -371,7 +372,7 @@ class GoodsController extends BaseController
         //     }
         //     FestRiseService::batchAdd($add);
         // }
-        GoodsSettingService::updateByCondition(['mainId' => $this->mainId], $post);
+        GoodsSettingClass::updateByCondition(['mainId' => $this->mainId], $post);
         util::complete('提交成功');
     }
 

+ 6 - 3
app-hd/controllers/IntraCityController.php

@@ -422,7 +422,8 @@ class IntraCityController extends BaseController
                 // store_order_id 门店订单编号, 即 orderId。如果是重新配送的第n次,订单编号的命名规则为:orderId_copy_n
                 $query = (new Query())
                     ->from('xhExpressOrder')
-                    ->where(new \yii\db\Expression('storeOrderId LIKE CONCAT(:prefix, "%")', [':prefix' => $orderId . '_copy_%']));
+                    ->where(new \yii\db\Expression('storeOrderId LIKE CONCAT(:prefix, "%")', [':prefix' => $orderId . '_copy_%']))
+                    ->andWhere(['mainId' => $this->mainId]);
                 // $command = $query->createCommand();
                 // $sql = $command->sql;
                 $copyOrderCount = $query->count();
@@ -530,7 +531,8 @@ class IntraCityController extends BaseController
                 ->where(['and',
                     new \yii\db\Expression('storeOrderId LIKE CONCAT(:prefix, "%")', [':prefix' => $orderId . '_copy_']),
                     ['status' => 2] // 取完成状态
-                ])->orderBy('addTime DESC');
+                ])->andWhere(['mainId' => $this->mainId])
+                ->orderBy('addTime DESC');
             $esDatas = $query->all();
             $count = count($esDatas);
             if ($count > 0) {
@@ -594,7 +596,8 @@ class IntraCityController extends BaseController
                 ->where(['and',
                     new \yii\db\Expression('storeOrderId LIKE CONCAT(:prefix, "%")', [':prefix' => $orderId . '_copy_']),
                     ['status' => 1]
-                ])->orderBy('addTime DESC');
+                ])->andWhere(['mainId' => $this->mainId])
+                ->orderBy('addTime DESC');
             // $command = $query->createCommand();
             // $sql = $command->sql;
             $esDatas = $query->all();

+ 15 - 1
app-mall/controllers/OrderController.php

@@ -7,6 +7,7 @@ use bizHd\custom\classes\HdClass;
 use bizHd\wx\classes\WxOpenClass;
 use bizMall\custom\classes\CustomClass;
 use bizMall\goods\classes\GoodsClass;
+use bizMall\goods\classes\GoodsSettingClass;
 use bizMall\item\classes\ItemClass;
 use bizMall\order\classes\OrderClass;
 use bizMall\order\classes\OrderForwardClass;
@@ -331,7 +332,6 @@ class OrderController extends BaseController
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {
-
             $custom = $this->custom;
             if (empty($custom)) {
                 util::fail('个人信息缺失');
@@ -391,6 +391,20 @@ class OrderController extends BaseController
             if ($unitPrice <= 0) {
                 util::fail('没有价格,无法下单');
             }
+            $rise = GoodsSettingClass::getRise($mainId);
+            //根据涨价设置进行自动涨价
+            if (!empty($rise)) {
+                $price = $unitPrice;
+                if ($rise['riseType'] == 0) {
+                    //百分比
+                    $newPrice = $price + sprintf("%.1f", ($price * $rise['riseAmount'] / 100));
+                } else {
+                    //金额
+                    $newPrice = $price + $rise['riseAmount'];
+                }
+                $unitPrice = $newPrice;
+            }
+
             $goodsPrice = $unitPrice * $goodsNum;
             $prePrice = stringUtil::calcAdd($sendCost, $goodsPrice);
             //非门店订单

+ 0 - 8
biz-hd/order/classes/OrderClass.php

@@ -4,16 +4,11 @@ namespace bizHd\order\classes;
 
 use biz\goods\classes\GoodsClass;
 use biz\goods\models\Goods;
-use biz\shop\classes\ShopAdminClass;
 use biz\shop\classes\ShopCapitalClass;
 use biz\shop\classes\ShopClass;
 use biz\shop\classes\ShopExtClass;
-use biz\shop\models\Shop;
-use biz\stat\classes\StatKdClass;
 use biz\stat\classes\StatOrderCountClass;
-use biz\stat\classes\StatSaleClass;
 use biz\stock\classes\GoodsStockRecordClass;
-use biz\wx\classes\WxMessageClass;
 use bizGhs\order\classes\CheckOrderClass;
 use bizGhs\product\classes\ProductClass;
 use bizGhs\stock\classes\StockRecordClass;
@@ -23,11 +18,8 @@ use bizHd\merchant\classes\SjClass;
 use bizHd\refund\classes\HdRefundClass;
 use bizHd\shop\classes\MainClass;
 use bizHd\shop\classes\ShopMoneyChangeClass;
-use bizHd\stat\classes\StatIncomeClass;
-use bizHd\stat\classes\StatOrderClass;
 use bizHd\user\classes\UserClass;
 use bizHd\work\classes\WorkClass;
-use bizHd\wx\classes\WxOpenClass;
 use common\components\dict;
 use common\components\imgUtil;
 use common\components\miniUtil;

+ 3 - 3
biz-mall/goods/classes/GoodsClass.php

@@ -45,8 +45,8 @@ class GoodsClass extends BaseClass
 
         //注意这里涉及商家节日涨价的问题,不要去取不同商家的商品,确有必要另外起方法!!!!!!
         $currentData = current($list);
-        $sjId = $currentData['sjId'];
-        $rise = GoodsSettingClass::getRise($sjId);
+        $mainId = $currentData['mainId'];
+        $rise = GoodsSettingClass::getRise($mainId);
 
         foreach ($list as $key => $val) {
             $id = $val['id'];
@@ -57,7 +57,7 @@ class GoodsClass extends BaseClass
             //多款式
             $val['goodsStyleList'] = [];
             $val['createDate'] = date("Y-m-d", strtotime($val['createTime']));
-            //节日涨价
+            //根据涨价设置进行自动涨价
             if (!empty($rise)) {
                 $price = $val['price'];
                 if ($rise['riseType'] == 0) {

+ 18 - 23
biz-mall/goods/classes/GoodsSettingClass.php

@@ -2,14 +2,9 @@
 
 namespace bizMall\goods\classes;
 
-use bizMall\goods\services\GoodsCategoryService;
-use bizMall\goods\services\GoodsStyleService;
 use bizMall\saas\classes\FestClass;
 use bizMall\saas\classes\FestRiseClass;
-use common\components\business;
-use common\components\stringUtil;
 use common\components\util;
-use Yii;
 use bizMall\base\classes\BaseClass;
 
 class GoodsSettingClass extends BaseClass
@@ -18,25 +13,25 @@ class GoodsSettingClass extends BaseClass
     public static $baseFile = '\bizMall\goods\models\GoodsSetting';
 
     //获取商品涨价比例或金额 ssh 2020.5.20
-    public static function getRise($sjId)
+    public static function getRise($mainId)
     {
-        $festRise = FestRiseClass::getAllByCondition(['sjId' => $sjId], null, 'festId', 'festId');
-        if (empty($festRise)) {
-            return [];
-        }
-        $festId = array_keys($festRise);
-        $fest = FestClass::getByIds($festId);
-        $today = date("Y-n-j");
-        $arr = [];
-        foreach ($fest as $single) {
-            $current = date("Y") . '-' . $single['month'] . '-' . $single['day'];
-            $past = date("Y-n-j", (strtotime($current) - 86400));
-            $arr = array_merge($arr, [$current, $past]);
-        }
-        if (in_array($today, $arr) == false) {
-            return [];
-        }
-        $set = self::getByCondition(['sjId' => $sjId]);
+//        $festRise = FestRiseClass::getAllByCondition(['mainId' => $mainId], null, 'festId', 'festId');
+//        if (empty($festRise)) {
+//            return [];
+//        }
+//        $festId = array_keys($festRise);
+//        $fest = FestClass::getByIds($festId);
+//        $today = date("Y-n-j");
+//        $arr = [];
+//        foreach ($fest as $single) {
+//            $current = date("Y") . '-' . $single['month'] . '-' . $single['day'];
+//            $past = date("Y-n-j", (strtotime($current) - 86400));
+//            $arr = array_merge($arr, [$current, $past]);
+//        }
+//        if (in_array($today, $arr) == false) {
+//            return [];
+//        }
+        $set = self::getByCondition(['mainId' => $mainId]);
         if (empty($set)) {
             util::fail('没有找到涨价需求');
         }