shopId) || empty($this->mainId)) { util::fail('门店信息无效'); } try { $configs = PsMethodClass::getAllConfigs($this->shopId, $this->mainId); // 客户单独送货上门规则覆盖 style=0 if (!empty($this->custom) || !empty($this->hd)) { $customInfo = []; if (!empty($this->hd)) { $customInfo = is_array($this->hd) ? $this->hd : $this->hd->toArray(); } if (!empty($this->custom)) { $customInfo = array_merge($customInfo, is_array($this->custom) ? $this->custom : $this->custom->toArray()); } foreach ($configs as &$config) { if ((int)($config['style'] ?? 0) === 0) { $config = PsMethodClass::applyCustomHomeRule($config, $customInfo); } } unset($config); } // 今日已对附加费做过决策时,前端不再展示门槛加收(每日每客户每购买方式只收一次;首单未收则当日不再收) $customId = (int)($this->customId ?? 0); if ($customId > 0) { foreach ($configs as &$config) { $style = (int)($config['style'] ?? 0); $unMeet = (int)($config['unMeet'] ?? 0); $hasSendDecision = PsMethodClass::hasSendFeeDecisionToday($customId, $style); $hasPackDecision = PsMethodClass::hasPackFeeDecisionToday($customId, $style); $config['todaySendFeeLocked'] = $hasSendDecision ? 1 : 0; $config['todayPackFeeLocked'] = $hasPackDecision ? 1 : 0; if ($unMeet === 0 && $hasSendDecision) { $config['minAmount'] = 0; $config['minNum'] = 0; $config['unMeetFee'] = 0; } elseif ($unMeet === 2 && $hasPackDecision) { $config['minAmount'] = 0; $config['minNum'] = 0; $config['unMeetFee'] = 0; } } unset($config); } util::success(['method' => $configs]); } catch (\Exception $e) { util::fail($e->getMessage()); } } }