CustomController.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\admin\classes\AdminRoleClass;
  4. use biz\ghs\classes\GhsClass;
  5. use biz\shop\classes\ShopAdminClass;
  6. use biz\sj\classes\SjClass;
  7. use bizGhs\custom\classes\CustomClass;
  8. use bizGhs\custom\services\CustomService;
  9. use bizGhs\merchant\classes\WlClass;
  10. use bizGhs\order\classes\OrderClass;
  11. use bizHd\saas\classes\ApplyClass;
  12. use bizHd\saas\services\ApplyService;
  13. use bizHd\shop\classes\ShopClass;
  14. use bizHd\stat\classes\StatVisitClass;
  15. use common\components\dict;
  16. use common\components\imgUtil;
  17. use common\components\stringUtil;
  18. use common\components\util;
  19. use Yii;
  20. class CustomController extends BaseController
  21. {
  22. //修改花店散客身份 ssh 20230216
  23. public function actionChangeIsHd()
  24. {
  25. $get = Yii::$app->request->get();
  26. $id = $get['customId'] ?? 0;
  27. $isHd = $get['isHd'] ?? 1;
  28. $custom = CustomClass::getById($id, true);
  29. if (empty($custom)) {
  30. util::fail('没有找到客户');
  31. }
  32. if ($custom->ownMainId != $this->mainId) {
  33. util::fail('没有权限');
  34. }
  35. $ghsId = $custom->ghsId ?? 0;
  36. $ghs = GhsClass::getById($ghsId, true);
  37. if (empty($ghs)) {
  38. util::fail('修改失败了');
  39. }
  40. $ghs->isHd = $isHd;
  41. $ghs->save();
  42. $custom->isHd = $isHd;
  43. $custom->save();
  44. util::complete('修改成功');
  45. }
  46. //修改物流名称 ssh 20230112
  47. public function actionChangeWlName()
  48. {
  49. $get = Yii::$app->request->get();
  50. $id = $get['id'] ?? 0;
  51. $wlName = $get['wlName'] ?? 0;
  52. $custom = CustomClass::getById($id, true);
  53. if (empty($custom) || $custom->ownMainId != $this->mainId) {
  54. util::fail('修改失败');
  55. }
  56. $ghsId = $custom->ghsId ?? 0;
  57. $ghs = GhsClass::getById($ghsId, true);
  58. if (empty($ghs)) {
  59. util::fail('修改失败');
  60. }
  61. $ghs->customWlName = $wlName;
  62. $ghs->save();
  63. $custom->wlName = $wlName;
  64. $custom->save();
  65. util::complete('已修改');
  66. }
  67. //修改物流信息 ssh 20230105
  68. public function actionChangeWl()
  69. {
  70. util::fail('修改失败');
  71. }
  72. //修改名称 ssh 2022096
  73. public function actionChangeName()
  74. {
  75. $get = Yii::$app->request->get();
  76. $name = $get['name'] ?? '';
  77. $id = $get['id'] ?? 0;
  78. if (empty($name)) {
  79. util::fail('请填写名称');
  80. }
  81. $py = stringUtil::py($name);
  82. $custom = CustomClass::getById($id, true);
  83. CustomClass::valid($custom, $this->shopId);
  84. $custom->name = $name;
  85. $custom->py = $py;
  86. $custom->save();
  87. OrderClass::updateByCondition(['customId' => $id], ['customName' => $name, 'customNamePy' => $py]);
  88. $customShopId = $custom->shopId ?? 0;
  89. //在首店修改客户名称,直营店自动同步
  90. $masterShop = $this->shop;
  91. if (isset($masterShop->default) && $masterShop->default == 1) {
  92. $sjId = $masterShop->sjId ?? 0;
  93. $shopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
  94. foreach ($shopList as $shop) {
  95. $shopId = $shop->id ?? 0;
  96. if (isset($shop->join) && $shop->join == 1) {
  97. //加盟店不同步修改
  98. continue;
  99. }
  100. if ($shopId == $masterShop->id) {
  101. //前面已经同步修改过了
  102. continue;
  103. }
  104. $custom = CustomClass::getByCondition(['ownShopId' => $shopId, 'shopId' => $customShopId], true);
  105. if (empty($custom)) {
  106. continue;
  107. }
  108. $custom->name = $name;
  109. $custom->py = $py;
  110. $custom->save();
  111. }
  112. }
  113. util::complete('修改成功');
  114. }
  115. //帮客户添加员工 ssh 20220613
  116. public function actionAddStaff()
  117. {
  118. $post = Yii::$app->request->post();
  119. $customId = $post['id'] ?? 0;
  120. $mobile = $post['mobile'] ?? 0;
  121. if (stringUtil::isMobile($mobile) == false) {
  122. util::fail('手机号填写错误');
  123. }
  124. $info = CustomService::getById($customId, true);
  125. CustomClass::valid($info, $this->shopId);
  126. $connection = Yii::$app->db;
  127. $transaction = $connection->beginTransaction();
  128. try {
  129. $shopId = $info->shopId ?? 0;
  130. $customShop = ShopClass::getById($shopId, true);
  131. if (empty($customShop)) {
  132. util::fail('没有找到客户的门店');
  133. }
  134. $mainId = $customShop->mainId ?? 0;
  135. $ptStyle = dict::getDict('ptStyle', 'hd');
  136. $adminInfo = ['name' => $mobile, 'mobile' => $mobile, 'style' => $ptStyle, 'currentShopId' => $shopId];
  137. $fromApp = dict::getDict('userSourceGetId', 'app', 'id');
  138. $admin = \bizGhs\admin\classes\AdminClass::replaceAdmin($adminInfo, $fromApp);
  139. $roleList = AdminRoleClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
  140. if (empty($roleList)) {
  141. util::fail('客户门店没有员工角色');
  142. }
  143. $currentRoleId = 0;
  144. foreach ($roleList as $role) {
  145. $roleId = $role->id ?? 0;
  146. $currentRoleId = $roleId;
  147. if ($role->roleName == '员工') {
  148. break;
  149. }
  150. }
  151. $params = [
  152. 'shopId' => $shopId,
  153. 'mobile' => $mobile,
  154. 'roleId' => $currentRoleId,
  155. ];
  156. \bizHd\staff\classes\StaffClass::appGenerateStaff($params, $admin);
  157. $transaction->commit();
  158. util::complete('添加成功');
  159. } catch (\Exception $e) {
  160. $transaction->rollBack();
  161. util::fail('添加失败');
  162. }
  163. }
  164. //添加新花店 ssh 2021.1.8
  165. public function actionAdd()
  166. {
  167. $post = Yii::$app->request->post();
  168. $post['style'] = SjClass::STYLE_RETAIL;
  169. $post['introSjId'] = $this->sjId;
  170. $post['introStyle'] = SjClass::STYLE_SUPPLIER;
  171. $mobile = $post['mobile'] ?? '';
  172. $confirmMobile = $post['confirmMobile'];
  173. $address = $post['address'] ?? '';
  174. util::fail('功能已停用');
  175. if (stringUtil::isMobile($mobile) == false) {
  176. util::fail(' 请填写正确的手机号');
  177. }
  178. if ($mobile != $confirmMobile) {
  179. util::fail('二次号码填写不一致');
  180. }
  181. $name = $post['name'] ?? '';
  182. if (empty($name)) {
  183. util::fail('名称不能为空');
  184. }
  185. if (stringUtil::getWordNum($name) > 8) {
  186. util::fail('名称不能超过8个汉字');
  187. }
  188. $has = SjClass::getByCondition(['name' => $name, 'style' => SjClass::STYLE_RETAIL]);
  189. if (!empty($has)) {
  190. util::fail('名称已经存在');
  191. }
  192. $has = ApplyClass::getByCondition(['mobile' => $mobile, 'style' => SjClass::STYLE_RETAIL]);
  193. if (!empty($has)) {
  194. util::fail('手机号已经添加过');
  195. }
  196. if (empty($address)) {
  197. util::fail('请填写地址');
  198. }
  199. $connection = Yii::$app->db;
  200. $transaction = $connection->beginTransaction();
  201. try {
  202. $shop = $this->shop;
  203. $sjId = $this->sjId;
  204. $shopId = $this->shopId;
  205. $sjName = $this->sj->name ?? '';
  206. $city = $shop->city ?? '';
  207. $dist = $shop->dist ?? '';
  208. $applyData = [
  209. 'name' => $name,
  210. 'licenseNo' => $mobile,
  211. 'certType' => ApplyClass::CERT_TYPE_MOBILE,
  212. 'mobile' => $mobile,
  213. 'introSjId' => $sjId,
  214. 'introSjName' => $sjName,
  215. 'introShopId' => $shopId,
  216. 'introStyle' => SjClass::STYLE_SUPPLIER,
  217. 'from' => ApplyClass::FROM_GHS,
  218. 'style' => SjClass::STYLE_RETAIL,
  219. 'province' => $shop->province ?? '',
  220. 'city' => $city,
  221. 'dist' => $dist,
  222. 'address' => $address,
  223. 'status' => ApplyClass::STATUS_PASS,
  224. 'replace' => 1,//1表示供货商添加的客户
  225. ];
  226. $apply = ApplyService::replaceRetail($applyData);
  227. $id = $apply['id'] ?? 0;
  228. $respond = ApplyService::pass($id);
  229. $shop = $respond['shop'] ?? [];
  230. $sj = $respond['sj'] ?? [];
  231. $hdSjId = $sj['id'] ?? 0;
  232. $hdShopId = $shop->id ?? 0;
  233. ApplyClass::updateById($id, ['sjId' => $hdSjId, 'shopId' => $hdShopId]);
  234. if (empty($hdShopId)) {
  235. util::fail('客户没有添加成功!');
  236. }
  237. $custom = CustomClass::build($this->shopId, $hdShopId);
  238. $custom['avatar'] = imgUtil::groupImg($custom['avatar']);
  239. //客户欠款额度设置
  240. $debt = isset($post['debt']) && $post['debt'] == CustomClass::IS_DEBT_YES ? CustomClass::IS_DEBT_YES : CustomClass::IS_DEBT_NO;
  241. $customId = $custom['id'] ?? 0;
  242. $debtLimit = isset($post['debtLimit']) && is_numeric($post['debtLimit']) ? $post['debtLimit'] : 5000;
  243. CustomClass::updateById($customId, ['debtLimit' => $debtLimit, 'debt' => $debt]);
  244. $transaction->commit();
  245. util::success($custom);
  246. } catch (\Exception $exception) {
  247. $transaction->rollBack();
  248. Yii::info("添加客户没有成功:" . $exception->getMessage());
  249. util::fail('添加客户没有成功');
  250. }
  251. }
  252. //向队列写入新花店数据 shizhongqi 2022.6.8
  253. public function actionCreateCustomers()
  254. {
  255. $post = Yii::$app->request->post();
  256. $arr = [];
  257. for ($i = 1; $i <= 5; $i++) {
  258. $name = $post['name' . $i] ?? '';
  259. $mobile = $post['mobile' . $i] ?? '';
  260. $confirmMobile = $post['confirmMobile' . $i] ?? '';
  261. if (empty($name) && empty($mobile) && empty($confirmMobile)) {
  262. continue;
  263. }
  264. if (empty($name)) {
  265. util::fail('花店名称不能为空');
  266. }
  267. $has = SjClass::getByCondition(['name' => $name]);
  268. if (!empty($has)) {
  269. //util::fail($name . ' 这个名称已经被别人使用了');
  270. }
  271. if (stringUtil::getWordNum($name) > 8) {
  272. util::fail('名称不能超过8个汉字');
  273. }
  274. if (empty($mobile)) {
  275. util::fail($name . " 手机号不能为空");
  276. }
  277. if (stringUtil::isMobile($mobile) == false) {
  278. util::fail($name . " 手机号格式不正确");
  279. }
  280. if ($mobile != $confirmMobile) {
  281. util::fail($name . " 二次手机号不一致");
  282. }
  283. $hasShop = ShopClass::getByCondition(['mobile' => $mobile], true);
  284. if (!empty($hasShop)) {
  285. $shop = ShopClass::getByCondition(['mobile' => $mobile, 'ptStyle' => 1], true);
  286. if (!empty($shop)) {
  287. $ghsShopId = $this->shopId;
  288. $hdShopId = $shop->id;
  289. CustomClass::build($ghsShopId, $hdShopId);
  290. util::complete($shop->merchantName . ' 添加成功');
  291. }
  292. util::fail($mobile . "手机号已经添加过了");
  293. }
  294. $has = ApplyClass::getByCondition(['mobile' => $mobile]);
  295. if (!empty($has)) {
  296. util::fail($mobile . "手机号已经申请添加过了");
  297. }
  298. $arr[] = ['name' => $name, 'mobile' => $mobile];
  299. }
  300. if (empty($arr)) {
  301. util::fail('请填写客户');
  302. }
  303. foreach ($arr as $item) {
  304. $name = $item['name'] ?? '';
  305. $mobile = $item['mobile'] ?? '';
  306. //队列方式去处理
  307. $customerCachedKey = 'batch_create_customer_list';
  308. $value = $name . '_' . $mobile . '_' . $this->sjId . '_' . $this->shop->id . '_' . $this->sj->name . '_' . $this->shopAdminId;
  309. Yii::$app->redis->executeCommand('LPUSH', [$customerCachedKey, $value]);
  310. Yii::info("供货商添加客户:name - " . $name . ' == mobile - ' . $mobile);
  311. Yii::info("shopAdminId: " . $this->shopAdminId);
  312. }
  313. util::complete('已添加,1分钟后生效');
  314. }
  315. //从其它店同步客户 shizhongqi 2022.6.9
  316. public function actionCopyCustomers()
  317. {
  318. $get = Yii::$app->request->get();
  319. $fromShopId = $get['fromShopId'] ?? 0;
  320. $fromShop = ShopClass::getById($fromShopId, true);
  321. if (empty($fromShop)) {
  322. util::fail('门店不存在');
  323. }
  324. $toShopId = $this->shopId;
  325. if ($fromShopId == $toShopId) {
  326. util::fail('本店无需同步');
  327. }
  328. $fromShopName = $fromShop->shopName ?? '';
  329. if ($fromShop->syncCustom == 0) {
  330. util::fail('不允许从' . $fromShopName . '同步客户');
  331. }
  332. $toShop = $this->shop;
  333. $toShopName = $toShop->shopName ?? '';
  334. if ($toShop->syncCustom == 0) {
  335. util::fail($toShopName . '已关闭同步功能');
  336. }
  337. $toSjId = $toShop->sjId ?? 0;
  338. $fromSjId = $fromShop->sjId ?? 0;
  339. if ($toSjId != $fromSjId) {
  340. util::fail('不是您的门店');
  341. }
  342. $cachedKey = 'copy_other_shop_customers';
  343. Yii::$app->redis->executeCommand('LPUSH', [$cachedKey, $toShopId . '_' . $fromShopId]);
  344. Yii::info("从其他门店同步客户:目标门店id = " . $toShopId . ' 来源门店id = ' . $fromShopId);
  345. util::complete('已提交,1分钟后生效');
  346. }
  347. //客户列表 ssh 2021.7.8
  348. public function actionList()
  349. {
  350. $get = Yii::$app->request->get();
  351. $type = isset($get['type']) ? $get['type'] : 0;
  352. $name = isset($get['name']) ? $get['name'] : '';
  353. $mainId = $this->mainId;
  354. $isCashier = $get['isCashier'] ?? 0;
  355. if ($isCashier == 1) {
  356. //去掉收银台提示价格更新
  357. $staffId = $this->shopAdminId;
  358. Yii::$app->redis->executeCommand('DEL', ['ghs_cashier_' . $mainId . '_' . $staffId . '_may_refresh']);
  359. }
  360. $where = ['ownMainId' => $this->mainId];
  361. $sort = 'visitTime DESC';
  362. if ($type == 1) {
  363. //消费排行
  364. $sort = 'buyAmount DESC';
  365. } else if ($type == 2) {
  366. //欠款客户
  367. $where['isDebt'] = 1;
  368. $sort = 'debtAmount DESC';
  369. }
  370. $name = trim($name);
  371. if (!empty($name)) {
  372. if (is_numeric($name) && strlen($name) > 4) {
  373. if (stringUtil::isMobile($name)) {
  374. $where['mobile'] = $name;
  375. } else {
  376. $where['mobile'] = ['like', $name];
  377. }
  378. } else if (stringUtil::isLetter($name)) {
  379. $where['py'] = ['like', $name];
  380. } else {
  381. $where['name'] = ['like', $name];
  382. }
  383. }
  384. $list = CustomService::getCustomSortList($where, $sort);
  385. $main = $this->main;
  386. $list['totalUser'] = $main->totalUser ?? 0;
  387. $list['mayGatheringNum'] = $main->mayGatheringNum ?? 0;
  388. util::success($list);
  389. }
  390. //今日访客 ssh 20211022
  391. public function actionGetVisit()
  392. {
  393. $ids = StatVisitClass::getVisitCustomIds($this->shop);
  394. if (empty($ids)) {
  395. util::success(['list' => []]);
  396. }
  397. $sort = 'visitTime DESC';
  398. $where = ['id' => ['in', $ids]];
  399. $respond = CustomService::getCustomSortList($where, $sort);
  400. util::success($respond);
  401. }
  402. //客户详情 ssh 2021.1.8
  403. public function actionDetail()
  404. {
  405. $get = Yii::$app->request->get();
  406. $customId = $get['id'] ?? 0;
  407. $info = CustomService::getCustomInfo($customId);
  408. CustomClass::valid($info, $this->shopId);
  409. //手动添加的客户经纬度不完善不显示地址,引导完善客户地址
  410. if (isset($info['lat']) && empty($info['lat'])) {
  411. $info['address'] = '';
  412. }
  413. if (isset($info['long']) && empty($info['long'])) {
  414. $info['address'] = '';
  415. }
  416. $mainId = $info['mainId'] ?? 0;
  417. //超管的信息
  418. $superInfo = ShopAdminClass::getManager($mainId);
  419. $superName = $superInfo['name'] ?? '';
  420. $currentSuper = ['name' => $superName];
  421. $info['superInfo'] = $currentSuper;
  422. util::success($info);
  423. }
  424. //修改是否显示库存 ssh 20221022
  425. public function actionChangeShowStock()
  426. {
  427. $get = Yii::$app->request->get();
  428. $showStock = isset($get['showStock']) ? $get['showStock'] : 0;
  429. $customId = isset($get['customId']) ? $get['customId'] : 0;
  430. $custom = CustomClass::getById($customId, true);
  431. CustomClass::valid($custom, $this->shopId);
  432. $ghsId = $custom->ghsId ?? 0;
  433. $ghs = GhsClass::getById($ghsId, true);
  434. if (empty($ghs)) {
  435. util::fail('没有找到供货商');
  436. }
  437. $ghs->showStock = $showStock;
  438. $ghs->save();
  439. $custom->showStock = $showStock;
  440. $custom->save();
  441. util::complete();
  442. }
  443. //允许月结开关 ssh 2021.1.8
  444. public function actionDebt()
  445. {
  446. $get = Yii::$app->request->get();
  447. $debt = isset($get['debt']) ? $get['debt'] : 0;
  448. $customId = isset($get['customId']) ? $get['customId'] : 0;
  449. $custom = CustomClass::getById($customId);
  450. CustomClass::valid($custom, $this->shopId);
  451. CustomClass::debt($custom, $debt);
  452. util::complete();
  453. }
  454. //采购查看权限的黑白名单开关 shizhongqi 2021.08.08
  455. public function actionSetBlack()
  456. {
  457. $black = Yii::$app->request->get('black', 2);
  458. $customId = Yii::$app->request->get('customId', 0);
  459. $custom = CustomClass::getById($customId, true);
  460. CustomClass::valid($custom, $this->shopId);
  461. $custom->black = $black;
  462. $custom->save();
  463. $ghsId = $custom->ghsId ?? 0;
  464. $ghs = GhsClass::getById($ghsId, true);
  465. if (empty($ghs)) {
  466. util::fail('出错了');
  467. }
  468. $ghs->black = $black;
  469. $ghs->save();
  470. util::complete();
  471. }
  472. //欠款客户 ssh 2021.2.4
  473. public function actionDebtList()
  474. {
  475. $get = Yii::$app->request->get();
  476. $where = ['ownShopId' => $this->shopId, 'isDebt' => 1];
  477. if (isset($get['name']) && !empty($get['name'])) {
  478. $where['name'] = ['like', $get['name']];
  479. }
  480. $list = CustomService::getDebtList($where);
  481. //共X个客户,合计欠款XXX元
  482. $main = $this->main;
  483. $list['customNum'] = $main->mayGatheringNum ?? 0;
  484. $list['debtAmount'] = $main->mayGathering ?? 0.00;
  485. util::success($list);
  486. }
  487. //修改欠款额度 ssh 20210625
  488. public function actionUpdateDebtLimit()
  489. {
  490. $shopAdmin = $this->shopAdmin;
  491. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  492. util::fail('管理员才能操作');
  493. }
  494. $get = Yii::$app->request->get();
  495. $id = $get['id'] ?? 0;
  496. $debtLimit = $get['debtLimit'] ?? 0;
  497. if (is_numeric($debtLimit) == false || $debtLimit <= 0) {
  498. util::fail('请填写金额');
  499. }
  500. $custom = CustomClass::getById($id, true);
  501. CustomClass::valid($custom, $this->shopId);
  502. $custom->debtLimit = $debtLimit;
  503. $custom->save();
  504. util::complete();
  505. }
  506. //修改折扣 ssh 20210913
  507. public function actionChangeDiscount()
  508. {
  509. $shopAdmin = $this->shopAdmin;
  510. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  511. util::fail('管理员才能操作');
  512. }
  513. $get = Yii::$app->request->get();
  514. $id = $get['id'] ?? 0;
  515. $discount = $get['discount'] ?? 0;
  516. if (is_numeric($discount) == false || $discount > 1 || $discount == 0) {
  517. util::fail('请填写小数值');
  518. }
  519. $custom = CustomClass::getById($id, true);
  520. CustomClass::valid($custom, $this->shopId);
  521. $custom->discount = $discount;
  522. $custom->save();
  523. $ghsId = $custom->ghsId ?? 0;
  524. $ghs = GhsClass::getById($ghsId, true);
  525. $ghs->giveDiscount = $discount;
  526. $ghs->save();
  527. util::complete();
  528. }
  529. //修改客户等级 ssh 20211007
  530. public function actionChangeLevel()
  531. {
  532. $shopAdmin = $this->shopAdmin;
  533. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  534. util::fail('超管才能修改');
  535. }
  536. $get = Yii::$app->request->get();
  537. $customId = $get['customId'] ?? 0;
  538. $level = $get['level'] ?? 1;
  539. $custom = CustomClass::getById($customId, true);
  540. CustomClass::valid($custom, $this->shopId);
  541. $custom->level = $level;
  542. $custom->save();
  543. $ghsId = $custom->ghsId ?? 0;
  544. $ghs = GhsClass::getById($ghsId, true);
  545. if (empty($ghs)) {
  546. util::fail('出错了');
  547. }
  548. $ghs->giveLevel = $level;
  549. $ghs->save();
  550. $map = CustomClass::$levelMap;
  551. $name = $map[$level] ?? '';
  552. util::success(['levelName' => $name]);
  553. }
  554. }