Sfoglia il codice sorgente

Merge branch 'master' into redesign‌-260706

shish 3 settimane fa
parent
commit
d2daf70fa8

+ 7 - 1
app-ghs/controllers/OrderController.php

@@ -977,11 +977,17 @@ class OrderController extends BaseController
             $where['book'] = $book;
         }
         $searchTime = $get['searchTime'] ?? '';
+        //0搜索的addTime 1搜索的payTime
+        $searchTimeType = $get['searchTimeType'] ?? 0;
         if (!empty($searchTime)) {
             $startTime = $get['startTime'] ?? '';
             $endTime = $get['endTime'] ?? '';
             $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
-            $where['payTime'] = ['between', [$period['startTime'], $period['endTime']]];
+            if ($searchTimeType == 0) {
+                $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
+            } else {
+                $where['payTime'] = ['between', [$period['startTime'], $period['endTime']]];
+            }
         }
 
         if ($export == 1) {

+ 2 - 1
app-ghs/controllers/TestController.php

@@ -507,7 +507,8 @@ class TestController extends BaseController
             //['name' => '张家口万花汇', 'merchantNo' => '82213805992008D', 'wx' => [901551070, 901551037], 'zfb' => '2088780253600870'],
             //['name' => '深圳每日鲜花批发', 'merchantNo' => '82258405992020E', 'wx' => [902309136, 902307468], 'zfb' => '2088780298610704'],
             //['name' => '滨州花镜鲜花', 'merchantNo' => '82246605992005U', 'wx' => [904373612, 904373338], 'zfb' => '2088780426621723'],
-            ['name' => '广州情意鲜花', 'merchantNo' => '8225810599201U2', 'wx' => [904871059, 904872401], 'zfb' => '2088780455410378'],
+            //['name' => '广州情意鲜花', 'merchantNo' => '8225810599201U2', 'wx' => [904871059, 904872401], 'zfb' => '2088780455410378'],
+            ['name' => '我要花义乌店', 'merchantNo' => '8223380599200A6', 'wx' => [2000005220, 907253683], 'zfb' => '2088780613953851'],
             //['name' => '厦门纯彩花艺', 'merchantNo' => '8223930599200LD', 'wx' => [894984230, 894983290], 'zfb' => '2088680439152343'],
             //['name' => '东莞我要花鲜花', 'merchantNo' => '8226020599200R8', 'wx' => [894794554, 894794917], 'zfb' => '2088680405463378'],
             //['name' => '镇江花珩鲜花批发', 'merchantNo' => '82231405992003N', 'wx' => [894925711, 894925626], 'zfb' => '2088680426877183'],

+ 10 - 40
app-hd/controllers/GhsController.php

@@ -500,7 +500,16 @@ class GhsController extends BaseController
 
     public function actionCommonInfo()
     {
-        $mainId = $this->resolveGhsMainId();
+        $get = Yii::$app->request->get();
+        $ghsId = intval($get['ghsId'] ?? 0);
+        $ghs = GhsClass::getById($ghsId);
+        if(empty($ghs)){
+            util::fail('没有找到批发店');
+        }
+        if($ghs['ownMainId'] != $this->mainId){
+            util::fail('不是你的批发店');
+        }
+        $mainId = $ghs['mainId'] ?? 0;
         // 通用接口返回全部有效公告,前端按 positions 字段筛选展示位置
         $ghsNoticeList = GhsNoticeClass::getClientNoticeList($mainId);
         util::success(['ghsNoticeList' => $ghsNoticeList]);
@@ -518,43 +527,4 @@ class GhsController extends BaseController
         util::success(GhsNoticeClass::getClientDetail($id));
     }
 
-    /**
-     * 根据批发商 ghsId 或 shopId 解析 mainId(列表接口用,勿与公告 id 混用)
-     */
-    protected function resolveGhsMainId(): int
-    {
-        $get = Yii::$app->request->get();
-        $ghsId = intval($get['ghsId'] ?? 0);
-        $shopId = intval($get['shopId'] ?? 0);
-        $ghsShopId = 0;
-
-        if ($ghsId > 0) {
-            $ghs = GhsClass::getById($ghsId);
-            if (empty($ghs)) {
-                util::fail('没有找到批发商');
-            }
-            if (!empty($this->shopId)) {
-                GhsClass::valid($ghs, $this->shopId);
-            }
-            $ghsShopId = intval($ghs['shopId'] ?? 0);
-        } elseif ($shopId > 0) {
-            $ghsShop = ShopClass::getById($shopId, true);
-            if (empty($ghsShop) || $ghsShop->ptStyle != dict::getDict('ptStyle', 'ghs')) {
-                util::fail('没有找到批发店');
-            }
-            $ghsShopId = $shopId;
-        } else {
-            util::fail('参数不对');
-        }
-
-        $ghsShop = ShopClass::getById($ghsShopId, true);
-        if (empty($ghsShop)) {
-            util::fail('没有找到批发商');
-        }
-        $mainId = intval($ghsShop->mainId ?? 0);
-        if ($mainId <= 0) {
-            util::fail('批发商信息不完整');
-        }
-        return $mainId;
-    }
 }

