Sfoglia il codice sorgente

零售店添加开门营业时间才能下单

shizhongqi 10 mesi fa
parent
commit
a049f2ed88

+ 17 - 0
app-mall/controllers/OrderController.php

@@ -392,6 +392,23 @@ class OrderController extends BaseController
     public function actionCreateOrder()
     {
         $post = Yii::$app->request->post();
+
+        // 判断是否在营业时间窗口
+        $openTime = $this->shop->openStartTime; // 示例:09:10
+        $closeTime = $this->shop->openEndTime; // 示例:18:30
+        if ($openTime != '' && $closeTime != '') {
+            $openHourMinute = explode(':', $openTime);
+            $closeHourMinute = explode(':', $closeTime);
+            $currentHour = date('H');
+            $currentMinute = date('i');
+            if ($currentHour < intval($openHourMinute[0]) || ($currentHour == intval($openHourMinute[0]) && $currentMinute < intval($openHourMinute[1]))) {
+                util::fail('不在营业时间窗口');
+            }
+            if ($currentHour > intval($closeHourMinute[0]) || ($currentHour == intval($closeHourMinute[0]) && $currentMinute > intval($closeHourMinute[1]))) {
+                util::fail('不在营业时间窗口');
+            }
+        }
+
         $goodsId = $post['goodsId'] ?? 0;
         $goodsNum = isset($post['goodsNum']) && $post['goodsNum'] > 0 ? $post['goodsNum'] : 1;
         $sendType = $post['sendType'] ?? dict::getDict('sendType', 'thirdSend');

+ 1 - 1
biz-ghs/custom/classes/CustomClass.php

@@ -368,7 +368,7 @@ class CustomClass extends BaseClass
             $customSjId = $val['sjId'];
             $currentInfo = isset($sjInfo[$customSjId]) ? $sjInfo[$customSjId] : [];
             //$currentInfo = business::formatMerchantLogo($currentInfo);
-            $smallAvatar =  imgUtil::getPrefix() . (!empty($val['avatar']) ? $val['avatar'] : '/hhb_small.png');
+            $smallAvatar =  imgUtil::getPrefix() . (!empty($val['avatar']) ? $val['avatar'] : '/hhb_small.png') . '?x-oss-process=image/resize,m_fill,h_130,w_130';
             $avatar = imgUtil::getPrefix() . (!empty($val['avatar']) ? $val['avatar'] : '/hhb_small.png');
             $list[$key]['smallAvatar'] = $smallAvatar;
             //$list[$key]['shortSmallAvatar'] = $currentInfo['shortSmallLogoUrl'];