shish 4 vuotta sitten
vanhempi
commit
60d431b114

+ 15 - 29
app-ghs/controllers/XjController.php

@@ -3,9 +3,9 @@
 namespace ghs\controllers;
 
 use biz\product\classes\XjClass;
-use biz\shop\classes\ShopExtClass;
 use common\components\util;
 use Yii;
+
 class XjController extends BaseController
 {
 
@@ -29,46 +29,32 @@ class XjController extends BaseController
     //取出所有小菊,带商家有没有标识 shish 20210904
     public function actionGetFilterXj()
     {
-        $where = [];
-        $where['shopId'] = $this->shopId;
-        $where['status'] = 1;
-        $list = XjClass::getShopXj($this->shopId);
-        $ext = $this->shopExt;
-        $xj = $ext->xj ?? '';
-        $hasIds = [];
-        if (!empty($xj)) {
-            $hasIds = json_decode($xj, true);
-        }
-        if (!empty($list)) {
-            foreach ($list as $key => $val) {
-                $id = $val['id'] ?? 0;
-                $list[$key]['has'] = 0;
-                if (in_array($id, $hasIds)) {
-                    $list[$key]['has'] = 1;
-                }
-            }
-        }
+        $list = XjClass::getAllByCondition(['shopId' => $this->shopId, 'delStatus' => 0], null, '*');
         util::success(['list' => $list]);
     }
 
-
     //清除全部小菊  lqh 2021.12.8
     public function actionClearAll()
     {
         XjClass::clearAll($this->shopId);
-        ShopExtClass::clearXjALl($this->shopId);
-        util::complete();
+        //ShopExtClass::clearXjALl($this->shopId);
+        util::complete('已删除');
     }
 
     //新增小菊 lqh 2021.12.8
-    public function actionAdd()
+    public function actionBatchAdd()
     {
         $post = Yii::$app->request->post();
-        $cover = $post['cover']??'';
-        if(empty($cover)){
-            util::fail("请上传图片");
+        $xjData = $post['xjData'] ?? '';
+        if (empty($xjData)) {
+            util::fail('请上传图片');
         }
-        XjClass::addXj($this->shopId,$cover,$this->shopExt);
-        util::complete();
+        $arr = json_decode($xjData, true);
+        if (is_array($arr) == false) {
+            util::fail('请上传图片...');
+        }
+        XjClass::batchAddXj($arr, $this->shop);
+        util::complete('添加成功');
     }
+
 }

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

@@ -22,8 +22,7 @@ class ShopExtController extends BaseController
         $ghs = GhsClass::getById($id, true);
         GhsClass::valid($ghs, $this->shopId);
         $shopId = $ghs->shopId ?? 0;
-        $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
-        $list = XjClass::getSjXj($ext);
+        $list = XjClass::getAllByCondition(['shopId' => $shopId, 'delStatus' => 0, 'status' => 1], null, '*');
         util::success(['list' => $list]);
     }
 

+ 32 - 9
biz/product/classes/XjClass.php

@@ -50,29 +50,29 @@ class XjClass extends BaseClass
         $where = [];
         $where['shopId'] = $shopId;
         $data = [];
-        $data['status'] =2;
+        $data['status'] = 2;
         $data['delStatus'] = 1;
-        return self::updateByCondition($where,$data);
+        return self::updateByCondition($where, $data);
     }
 
     // 获取当前门店小菊的总数
     public static function getXjCount($shopId)
     {
-        $where =[];
+        $where = [];
         $where['shopId'] = $shopId;
         $where['delStatus'] = 0;
         return self::getCount($where);
     }
 
     //新增小菊
-    public static function addXj($shopId,$cover,$shopExt)
+    public static function addXj($shopId, $cover, $shopExt)
     {
         $count = self::getXjCount($shopId);
-        if($count < 10) {
-            $count ++ ;
-            $count = "0".$count;
+        if ($count < 10) {
+            $count++;
+            $count = "0" . $count;
         }
-        $name = "小菊".$count;
+        $name = "小菊" . $count;
         $data = [];
         $data['cover'] = $cover;
         $data['name'] = $name;
@@ -86,13 +86,35 @@ class XjClass extends BaseClass
         if (!empty($xj)) {
             $hasIds = json_decode($xj, true);
         }
-        if(in_array($id,$hasIds) == false){
+        if (in_array($id, $hasIds) == false) {
             $hasIds[] = $id;
             $shopExt->xj = json_encode($hasIds);
             $shopExt->save();
         }
     }
 
+    //批量添加小菊 shish 20211210
+    public static function batchAddXj($arr, $shop)
+    {
+        $shopId = $shop->id ?? 0;
+        $sjId = $shop->sjId ?? 0;
+        $max = self::getByCondition(['shopId' => $shopId, 'delStatus' => 0], true, 'no DESC');
+        $maxId = $max->no ?? 0;
+        foreach ($arr as $key => $imgUrl) {
+            $maxId++;
+            $name = '小菊' . $maxId;
+            $data = [
+                'cover' => $imgUrl,
+                'name' => $name,
+                'no' => $maxId,
+                'status' => 1,
+                'shopId' => $shopId,
+                'sjId' => $sjId
+            ];
+            self::add($data);
+        }
+    }
+
     //获取当前门店下所有的xj
     public static function getShopXj($shopId)
     {
@@ -103,4 +125,5 @@ class XjClass extends BaseClass
         $list = self::getAllByCondition($where, null, '*', null);
         return self::groupInfo($list);
     }
+
 }

+ 20 - 0
sql.txt

@@ -1,3 +1,23 @@
+=========shish 2021.12.10
+ALTER TABLE xhShop MODIFY `cgModel` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '0标准模式 1简约模式';
+ALTER TABLE xhShop MODIFY `cgPerCost` DECIMAL(9,2) NOT NULL DEFAULT '3.00' COMMENT '每公斤运费';
+ALTER TABLE `xhSj` MODIFY `agentLevel` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '代理商 0非代理 1是代理商';
+ALTER TABLE `xhShop` ADD `agentLevel` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '代理商 0非代理 1是代理商' AFTER `tjFlAmount`;
+ALTER TABLE `xhXj` ADD sjId INT NOT NULL DEFAULT 0 COMMENT '商家id' AFTER `status`;
+ALTER TABLE `xhXj` ADD `no` INT NOT NULL DEFAULT 0 COMMENT '编号' AFTER `shopId`;
+ALTER TABLE `xhShopExt` DROP COLUMN `xj`;
+
+花材页显示多个等级的价格,以及修改功能,上线前需要测试过一下
+
+线上载入全部的供货商 改了文件,已经注释的,文件要恢复一下,再更新git
+
+邀请功能线上再测试过一下
+
+小菊功能有修改需要告之莱漫花行,并且要给重新设置好!!!!!!!!!!!!!
+
+=====================================================================
+
+
 # sql 变更记录  2021.12.8
 =========lqh 2021.12.8
 ALTER TABLE `xhXj`