+ 21 - 3
app-hd/controllers/OrderController.php

@@ -1314,7 +1314,6 @@ class OrderController extends BaseController
     {
         $get = Yii::$app->request->get();
         $searchText = $get['searchText'] ?? '';
-        $searchStyle = $get['searchStyle'] ?? 0;
         $shopId = $this->shopId ?? 0;
         if (empty($shopId)) {
             //没有登录不显示数据
@@ -1343,8 +1342,9 @@ class OrderController extends BaseController
         if (!empty($get['shopAdminId'])) {
             $where['shopAdminId'] = $get['shopAdminId'];
         }
-        if ($searchStyle == 1 && !empty($searchText)) {
-            $where['sendNum'] = $searchText;
+        // 按搜索词自动识别:纯数字查货号,否则查姓名
+        if (!empty($searchText)) {
+            $this->appendOrderListSearchWhere($where, $searchText);
         }
         if (isset($get['repeat']) && $get['repeat'] > -1) {
             $where['repeat'] = $get['repeat'];
@@ -1497,4 +1497,22 @@ class OrderController extends BaseController
         util::success(['sedCost' => 10]);
     }
 
+    /**
+     * 订单列表搜索条件:纯数字按货号精确匹配,否则按客户姓名模糊匹配
+     * @param array $where 查询条件(引用传递)
+     * @param string $searchText 搜索关键词
+     */
+    private function appendOrderListSearchWhere(&$where, $searchText)
+    {
+        $searchText = trim((string)$searchText);
+        if ($searchText === '') {
+            return;
+        }
+        if (preg_match('/^\d+$/', $searchText)) {
+            $where['sendNum'] = $searchText;
+            return;
+        }
+        $where['customName'] = ['like', $searchText];
+    }
+
 }

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

@@ -1172,7 +1172,7 @@ class PurchaseController extends BaseController
             $startTime = $get['startTime'] ?? '';
             $endTime = $get['endTime'] ?? '';
             $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
-            $where['payTime'] = ['between', [$period['startTime'], $period['endTime']]];
+            $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
         }
         $ghsId = $get['ghsId'] ?? 0;
         if (!empty($ghsId)) {

+ 2 - 3
app-mall/controllers/ShopController.php

@@ -51,10 +51,9 @@ class ShopController extends BaseController
                     $custom->save();
                 }
             }
+            StatVisitClass::addHdCustomVisit($shop->id, $user->id);
         }
 
-        StatVisitClass::addHdCustomVisit($shop->id, $user->id);
-
         util::success(['info' => $info, 'hd' => $hd, 'custom' => $custom]);
     }
 
@@ -83,4 +82,4 @@ class ShopController extends BaseController
         util::success(['ad' => $ad, 'shop' => $shop, 'newUserGift' => $newUserGift]);
     }
 
-}
+}