shish 2 år sedan
förälder
incheckning
be27114f03
1 ändrade filer med 23 tillägg och 0 borttagningar
  1. 23 0
      app-ghs/controllers/ItemController.php

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

@@ -6,6 +6,7 @@ use biz\item\classes\PtItemClass;
 use biz\product\models\Product;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\item\classes\ItemClass;
+use bizGhs\shop\classes\ShopAdminClass;
 use common\components\dict;
 use common\components\imgUtil;
 use common\components\miniUtil;
@@ -692,4 +693,26 @@ class ItemController extends BaseController
         util::complete();
     }
 
+    //批量修改花材的负责人 ssh 20240718
+    public function actionChangeCgStaff()
+    {
+        $get = Yii::$app->request->get();
+        $beforeId = $get['beforeId'] ?? 0;
+        $newId = $get['newId']??0;
+        if(empty($beforeId) || empty($newId)){
+            util::fail('员工信息有问题');
+        }
+        $new = ShopAdminClass::getById($newId,true);
+        if(empty($new) || $new->mainId != $this->mainId){
+            util::fail('错误的员工信息');
+        }
+        $before = ShopAdminClass::getById($beforeId,true);
+        if(empty($before) || $before->mainId != $this->mainId){
+            util::fail('错误的员工信息2');
+        }
+        $newName = $new->name??'';
+        ItemClass::updateByCondition(['mainId'=>$this->mainId,'cgStaffId'=>$beforeId],['cgStaffId'=>$newId,'cgStaffName'=>$newName]);
+        util::complete('修改成功');
+    }
+
 }