| 123456789101112131415161718192021222324252627282930 |
- <?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";
- }
- }
- }
- }
- }
|