Bladeren bron

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

shish 3 jaren geleden
bovenliggende
commit
36ed2e1b9e

+ 8 - 0
app-ghs/controllers/ItemController.php

@@ -12,6 +12,14 @@ use Yii;
 class ItemController extends BaseController
 {
 
+    //是否有C级价格大于B级的 ssh 20221204
+    public function actionGetErrorPrice()
+    {
+        $shop = $this->shop;
+        $list = ItemClass::errorPrice($shop);
+        util::success(['list' => $list]);
+    }
+
     //列出所有花材,包括特价花材列表 ssh 20220315
     public function actionShowList()
     {

+ 9 - 0
app-hd/controllers/OrderController.php

@@ -601,6 +601,15 @@ class OrderController extends BaseController
             //阿东开5支老是会出现5扎情况跟踪
             ProductClass::adStockCheck($this->shop, $productList);
 
+            //3秒内不允许重复开单
+            $staffId = $this->shopAdminId ?? 0;
+            $cacheKey = 'hd_create_order_' . $staffId . '_' . $customId;
+            $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
+            if (!empty($has)) {
+                util::fail('稍等5秒再开单');
+            }
+            Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 3, 'has']);
+
             $return = OrderService::createFinishOrder($post, $custom, $hasPay);
             $transaction->commit();
 

+ 1 - 1
app-hd/controllers/PurchaseController.php

@@ -94,11 +94,11 @@ class PurchaseController extends BaseController
             $ghsShopInfo = ShopClass::getById($ghsShopId, true);
             $ghsMainId = $ghsShopInfo->mainId ?? 0;
             $isOpen = ShopClass::isOpen($ghsShopInfo);
+            $book = $post['book'] ?? 0;
             if ($isOpen == 0 && $book == 0) {
                 util::fail('本店已休息,请选择其它门店');
             }
 
