shish 4 жил өмнө
parent
commit
e9fd74f3c2

+ 30 - 0
console/controllers/CustomController.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace console\controllers;
+
+use biz\ghs\classes\GhsClass;
+use bizGhs\custom\classes\CustomClass;
+use yii\console\Controller;
+use Yii;
+
+class CustomController extends Controller
+{
+
+    //黑名单设置 ./yii custom/black
+    public function actionBlack()
+    {
+        $list = CustomClass::getAllByCondition(['black' => 2], null, '*', null, true);
+        if (!empty($list)) {
+            foreach ($list as $c) {
+                $ghsId = $c->ghsId ?? 0;
+                $ghs = GhsClass::getById($ghsId, true);
+                if (!empty($ghs)) {
+                    $ghs->black = 2;
+                    $ghs->save();
+                    echo $ghs->name . " id:{$ghs->id} 已经黑了\n";
+                }
+            }
+        }
+    }
+
+}