shish 2 роки тому
батько
коміт
ddd1837d49
1 змінених файлів з 7 додано та 0 видалено
  1. 7 0
      app-pt/controllers/PtCpItemController.php

+ 7 - 0
app-pt/controllers/PtCpItemController.php

@@ -17,6 +17,7 @@ class PtCpItemController extends BaseController
         $post = Yii::$app->request->post();
         $str = $post['ids'] ?? '';
         $cpId = $post['cpId'] ?? 0;
+        $currentAuth = $post['auth'] ?? 0;
         $ids = json_decode($str, true);
         if (empty($ids)) {
             util::fail('请选择花材');
@@ -39,6 +40,9 @@ class PtCpItemController extends BaseController
             $py = $item->py ?? '';
             $itemAuth = $item->auth ?? 0;
             $item->hasCpId = 1;
+            if ($currentAuth == 1) {
+                $item->auth = 1;
+            }
             $item->save();
             if ($delStatus == 1) {
                 util::fail("【{$name}】已删除");
@@ -49,6 +53,9 @@ class PtCpItemController extends BaseController
                 if ($itemAuth == 1 && $cpAuth == 1) {
                     $auth = 1;
                 }
+                if ($currentAuth == 1) {
+                    $auth = 1;
+                }
                 $relate = [
                     'itemId' => $itemId,
                     'cpId' => $cpId,