Răsfoiți Sursa

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

shish 4 luni în urmă
părinte
comite
c84fec28b7

+ 1 - 1
app-ghs/controllers/ConsoleController.php

@@ -223,7 +223,7 @@ class ConsoleController extends BaseController
                 ["name" => "商城", "img" => "ghs/home/shop3.png", "url" => "/admin/home/mall"],
                 ["name" => "改价", "img" => "ghs/home/gj.png", "url" => "/admin/changePrice/list2"],
                 ["name" => "花材", "img" => "ghs/home/hcgl.png", "url" => "/admin/item/list2"],
-                ["name" => "今日访客", "img" => "ghs/home/yggl.png", "url" => "/admin/custom/visit"],
+                ["name" => "配送片区", "img" => "ghs/home/kcyjs.png", "url" => "/admin/order/orderListByDist"],
                 //["name" => "预订客户", "img" => "ghs/home/yggl.png", "url" => "/admin/book/custom"],
                 ["name" => "改库存", "img" => "ghs/home/kcyjs.png", "url" => "/admin/changePrice/changeStock2"],
                 ["name" => "采购", "img" => "ghs/home/icon_ghs.png", "url" => "/pagesPurchase/supplier"],

+ 1 - 1
app-ghs/controllers/CustomController.php

@@ -702,7 +702,7 @@ class CustomController extends BaseController
     {
         //限制请求次数
         $shopId = $this->shopId;
-        util::perDayCommitTimeLimit($shopId, 3);
+        //util::perDayCommitTimeLimit($shopId, 3);
 
         //限制频繁请求
         util::checkRepeatCommit($this->adminId, 6);

+ 1 - 1
app-ghs/controllers/MainController.php

@@ -240,7 +240,7 @@ class MainController extends BaseController
         $smallShopImg = $shopImg . "?x-oss-process=image/resize,m_fill,h_180,w_180";
 
         //是否显示推荐广告
-        $showAd = 1;
+        $showAd = 0;
         //用于审核的账号不要显示广告
         if ($this->mainId == 58) {
             $showAd = 0;

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

@@ -947,6 +947,28 @@ class OrderController extends BaseController
         util::success($respond);
     }
 
+    //按片区排列的订单列表
+    public function actionListByDist()
+    {
+        $get = Yii::$app->request->get();
+        $where = [];
+        $where['o.mainId'] = $this->mainId;
+        $searchTime = $get['searchTime'] ?? '';
+        if (!empty($searchTime)) {
+            $startTime = $get['startTime'] ?? '';
+            $endTime = $get['endTime'] ?? '';
+            // 时间跨度不能超过7天
+            if (strtotime($endTime) - strtotime($startTime) > 7 * 24 * 3600) {
+                util::fail('最多查询7天的订单');
+            }
+            $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
+            $where['payTime'] = ['between', [$period['startTime'], $period['endTime']]];
+        }
+        $respond = OrderClass::getDistOrderList($where);
+
+        util::success($respond);
+    }
+
     // 新订单列表详情 -- 可能与 actionList 很相似,但为不影响 actionList,重新创建个方法 shizhongqi 2022.06.23
     public function actionNewOrderList()
     {
@@ -1111,7 +1133,7 @@ class OrderController extends BaseController
         $post['getStaffName'] = $shopAdminName;
 
         if (getenv('YII_ENV') == 'production') {
-            //南粤选了开单,也只能变成本人开单
+            //南粤选了别的开单,也只能变成本人开单
             if ($this->mainId == 22388) {
                 $post['shopAdminName'] = $shopAdmin->name;
                 $post['shopAdminId'] = $shopAdmin->id;

+ 0 - 1
biz-ghs/custom/classes/DistClass.php

@@ -4,7 +4,6 @@ namespace bizGhs\custom\classes;
 
 use bizGhs\shop\classes\ShopClass;
 use bizHd\base\classes\BaseClass;
-use Yii;
 
 class DistClass extends BaseClass
 {

+ 45 - 0
biz-ghs/order/classes/OrderClass.php

@@ -22,9 +22,11 @@ use biz\stat\classes\StatRefundClass;
 use biz\stat\classes\StatSaleClass;
 use bizGhs\express\services\DadaExpressServices;
 use bizGhs\order\traits\OrderTrait;
+use bizGhs\order\models\Order;
 use bizGhs\product\classes\ProductClass;
 use bizGhs\admin\classes\AdminClass;
 use bizGhs\custom\classes\CustomClass;
+use bizGhs\custom\models\Custom;
 use bizGhs\shop\classes\MainClass;
 use bizGhs\stock\classes\StockRecordClass;
 use bizHd\purchase\classes\PurchaseClass;
@@ -1399,6 +1401,49 @@ class OrderClass extends BaseClass
         return $data;
     }
 
+    //按片区排列的订单列表
+    public static function getDistOrderList($where)
+    {
+        /** @var Order $model */
+        $model = self::getActiveRecord();
+
+        $query = $model->conditionQuery($where)
+            ->alias('o')
+            ->leftJoin(['c' => Custom::tableName()], 'c.id = o.customId')
+            ->select(['o.id', 'o.mainId', 'o.customId', 'o.customName', 'o.customAvatar', 'o.fullAddress', 'o.remark', 'c.name', 'c.mobile', 'c.distId', 'distId' => 'c.distId']);
+
+        // $clone = clone $query;
+        // $count = intval($clone->count('o.id'));
+
+        $orderList = $query
+            ->orderBy(['c.distId' => SORT_ASC, 'o.addTime' => SORT_DESC]) // ->offset($offset)->limit($pageSize)
+            ->asArray()
+            ->all();
+
+        $distIds = array_unique(array_filter(array_column($orderList, 'distId')));
+        $distMap = [];
+        if (!empty($distIds)) {
+            $distMap = DistClass::getByIds($distIds, null, 'id');
+        }
+
+        $grouped = [];
+        foreach ($orderList as $orderInfo) {
+            $distId = intval($orderInfo['distId']);
+            if (!isset($grouped[$distId]) && isset($distMap[$distId])) {
+                $grouped[$distId] = [
+                    'distId' => $distId,
+                    'distName' => $distMap[$distId]['name'],
+                    'list' => [],
+                ];
+            }
+            $grouped[$distId]['list'][$orderInfo['customId']][] = $orderInfo;
+        }
+
+        return [
+            'list' => array_values($grouped),
+        ];
+    }
+
     //整合订单员工和供货商等信息 ssh 2021.1.19
     //$isList 是否列表页
     public static function groupOrder($list, $showButton = false, $showItem = false, $showExpress = false, $isList = false)

+ 1 - 1
biz/ghs/classes/GhsClass.php

@@ -348,7 +348,7 @@ class GhsClass extends BaseClass
         }
 
         //要排除的批发店
-        $exclude = [64112, 62304, 42385, 56611, 38143, 15373, 42946, 15375, 15734, 15736, 15738, 15740, 24132, 29044, 29161, 30902, 44724, 48608, 48642, 82971, 38231, 1105, 3, 154, 208, 23580, 24713, 8249, 16070, 83690, 86726, 1596, 2167, 15007, 88085, 91064, 413];
+        $exclude = [64112, 62304, 42385, 56611, 38143, 15373, 42946, 15375, 15734, 15736, 15738, 15740, 24132, 29044, 29161, 30902, 44724, 48608, 48642, 82971, 38231, 1105, 3, 154, 208, 23580, 24713, 8249, 16070, 83690, 86726, 1596, 2167, 15007, 88085, 91064, 413, 62421];
         foreach ($nearbyShops as $key => $nearbyShop) {
             if (in_array($nearbyShop['id'], $exclude)) {
                 unset($nearbyShops[$key]);