SettingController.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. <?php
  2. namespace addons\Store\client\controllers;
  3. use addons\Store\common\enums\StoreEnum;
  4. use addons\Store\common\models\Store;
  5. use addons\Store\common\models\StoreCate;
  6. use addons\Store\common\models\StoreFreightRules;
  7. use addons\Store\common\models\StoreGoodsModel;
  8. use addons\Store\common\models\StoreModel;
  9. use addons\Store\common\models\StoreScoreStoreApply;
  10. use addons\Store\common\models\StoreSettings;
  11. use addons\Store\common\models\StoreServiceRatioLog;
  12. use addons\Store\common\services\StoreSettingService;
  13. use common\enums\AddonsEnum;
  14. use common\enums\GoodsTypeEnum;
  15. use common\enums\StatusEnum;
  16. use common\globals\GlobalInvoke;
  17. use common\logic\common\AddonsLimit;
  18. use common\models\common\Region;
  19. use common\models\goods\FreightRules;
  20. use Yii;
  21. use addons\Store\common\models\StoreCommunity;
  22. use common\models\user\Town;
  23. class SettingController extends BaseController
  24. {
  25. public $enableCsrfValidation = false;
  26. public function actionIndex()
  27. {
  28. if (Yii::$app->request->isAjax) {
  29. if (Yii::$app->request->isGet) {
  30. $detail = Store::getOne([['id' => $this->store_id], ['mall_id' => $this->mall_id]], true);
  31. $detail['cIds'] = [];
  32. $detail['province'] = '';
  33. $detail['city'] = '';
  34. $detail['district'] = '';
  35. $setting = \Yii::$app->services->setting->addons->get($this->mall_id, StoreEnum::ADDONS_NAME, 'community_set');
  36. $detail['community_status'] = $setting['community_status']??0;
  37. if ($detail) {
  38. if (!empty($detail['c_id'])) {
  39. $cate = StoreCate::findOne(['mall_id' => $this->mall_id, 'id' => $detail['c_id']]);
  40. if (!empty($cate['parent_id'])) {
  41. $parent = StoreCate::findOne(['mall_id' => $this->mall_id, 'id' => $cate['parent_id']]);
  42. if (!empty($parent['parent_id'])) {
  43. $detail['cIds'][] = $parent['parent_id'];
  44. }
  45. $detail['cIds'][] = $cate['parent_id'];
  46. }
  47. $detail['cIds'][] = $detail['c_id'];
  48. }
  49. $region_id_arr = [$detail['province_id'], $detail['city_id'], $detail['district_id']];
  50. $region_list = Region::lists(['where' => [['id' => $region_id_arr]], 'index' => 'id', 'select' => 'id,name']);
  51. if (!empty($detail['province_id'])) {
  52. $detail['province'] = $region_list[$detail['province_id']]['name'];
  53. $detail['city'] = $region_list[$detail['city_id']]['name'];
  54. $detail['district'] = $region_list[$detail['district_id']]['name'];
  55. $streetInfo = Town::findOne(['id' => $detail['street_id']]);
  56. $detail['street'] = $streetInfo['name']??'';
  57. if($detail['community_id'] == '-1'){
  58. $detail['community'] = '其它社区';
  59. }else{
  60. $communityInfo = StoreCommunity::findOne(['street_id' => $detail['street_id'],'status'=>0]);
  61. $detail['community'] = $communityInfo['name']??'';
  62. }
  63. }
  64. }
  65. $detail['address_detail'] = $detail['address'] ?? '';
  66. $detail['ll'] = $detail['latitude'] . ',' . $detail['longitude'];
  67. if (!empty($detail['freight_type'])) {
  68. $detail['freight_type'] = json_decode($detail['freight_type'], true);
  69. } else {
  70. $detail['freight_type'] = [
  71. 'express_delivery' => 0,
  72. 'merchant_distribution' => 0,
  73. 'self_mention' => 0,
  74. ];
  75. }
  76. if (!empty($detail['intra_city_distribution'])) {
  77. $detail['intra_city_distribution'] = json_decode($detail['intra_city_distribution'], true);
  78. } else {
  79. $detail['intra_city_distribution'] = [];
  80. }
  81. if (!empty($detail['introduce'])) {
  82. $detail['introduce'] = json_decode($detail['introduce'], true);
  83. } else {
  84. $detail['introduce'] = [];
  85. }
  86. if (!empty($detail['bannar_pic'])) {
  87. $detail['bannar_pic'] = json_decode($detail['bannar_pic'], true);
  88. } else {
  89. $detail['bannar_pic'] = [];
  90. }
  91. if (!isset($detail['show_style'])) {
  92. $detail['show_style'] = "1";
  93. }
  94. if (isset($detail['pickup'])) {
  95. $detail['pickup'] = json_decode($detail['pickup'], true);
  96. } else {
  97. $detail['pickup'] = ['status' => 0];
  98. }
  99. $platform_address = \Yii::$app->services->setting->addons->get($this->mall_id, StoreEnum::ADDONS_NAME, 'basic.platform_address');
  100. $detail['platform_address'] = $platform_address ?? '';
  101. $decoration = \Yii::$app->services->setting->addons->get($this->mall_id, StoreEnum::ADDONS_NAME, 'decoration');
  102. $custom_store_style = $decoration['custom_store_style']??0;
  103. return $this->success('操作成功', ['detail' => $detail,'custom_store_style'=>$custom_store_style]);
  104. }
  105. if (Yii::$app->request->isPost) {
  106. $params = Yii::$app->request->post();
  107. $params['form']['id'] = $this->store_id;
  108. $params['form']['mall_id'] = $this->mall_id;
  109. // $params['form']['check_status'] = 0;
  110. $params['form']['c_id'] = array_pop($params['form']['cIds']);
  111. $businessTimeStart = strtotime($params['form']['business_time_start']);
  112. $businessTimeEnd = strtotime($params['form']['business_time_end']);
  113. $res = Store::setData($params['form']);
  114. if ($res == false) return $this->success(Store::getStaticError());
  115. return $this->success('操作成功');
  116. }
  117. }
  118. return $this->render($this->action->id);
  119. }
  120. public function actionGoodsModel()
  121. {
  122. // 获取组件配置
  123. $basic = \Yii::$app->services->setting->addons->get($this->mall_id, StoreEnum::ADDONS_NAME, 'basic');
  124. $addons_setting = AddonsLimit::getGlobalSetting($this->mall_id);
  125. $addons_arr = [];
  126. if (!empty($basic['store_agent_status'])) $addons_arr[] = AddonsEnum::ADDONS_NAME_AGENT;
  127. if (!empty($basic['store_area_status'])) $addons_arr[] = AddonsEnum::ADDONS_NAME_AREA;
  128. if (!empty($basic['store_distribution_status'])) $addons_arr[] = AddonsEnum::ADDONS_NAME_DISTRIBUTION;
  129. if (!empty($basic['store_rebate_status'])) $addons_arr[] = AddonsEnum::ADDONS_NAME_REBATE;
  130. if ($addons_setting) {
  131. foreach ($addons_setting as $key => $val) {
  132. if (!in_array($key, $addons_arr)) unset($addons_setting[$key]);
  133. }
  134. } else {
  135. $addons_setting = [];
  136. }
  137. if (\Yii::$app->request->isAjax) {
  138. if (\Yii::$app->request->isGet) {
  139. // 获取商品详情
  140. $goods_model = StoreModel::getOne([['mall_id' => $this->mall_id, 'store_id' => $this->store_id]], true);
  141. $content = [];
  142. if (!empty($goods_model['content'])) {
  143. $content = json_decode($goods_model['content'], true);
  144. }
  145. // 获取配置
  146. foreach ($content as $key => &$item) {
  147. if (isset($content[$key])) {
  148. $setting[$key] = $content[$key];
  149. }
  150. }
  151. // 获取等级
  152. $level_params = ['where' => [['=', 'mall_id', $this->mall_id], ['=', 'status', StatusEnum::ENABLED]], 'select' => 'level,name'];
  153. $level_params['mall_id'] = $this->mall_id;
  154. $level = GlobalInvoke::exec(GlobalInvoke::GOODS_MODEL_LEVEL, $this->mall_id, $level_params);
  155. $commission_type_map = GoodsTypeEnum::getCommissionTypeMap($this->mall_id);
  156. unset($commission_type_map['digital']);
  157. $status = $goods_model['status'];
  158. return $this->success('操作成功', compact('status', 'level', 'setting', 'commission_type_map'));
  159. } else {
  160. $store_setting = StoreSettings::findOne(['store_id'=>$this->store_id,'mall_id'=>$this->mall_id, 'status' => StatusEnum::ENABLED]);
  161. if(!empty($store_setting)){
  162. if($store_setting['store_settle_type']!=3 && $store_setting['store_settle_type']!=4){
  163. if(empty($store_setting['is_allow_editing'])) {
  164. return $this->error('分佣由平台承担,门店无权编辑');
  165. }
  166. }
  167. }else{
  168. if($basic['settle_type']!=3 && $basic['settle_type']!=4){
  169. return $this->error('分佣由平台承担,门店无权编辑');
  170. }
  171. }
  172. $params = Yii::$app->request->post('form');
  173. $status = 0;
  174. if (!empty($params['status'])) {
  175. $status = $params['status'];
  176. unset($params['status']);
  177. }
  178. $res = Yii::$app->services->validate->validate($params, [
  179. [array_keys($addons_setting), 'string']
  180. ]);
  181. if ($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
  182. try {
  183. if(isset($params['Agent'])) $params['Agent'] = json_decode($params['Agent'] ,true);
  184. if(isset($params['Distribution'])) $params['Distribution'] = json_decode($params['Distribution'] ,true);
  185. if(isset($params['Area'])) $params['Area'] = json_decode($params['Area'] ,true);
  186. if(isset($params['Rebate'])) $params['Rebate'] = json_decode($params['Rebate'] ,true);
  187. $param = [
  188. 'mall_id' => $this->mall_id,
  189. 'store_id' => $this->store_id,
  190. 'status' => $status,
  191. 'content' => json_encode($params),
  192. ];
  193. $res = StoreModel::setData($param);
  194. if ($res === false) return $this->error(StoreGoodsModel::getStaticError());
  195. return $this->success("保存成功");
  196. } catch (\Exception $e) {
  197. return $this->error("保存失败,msg=" . $e->getMessage());
  198. }
  199. }
  200. }
  201. return $this->render($this->action->id, ['addons_setting' => $addons_setting]);
  202. }
  203. public function actionFreightRules()
  204. {
  205. if (Yii::$app->request->isAjax) {
  206. if (Yii::$app->request->isGet) {
  207. $keyword = Yii::$app->request->get('keyword', '');
  208. $where = [['mall_id' => $this->mall_id, 'store_id' => $this->store_id, 'status' => StatusEnum::ENABLED]];
  209. $keyword && $where[] = ['like', 'name', $keyword . '%', false];
  210. $order = 'id desc';
  211. $params = compact('where', 'order');
  212. $page_data = StoreFreightRules::listPage($params);
  213. if ($page_data === false) return $this->error(StoreFreightRules::getStaticError());
  214. return $this->success('操作成功', $page_data);
  215. } else {
  216. $form = Yii::$app->request->post();
  217. $rules = [[['id'], 'required'], [['id'], 'integer']];
  218. switch ($form['type']) {
  219. case 'destroy':
  220. $form['status'] = StatusEnum::DELETE;
  221. $rules[] = [['status'], 'required'];
  222. break;
  223. case 'default':
  224. $rules[] = [['is_default'], 'required'];
  225. break;
  226. }
  227. $res = Yii::$app->services->validate->validate($form, $rules);
  228. if ($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
  229. $form['mall_id'] = $this->mall_id;
  230. $form['store_id'] = $this->store_id;
  231. $res = StoreFreightRules::setData($form);
  232. if ($res === false) return $this->error(FreightRules::getStaticError());
  233. return $this->success('操作成功', []);
  234. }
  235. }
  236. return $this->render($this->action->id);
  237. }
  238. public function actionFreightEdit()
  239. {
  240. if (Yii::$app->request->isAjax) {
  241. if (Yii::$app->request->isGet) {
  242. $get = Yii::$app->request->get();
  243. $res = Yii::$app->services->validate->validate($get, [[['id'], 'required'], [['id'], 'integer']]);
  244. if ($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
  245. $detail = StoreFreightRules::getOne([['id' => $get['id'], 'mall_id' => $this->mall_id, 'store_id' => $this->store_id]], true);
  246. $detail['rule'] = json_decode($detail['rule'], true);
  247. return $this->success('操作成功', compact('detail'));
  248. } else {
  249. $id = Yii::$app->request->get('id');
  250. $form = Yii::$app->request->post('form');
  251. $res = Yii::$app->services->validate->validate($form, [
  252. [['id','select_com'], 'integer'],
  253. [['name', 'type', 'rule'], 'safe'],
  254. ]);
  255. if ($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage());
  256. $form['id'] = $id;
  257. $form['mall_id'] = $this->mall_id;
  258. $form['store_id'] = $this->store_id;
  259. $res = StoreFreightRules::setData($form);
  260. if ($res === false) return $this->error(StoreFreightRules::getStaticError());
  261. return $this->success('操作成功');
  262. }
  263. }
  264. return $this->render($this->action->id);
  265. }
  266. public function actionConfig()
  267. {
  268. if (\Yii::$app->request->isGet) {
  269. $decoration = \Yii::$app->services->setting->addons->get($this->mall_id, StoreEnum::ADDONS_NAME, 'decoration');
  270. $settings = [
  271. 'decoration' => $decoration,
  272. ];
  273. return $this->success('success', $settings);
  274. }
  275. }
  276. //todo 不用验证权限
  277. public function actionGetAddressList()
  278. {
  279. $get = Yii::$app->request->get();
  280. $level = $get['level'] ?? 1;
  281. if ($level > 3) {
  282. if ($level == 4) {
  283. $where[] = ['district_id' => $get['id']];
  284. $params['where'] = $where;
  285. $params['select'] = 'id,name';
  286. $list = Town::lists($params);
  287. } else {
  288. $where[] = ['mall_id' => $this->mall_id, 'street_id' => $get['id'],'status'=>0];
  289. $params['where'] = $where;
  290. $params['select'] = 'id,community_name as name';
  291. $list = StoreCommunity::lists($params);
  292. $data = ['id'=>'-1','name'=>'其它社区'];
  293. $list[] = $data;
  294. }
  295. } else {
  296. if (!empty($get['id'])) $where[] = ['parent_id' => $get['id']];
  297. $where[] = ['level' => $level];
  298. $params['where'] = $where;
  299. $params['select'] = 'id,name,parent_id,level,lng,lat';
  300. $list = Region::lists($params);
  301. }
  302. return $this->success('操作成功', $list);
  303. }
  304. public function actionStoreCateTree()
  305. {
  306. if (Yii::$app->request->isAjax) {
  307. if (Yii::$app->request->isGet) {
  308. $cond = [['mall_id' => $this->mall_id]];
  309. $list = StoreCate::getCates($cond, [], true, 'id,name,parent_id');
  310. $list = StoreCate::getTreeCate($list);
  311. return $this->success('操作成功', compact('list'));
  312. }
  313. }
  314. }
  315. /**
  316. * 客服管理
  317. * @return string
  318. */
  319. public function actionCustomer()
  320. {
  321. if (Yii::$app->request->isAjax) {
  322. if (Yii::$app->request->isGet) {
  323. $setting = StoreSettings::find()
  324. ->select(['is_customer', 'customer_types'])->where(['mall_id' => $this->mall_id,
  325. 'store_id' => $this->store_id,
  326. 'status' => StatusEnum::ENABLED]
  327. )->asArray()->one();
  328. if (!empty($setting['customer_types'])) $setting['customer_types'] = json_decode($setting['customer_types'], true);
  329. return $this->success("请求成功", ['setting' => $setting]);
  330. }
  331. if (Yii::$app->request->isPost) {// post提交
  332. $is_customer = Yii::$app->request->post('is_customer', 0);
  333. $customer_types = Yii::$app->request->post('customer_types', '');
  334. if (!empty($customer_types)) $customer_types = json_encode($customer_types);
  335. $setting = StoreSettings::findOne(['mall_id' => $this->mall_id,
  336. 'store_id' => $this->store_id,
  337. 'status' => StatusEnum::ENABLED]
  338. );
  339. if (!$setting) {
  340. $setting = new StoreSettings();
  341. }
  342. $setting->mall_id = $this->mall_id;
  343. $setting->store_id = $this->store_id;
  344. $setting->is_customer = $is_customer;
  345. $setting->customer_types = $customer_types;
  346. if (!$setting->save()) {
  347. return $this->error("保存失败");
  348. }
  349. return $this->success("保存成功");
  350. }
  351. }
  352. return $this->render($this->action->id);
  353. }
  354. public function actionScoreDeduction()
  355. {
  356. try {
  357. if (Yii::$app->request->isAjax) {
  358. if (Yii::$app->request->isGet) {
  359. $score_deduction = (new StoreSettingService(['mall_id'=>$this->mall_id,'store_id'=>$this->store_id]))->getScoreDeduction();
  360. return $this->success("请求成功", $score_deduction);
  361. }
  362. if (Yii::$app->request->isPost) {
  363. $params = Yii::$app->request->post();
  364. if(empty($params['score_give']['give_num'])){
  365. $params['score_give']['give_num'] = 0;
  366. }
  367. if(!empty($params['score_deduction']['max_deduction_percent'])) {
  368. $platform_score_deduction = \Yii::$app->services->setting->addons->get($this->mall_id, StoreEnum::ADDONS_NAME, 'payment.score_deduction');
  369. $platform_score_deduction = json_decode($platform_score_deduction, true);
  370. $platform_score_deduction['max_deduction_percent'] =
  371. !empty($platform_score_deduction['store_limit_type']) && isset($platform_score_deduction['store_limit_stores_deduction'][$this->store_id]) && is_numeric($platform_score_deduction['store_limit_stores_deduction'][$this->store_id]) ?
  372. $platform_score_deduction['store_limit_stores_deduction'][$this->store_id] : $platform_score_deduction['max_deduction_percent'];
  373. if (isset($platform_score_deduction['max_deduction_percent']) && $params['score_deduction']['max_deduction_percent'] > $platform_score_deduction['max_deduction_percent']) {
  374. return $this->error("独立设置的最高抵扣比例不能大于平台最高抵扣比例");
  375. }
  376. }
  377. (new StoreSettingService(['mall_id'=>$this->mall_id,'store_id'=>$this->store_id]))->updateScoreDeduction($params);
  378. return $this->success("保存成功");
  379. }
  380. }
  381. return $this->render($this->action->id);
  382. }catch (\Exception $e){
  383. return $this->error($e->getMessage());
  384. }
  385. }
  386. public function actionScoreGiveApply()
  387. {
  388. try {
  389. if (!Yii::$app->request->isPost) throw new \Exception("非法请求");
  390. $store = Store::findOne(['mall_id' => $this->mall_id, 'id' => $this->store_id, 'status' => StatusEnum::ENABLED]);
  391. if (empty($store)) throw new \Exception("门店信息有误");
  392. StoreScoreStoreApply::saveData([
  393. 'mall_id' => $this->mall_id,
  394. 'store_id' => $this->store_id,
  395. 'store_user_id' => $store->user_id,
  396. 'store_c_id' => $store->c_id,
  397. 'score_method' => 1
  398. ]);
  399. return $this->success("提交申请成功");
  400. }catch (\Exception $e){
  401. return $this->error($e->getMessage());
  402. }
  403. }
  404. public function actionScoreDeductionApply()
  405. {
  406. try {
  407. if (!Yii::$app->request->isPost) throw new \Exception("非法请求");
  408. $store = Store::findOne(['mall_id' => $this->mall_id, 'id' => $this->store_id, 'status' => StatusEnum::ENABLED]);
  409. if (empty($store)) throw new \Exception("门店信息有误");
  410. StoreScoreStoreApply::saveData([
  411. 'mall_id' => $this->mall_id,
  412. 'store_id' => $this->store_id,
  413. 'store_user_id' => $store->user_id,
  414. 'store_c_id' => $store->c_id,
  415. 'score_method' => 2
  416. ]);
  417. return $this->success("提交申请成功");
  418. }catch (\Exception $e){
  419. return $this->error($e->getMessage());
  420. }
  421. }
  422. public function actionServiceFee()
  423. {
  424. try {
  425. if (Yii::$app->request->isAjax) {
  426. if (Yii::$app->request->isGet) {
  427. $settings = StoreSettings::find()
  428. ->where([
  429. 'mall_id' => $this->mall_id,
  430. 'store_id' => $this->store_id,
  431. 'status' => StatusEnum::ENABLED,
  432. ])
  433. ->select('id,mall_id,store_id,store_service_fee,store_service_ratio')
  434. ->asArray()
  435. ->one();
  436. $basic = \Yii::$app->services->setting->addons->get($this->mall_id, StoreEnum::ADDONS_NAME, 'basic');
  437. if (empty($settings)) {
  438. $settings['store_service_fee'] = $basic['service_fee_type'];
  439. $settings['store_service_ratio'] = 0;
  440. }
  441. $settings['platform_service_fee_setting'] = [
  442. 'service_fee_type' => $basic['service_fee_type'],
  443. 'max_platform_ratio' => $basic['max_platform_ratio'],
  444. 'min_platform_ratio' => $basic['min_platform_ratio']
  445. ];
  446. return $this->success('success', $settings);
  447. }
  448. if (Yii::$app->request->isPost) {
  449. $data = \Yii::$app->request->post();
  450. $res = \Yii::$app->services->validate->validate($data, [
  451. [['store_service_ratio'], 'required'],
  452. [['store_service_ratio'], 'number'],
  453. ]);
  454. if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage());
  455. // $settings = StoreSettings::find()
  456. // ->where([
  457. // 'mall_id' => $this->mall_id,
  458. // 'store_id' => $this->store_id,
  459. // ])
  460. // ->select('id,mall_id,store_id,store_service_fee,store_service_ratio')
  461. // ->one();
  462. $settings = StoreSettings::setData($this->mall_id, [
  463. 'store_id' => $this->store_id,
  464. ]);
  465. if (!$settings) {
  466. return $this->error('数据不存在');
  467. }
  468. $basic = \Yii::$app->services->setting->addons->get($this->mall_id, StoreEnum::ADDONS_NAME, 'basic');
  469. if ($basic['service_fee_type'] == 1 && ($data['store_service_ratio'] > $basic['max_platform_ratio'] || $data['store_service_ratio'] < $basic['min_platform_ratio'])) {
  470. return $this->error('只能设置在平台服务费比例区间内的比例当前平台服务费比例:' . $basic['min_platform_ratio'] . '%~' . $basic['max_platform_ratio'] . '%');
  471. }
  472. $settings->store_service_fee = 1;
  473. $settings->store_service_ratio = $data['store_service_ratio'];
  474. if (!$settings->save()) {
  475. return $this->error('修改失败');
  476. }
  477. StoreServiceRatioLog::setData([
  478. 'mall_id' => $this->mall_id,
  479. 'store_id' => $this->store_id,
  480. 'before_store_service_ratio' => $settings['store_service_ratio'],
  481. 'after_store_service_ratio' => $data['store_service_ratio'],
  482. ]);
  483. return $this->success("操作成功");
  484. }
  485. }
  486. return $this->render($this->action->id);
  487. } catch (\Exception $e) {
  488. return $this->error($e->getMessage());
  489. }
  490. }
  491. }