|
|
@@ -0,0 +1,26 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace console\controllers;
|
|
|
+
|
|
|
+use biz\goods\classes\GoodsClass;
|
|
|
+use bizHd\work\classes\WorkClass;
|
|
|
+use yii\console\Controller;
|
|
|
+use Yii;
|
|
|
+
|
|
|
+class WorkController extends Controller
|
|
|
+{
|
|
|
+
|
|
|
+ public function actionInit()
|
|
|
+ {
|
|
|
+ GoodsClass::updateByCondition(['id>' => 0], ['stock' => 0]);
|
|
|
+ $workList = WorkClass::getAllByCondition(['status' => 0], null, '*', null, true);
|
|
|
+ if (!empty($workList)) {
|
|
|
+ foreach ($workList as $work) {
|
|
|
+ $num = $work->num ?? 0;
|
|
|
+ $goodsId = $work->goodsId ?? 0;
|
|
|
+ GoodsClass::updateById($goodsId, ['stock' => $num]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|