request->get('style', 0); try { $config = ShMethodClass::getConfig($this->shopId, $this->mainId, $style); util::success($config); } catch (\Exception $e) { util::fail($e->getMessage()); } } /** * 获取门店所有的5种配送方式配置 * 如果数据库里没有,则取默认配置进行初始化 */ public function actionGetAllConfig() { try { $configs = ShMethodClass::getAllConfigs($this->shopId, $this->mainId); util::success($configs); } catch (\Exception $e) { util::fail($e->getMessage()); } } /** * 获取所有配送方式的排序和别名信息 */ public function actionGetSorts() { try { $sorts = ShMethodClass::getSorts($this->mainId); util::success($sorts); } catch (\Exception $e) { util::fail($e->getMessage()); } } /** * 保存指定配送方式的配置 * POST 参数: * - id: 配置ID(可选) * - style: 配送类型 (0: 送货, 1: 自取, 2: 跑腿, 3: 快递, 4: 物流) * - name: 名称 * - status: 状态 (0: 禁用, 1: 启用) * - sort: 排序 * - minAmount: 最低消费金额 * - minNum: 最低消费数量 * - unMeet: 不满条件处理方式 (0: 收运费, 1: 不能下单, 2: 收包装费) * - unMeetFee: 运费/包装费金额 * - startKm: 起步公里数 * - startPrice: 起步价格 * - perKmPrice: 超出起步每公里加价 * - changeRate: 临时涨价比例 (%) * - explains: 说明项列表 (二维数组,包含 explain, color, fontWeight, sort) * - reduceRules: 跑腿满减规则列表 (二维数组,包含 meetNum, meetAmount, freeKm, sort) */ public function actionSaveConfig() { $post = Yii::$app->request->post(); try { ShMethodClass::saveConfig($this->shopId, $this->mainId, $post); util::complete('保存成功'); } catch (\Exception $e) { util::fail($e->getMessage()); } } }