|
|
@@ -158,17 +158,13 @@ class ShopController extends BaseController
|
|
|
//显示和隐藏库存,同时影响到老客户和新注册客户 ssh 20250309
|
|
|
$showStock = $post['showStock'] ?? 0;
|
|
|
$shopId = $this->shopId;
|
|
|
- $customList = CustomClass::getAllByCondition(['ownShopId' => $shopId], null, '*', null, true);
|
|
|
+ $customList = CustomClass::getAllByCondition(['ownShopId' => $shopId], null, 'id,ghsId,ownShopId', null, true);
|
|
|
if (!empty($customList)) {
|
|
|
foreach ($customList as $key => $custom) {
|
|
|
$ghsId = $custom->ghsId ?? 0;
|
|
|
- $ghs = GhsClass::getById($ghsId, true);
|
|
|
- if (!empty($custom) && !empty($ghs)) {
|
|
|
- $ghs->showStock = $showStock;
|
|
|
- $ghs->save();
|
|
|
- $custom->showStock = $showStock;
|
|
|
- $custom->save();
|
|
|
- }
|
|
|
+ $customId = $custom->id;
|
|
|
+ CustomClass::updateById($customId, ['showStock' => $showStock]);
|
|
|
+ GhsClass::updateById($ghsId, ['showStock' => $showStock]);
|
|
|
}
|
|
|
}
|
|
|
|