' => 0], null, '*', 'id'); $ghsList = GhsClass::getAllByCondition(['id>' => 0], null, '*', null, true); if (!empty($ghsList)) { foreach ($ghsList as $ghs) { $ownShopId = $ghs->ownShopId ?? 0; if (isset($shopList[$ownShopId]) == false) { echo "没有找到供货商门店\n"; continue; } $shop = $shopList[$ownShopId]; $ptStyle = $shop['ptStyle'] ?? 0; if (empty($ptStyle)) { echo "没有找到ptStyle \n"; continue; } $ghs->ownPtStyle = $ptStyle; $ghs->save(); echo "ok \n"; } } $customList = CustomClass::getAllByCondition(['id>' => 0], null, '*', null, true); if (!empty($customList)) { foreach ($customList as $custom) { $ownShopId = $custom->ownShopId ?? 0; if (isset($shopList[$ownShopId]) == false) { echo "没有找到客户门店\n"; continue; } $shop = $shopList[$ownShopId]; $ptStyle = $shop['ptStyle'] ?? 0; if (empty($ptStyle)) { echo "没有找到ptStyle \n"; continue; } $custom->ownPtStyle = $ptStyle; $custom->save(); echo "ok \n"; } } } //清空某个商户的product public function actionClearItem($sjId) { } public function actionPtUnit() { $res = ProductClass::getAllList("*", ""); foreach ($res as $v) { $id = $v['id']; $obigU = $v['bigUnit']; $oSmallU = $v['smallUnit']; $bigUname = xhItemService::getUnitName($obigU); $smallUName = xhItemService::getUnitName($oSmallU); $data = [ 'bigUnitId' => $obigU, 'smallUnitId' => $oSmallU, 'bigUnit' => $bigUname, 'smallUnit' => $smallUName, ]; ProductClass::updateById($id, $data); } echo "done"; } }