|
|
@@ -31,6 +31,45 @@ class ItemController extends Controller
|
|
|
|
|
|
public $sjId, $shopId, $sj;
|
|
|
|
|
|
+ //花材反向更新 ./yii item/reverse-update
|
|
|
+ public function actionReverseUpdate()
|
|
|
+ {
|
|
|
+ $shopId = 10;
|
|
|
+ if (getenv('YII_ENV') != 'production') {
|
|
|
+ $shopId = 36225;
|
|
|
+ }
|
|
|
+ $list = ProductClass::getAllByCondition(['shopId' => $shopId], null, '*', null, true);
|
|
|
+ if (empty($list)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ foreach ($list as $cKey => $product) {
|
|
|
+ $itemId = $product->itemId ?? 0;
|
|
|
+ $item = \bizGhs\item\classes\ItemClass::getById($itemId, true);
|
|
|
+ if (empty($item)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $ptItemId = $item->itemId ?? 0;
|
|
|
+ $ptItem = PtItemClass::getById($ptItemId, true);
|
|
|
+ if (empty($ptItem)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $ptItem->name = $product->name ?? '';
|
|
|
+ $ptItem->py = $product->py ?? '';
|
|
|
+ $ptItem->cover = $product->cover ?? '';
|
|
|
+ $ptItem->ratio = $product->ratio ?? 1;
|
|
|
+ $ptItem->shelfLife = $product->shelfLife ?? 7;
|
|
|
+ $ptItem->weight = $product->weight ?? 0.1;
|
|
|
+ $ptItem->stockWarning = $product->stockWarning ?? 5;;
|
|
|
+ $ptItem->cost = $product->cost ?? 1;
|
|
|
+ $ptItem->addPrice = 5;
|
|
|
+ $ptItem->bigUnit = $product->bigUnit;
|
|
|
+ $ptItem->smallUnit = $product->smallUnit;
|
|
|
+ $ptItem->bigUnitId = $product->bigUnitId;
|
|
|
+ $ptItem->smallUnitId = $product->smallUnitId;
|
|
|
+ $ptItem->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//花材初始化 ./yii item/init
|
|
|
public function actionInit()
|
|
|
{
|