-            $book = $post['book'] ?? 0;
             $sendTimeWant = isset($post['sendTimeWant']) && !empty($post['sendTimeWant']) ? $post['sendTimeWant'] : date("Y-m-d");
             $future = date("Y-m-d", strtotime('+2 day'));
             if ($book == 1) {

+ 55 - 0
biz-ghs/item/classes/ItemClass.php

@@ -16,6 +16,61 @@ class ItemClass extends BaseClass
 
     public static $baseFile = '\bizGhs\item\models\Item';
 
+    public static function errorPrice($shop)
+    {
+        $mainId = $shop->mainId ?? 0;
+        $itemList = ItemClass::getAllByCondition(['mainId' => $mainId, 'delStatus' => 0, 'status' => 1], null, '*');
+        $arr = [];
+        if (!empty($itemList)) {
+            foreach ($itemList as $item) {
+                $name = $item['name'] ?? '';
+                $price = $item['price'] ?? 0;
+                $name = trim(strtolower($name));
+                $name = str_replace(" ", "", $name);
+
+                $hasLevel = true;
+                $keyName = '';
+                $keyLevel = 'a';
+                if (strstr($name, "a级") != false) {
+                    $keyName = str_replace("a级", "x级", $name);
+                    $keyLevel = 'a';
+                } elseif (strstr($name, "b级") != false) {
+                    $keyName = str_replace("b级", "x级", $name);
+                    $keyLevel = 'b';
+                } elseif (strstr($name, "c级") != false) {
+                    $keyName = str_replace("c级", "x级", $name);
+                    $keyLevel = 'c';
+                } else {
+                    $hasLevel = false;
+                }
+                if ($hasLevel) {
+                    $arr[$keyName][$keyLevel] = $price;
+                }
+            }
+        }
+        $error = [];
+        if (!empty($arr)) {
+            foreach ($arr as $key => $it) {
+                if (isset($it['a']) && isset($it['b']) && $it['b'] > $it['a']) {
+                    $error[$key] = $it;
+                }
+                if (isset($it['b']) && isset($it['c']) && $it['c'] > $it['b']) {
+                    $error[$key] = $it;
+                }
+                if (isset($it['a']) && isset($it['c']) && $it['c'] > $it['a']) {
+                    $error[$key] = $it;
+                }
+            }
+        }
+        $data = [];
+        if (!empty($error)) {
+            foreach ($error as $name => $val) {
+                $data[] = array_merge(['name' => $name], $val);
+            }
+        }
+        return $data;
+    }
+
     //初始化花材 lqh 2021.4.12  modify ssh 20210711
     public static function initItem($mainId)
     {

+ 1 - 1
biz-ghs/order/classes/OrderClearClass.php

@@ -100,7 +100,7 @@ class OrderClearClass extends BaseClass
             'customAvatar' => $custom['avatar'] ?? '',
             'customMobile' => $custom['mobile'] ?? '',
             'customAddress' => $custom['address'] ?? '',
-            'deadline' => date("Y-m-d H:i:s", time() + 10 * 60 * 60),
+            'deadline' => date("Y-m-d H:i:s", time() + 48 * 60 * 60),
             'purchaseIds' => $purchaseString,
             'payWay' => $payWay,
             'num' => count($ids),

+ 3 - 3
biz-ghs/stat/classes/StatKdClass.php

@@ -62,7 +62,7 @@ class StatKdClass extends BaseClass
             'system' => [
                 'amount' => 0,
                 'num' => 0,
-                'name' => '系统',
+                'name' => '系统收款',
                 'category' => [
                     'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
                     'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
@@ -73,7 +73,7 @@ class StatKdClass extends BaseClass
             'kfWx' => [
                 'amount' => 0,
                 'num' => 0,
-                'name' => '员工微信',
+                'name' => '员工收款',
                 'class' => $kf,
                 'category' => [
                     'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
@@ -85,7 +85,7 @@ class StatKdClass extends BaseClass
             'debt' => [
                 'amount' => 0,
                 'num' => 0,
-                'name' => '待结欠款',
+                'name' => '欠款',
                 'category' => [
                     'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
                     'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],

+ 9 - 2
biz-hd/purchase/classes/PurchaseClass.php

@@ -499,18 +499,25 @@ class PurchaseClass extends BaseClass
             $productList[$key]['smallPrice'] = $price;
             $productList[$key]['mainId'] = $mainId;
 
+            $currentBigUnit = $hdProductData[$hdProductId]['bigUnit'] ?? '';
+            $currentSmallUnit = $hdProductData[$hdProductId]['smallUnit'] ?? '';
             if ($currentBigNum > 0) {
                 $xhNum = $currentBigNum;
-                $xhUnitName = $hdProductData[$hdProductId]['bigUnit'] ?? '';
+                $xhUnitName = $currentBigUnit;
                 $xhUnitType = dict::getDict('unitType', 'big');
             } else {
                 $xhNum = $currentSmallNum;
-                $xhUnitName = $hdProductData[$hdProductId]['smallUnit'] ?? '';
+                $xhUnitName = $currentSmallUnit;
                 $xhUnitType = dict::getDict('unitType', 'small');
             }
             $itemPrice = $price;
             $price = bcmul($itemPrice, $xhNum, 2);
 
+			//客户下单时会出现同时选了扎和支,很奇怪,前端没有找到原因,后端限制
+            if ($currentBigNum > 0 && $currentSmallNum > 0) {
+                util::fail($itemName . " {$currentBigUnit}和{$currentSmallUnit}只能选一种");
+            }
+
             $productList[$key]['xhNum'] = $xhNum;
             $productList[$key]['xhUnitName'] = $xhUnitName;
             $productList[$key]['xhUnitType'] = $xhUnitType;

+ 2 - 2
console/controllers/ItemController.php

@@ -49,7 +49,7 @@ class ItemController extends Controller
                 $py = stringUtil::py($name);
                 $product->py = $py;
                 $product->save();
-                echo $name.' '.$py."\n";
+                echo $name . ' ' . $py . "\n";
             }
         }
         $item = PtItemClass::getAllByCondition([], null, '*', null, true);
@@ -60,7 +60,7 @@ class ItemController extends Controller
                     $py = stringUtil::py($name);
                     $it->py = $py;
                     $it->save();
-                    echo $name.' '.$py."\n";
+                    echo $name . ' ' . $py . "\n";
                 }
             }
         }