Browse Source

更新名称

shish 3 năm trước cách đây
mục cha
commit
2fd0378942
1 tập tin đã thay đổi với 23 bổ sung0 xóa
  1. 23 0
      console/controllers/CgController.php

+ 23 - 0
console/controllers/CgController.php

@@ -84,4 +84,27 @@ class CgController extends Controller
         }
     }
 
+    //更新名称和封面 ssh 20230317
+    public function actionUpdateName()
+    {
+        ini_set('memory_limit', '2045M');
+        set_time_limit(0);
+        $list = PurchaseItemClass::getAllByCondition(['id>' => 0], null, '*', null, true);
+        if (!empty($list)) {
+            foreach ($list as $item) {
+                $info = $item->itemInfo;
+                if (!empty($info)) {
+                    $arr = json_decode($info, true);
+                    $name = $arr['itemName'] ?? '';
+                    $cover = $arr['itemCover'] ?? '';
+                    if (!empty($name)) {
+                        $item->name = $name;
+                        $item->cover = $cover;
+                        $item->save();
+                    }
+                }
+            }
+        }
+    }
+
 }