request->get(); $name = isset($get['name']) && !empty($get['name']) ? $get['name'] : ''; if (empty($name)) { util::fail('请填写名称'); } $connection = Yii::$app->db; $transaction = $connection->beginTransaction(); try { $apply['name'] = $name; $apply['style'] = SjClass::STYLE_KM_SUPPLIER; $has = SjClass::getByCondition(['name' => $name]); if (!empty($has)) { util::fail('名称已经存在'); } MerchantService::initSjInfo($apply); $transaction->commit(); util::complete(); } catch (\Exception $exception) { Yii::info("添加商家失败:" . $exception->getMessage()); util::fail('操作失败'); } } //商家列表 ssh 2019.12.20 public function actionList() { $get = Yii::$app->request->get(); $where = ['delStatus' => 0]; if (isset($get['name']) && !empty($get['name'])) { $where['name'] = ['like', $get['name']]; } $list = MerchantService::getMerchantList($where); util::success($list); } }