request->get('ghsId', 0); $ghs = GhsClass::getById($ghsId); if (empty($ghs)) { util::fail('没有供货商信息'); } if ($ghs['ownMainId'] != $this->mainId) { util::fail('不是你的供货商'); } $shopId = $ghs['shopId'] ?? 0; $mainId = $ghs['mainId'] ?? 0; if (!in_array($shopId, [36523, 0])) { util::success([]); } try { $customId = $ghs['customId'] ?? 0; $configs = ShMethodClass::getAllConfigs($shopId, $mainId); if (isset($ghs['homeRule']) && $ghs['homeRule'] == 1) { foreach ($configs as &$config) { if ($config['style'] == 0) { $config['status'] = $ghs['home'] ?? 0; $config['minAmount'] = $ghs['homeAmount'] ?? 0; $config['minNum'] = $ghs['homeNum'] ?? 0; $config['unMeet'] = $ghs['homeUnMeet'] ?? 0; $config['unMeetFee'] = $ghs['homeUnFee'] ?? 0; } } } if ($customId > 0) { foreach ($configs as &$config) { $style = (int)($config['style'] ?? 0); $unMeet = (int)($config['unMeet'] ?? 0); // 针对每个配送方式分别检查是否已支付运费或包装费 $hasPaidSendCost = ShMethodClass::isSendCostPaidToday($customId, $style); $hasPaidPackCost = ShMethodClass::isPackPaidToday($customId, $style); // 如果是加收运费或加收包装费,并且今天已经收过对应的费用 // 则将前端展示的条件清空(设为0),从而不再显示要收附加费的提示 if ($unMeet === 0 && $hasPaidSendCost) { $config['minAmount'] = 0; $config['minNum'] = 0; $config['unMeetFee'] = 0; } elseif ($unMeet === 1 && $hasPaidPackCost) { $config['minAmount'] = 0; $config['minNum'] = 0; $config['unMeetFee'] = 0; } } } util::success(['method' => $configs]); } catch (\Exception $e) { util::fail($e->getMessage()); } } }