CustomController.php 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152
  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 biz\wx\classes\WxMessageClass;
  8. use bizGhs\custom\classes\CustomClass;
  9. use bizGhs\custom\services\CustomService;
  10. use common\components\qrCodeUtil;
  11. use bizGhs\order\classes\OrderClass;
  12. use bizHd\saas\classes\ApplyClass;
  13. use bizHd\saas\services\ApplyService;
  14. use bizHd\shop\classes\ShopClass;
  15. //use bizHd\stat\classes\StatVisitClass;
  16. use bizGhs\stat\classes\StatVisitClass;
  17. use common\components\dict;
  18. use common\components\imgUtil;
  19. use common\components\orderSn;
  20. use common\components\stringUtil;
  21. use common\components\util;
  22. use Yii;
  23. class CustomController extends BaseController
  24. {
  25. //批量设置是否可看库存 ssh 20251031
  26. public function actionAllSetLookStock()
  27. {
  28. $get = Yii::$app->request->get();
  29. $showStock = $get['showStock'] ?? 0;
  30. $mainId = $this->mainId;
  31. CustomClass::updateByCondition(['ownMainId' => $mainId], ['showStock' => $showStock]);
  32. \bizGhs\ghs\classes\GhsClass::updateByCondition(['mainId' => $mainId], ['showStock' => $showStock]);
  33. util::complete('设置成功');
  34. }
  35. //批量设置是否可看销量 ssh 20251031
  36. public function actionAllSetLookSale()
  37. {
  38. $get = Yii::$app->request->get();
  39. $showSold = $get['showSold'] ?? 0;
  40. $shop = $this->shop;
  41. //没有配置到每个客户,只在总店有控制
  42. $shop->showSold = $showSold;
  43. $shop->save();
  44. util::complete('设置成功');
  45. }
  46. //批量授信 ssh 20251031
  47. public function actionAllCredit()
  48. {
  49. $staff = $this->shopAdmin;
  50. if ($staff->mobile != 15280215347) {
  51. util::fail('请管理员操作');
  52. }
  53. $get = Yii::$app->request->get();
  54. $amount = $get['amount'] ?? 0;
  55. $mainId = $this->mainId;
  56. CustomClass::updateByCondition(['ownMainId' => $mainId], ['debtLimit' => $amount]);
  57. util::complete('设置成功');
  58. }
  59. //客户设置相关 ssh 20250310
  60. public function actionSetChange()
  61. {
  62. $staff = $this->shopAdmin;
  63. if ($staff->founder != 2 && $staff->mobile != 15280215347) {
  64. util::fail('老板才能修改');
  65. }
  66. $post['homeAmount'] = !empty($post['homeAmount']) && is_numeric($post['homeAmount']) ? $post['homeAmount'] : 0;
  67. $post = Yii::$app->request->post();
  68. $shopId = $this->shopId;
  69. ShopClass::updateById($shopId, $post);
  70. $showStock = $post['showStock'] ?? 0;
  71. $arr = ['showStock' => $showStock];
  72. //如果新客需要审核,老的全部要打开为已经审核通过了
  73. $arr['passStatus'] = 1;
  74. CustomClass::updateByCondition(['ownShopId' => $shopId], $arr);
  75. GhsClass::updateByCondition(['shopId' => $shopId], $arr);
  76. util::complete('修改成功');
  77. }
  78. //获取收款码 ssh 20240530
  79. public function actionGetGatheringCode()
  80. {
  81. $get = Yii::$app->request->get();
  82. $id = $get['id'] ?? 0;
  83. $custom = CustomClass::getById($id, true);
  84. if (empty($custom)) {
  85. util::fail('没有找到客户');
  86. }
  87. if ($custom->ownMainId != $this->mainId) {
  88. util::fail('不是你的客户哈');
  89. }
  90. $ghsId = $custom->ghsId ?? 0;
  91. $salt = $custom->salt ?? '';
  92. //有多个地方要同步修改,关键词 custom_go_ghs_gathering_code
  93. if (getenv('YII_ENV') == 'production') {
  94. $url = "https://mall.huahb.cn/#/admin/ghs/pay?id={$ghsId}&salt={$salt}";
  95. } else {
  96. $url = "https://mall.huaml.com/#/admin/ghs/pay?id={$ghsId}&salt={$salt}";
  97. }
  98. $unique = "recharge_to_ghs_" . $id;
  99. $imgUrl = qrCodeUtil::generateRechargeQrCode($url, $unique);
  100. $imageUrl = imgUtil::groupImg($imgUrl);
  101. util::success(['imgUrl' => $imageUrl]);
  102. }
  103. //供货商给客户充值和结账 ssh 20240309
  104. public function actionRecharge()
  105. {
  106. ini_set('memory_limit', '2045M');
  107. set_time_limit(0);
  108. //避免重复提交
  109. $staffId = $this->shopAdminId;
  110. util::checkRepeatCommit($staffId, 5);
  111. $staff = $this->shopAdmin;
  112. if (isset($staff->finance) == false || $staff->finance == 0) {
  113. util::fail('无法充值销单。。。');
  114. }
  115. //多个地方需要同步修改clear_order_power
  116. if (getenv('YII_ENV') == 'production') {
  117. //小向花卉
  118. if (in_array($this->shopId, [23580, 24713])) {
  119. if (!in_array($this->adminId, [24043, 23960, 4])) {
  120. util::fail('不能销单哦!!');
  121. }
  122. }
  123. //花样年华只有总控才能结账
  124. if (in_array($this->shopId, [1585, 1596])) {
  125. if ($this->adminId != 2876) {
  126. util::fail('不能充值销单哦');
  127. }
  128. }
  129. //花大苪 洋桔梗,只有叶荷姐才能销账
  130. if (in_array($this->shopId, [16070])) {
  131. if (!in_array($this->adminId, [9303, 4])) {
  132. util::fail('不能充值销单哈');
  133. }
  134. }
  135. //恋善好多花控制销账权限
  136. if (in_array($this->shopId, [55238, 56609, 56611])) {
  137. if (!in_array($this->adminId, [43856, 54620])) {
  138. util::fail('暂无权限销单,请联系老板或财务');
  139. }
  140. }
  141. //天天鲜花 陈江店
  142. if (in_array($this->shopId, [763, 1405, 795])) {
  143. if (!in_array($this->adminId, [2094, 5959])) {
  144. util::fail('不能操作充值销单!');
  145. }
  146. }
  147. //花儿好仙
  148. if (in_array($this->shopId, [22666])) {
  149. if (!in_array($this->adminId, [12869, 23174])) {
  150. util::fail('不能充值销单哈');
  151. }
  152. }
  153. //小丽鲜花
  154. if (in_array($this->shopId, [11094])) {
  155. if (!in_array($this->adminId, [12073, 12296])) {
  156. util::fail('您不能充值销单哦');
  157. }
  158. }
  159. //源花汇
  160. if (in_array($this->shopId, [10649])) {
  161. if (!in_array($this->adminId, [11641, 11648, 4])) {
  162. util::fail('请闵总或小周操作');
  163. }
  164. }
  165. //昱成
  166. if (in_array($this->shopId, [8596])) {
  167. if (!in_array($this->adminId, [9303, 9601])) {
  168. util::fail('只能叶荷操作');
  169. }
  170. }
  171. //花大苪,多处请搜索关键词 hdb_clear_control
  172. if (in_array($this->shopId, [8249])) {
  173. if (!in_array($this->adminId, [9303])) {
  174. util::fail('只能叶荷和财务操作');
  175. }
  176. }
  177. //中山淘花里,销账权限控制,多处请搜索 thl_clear_control
  178. if (in_array($this->shopId, [17118])) {
  179. if (!in_array($this->adminId, [55494, 55445, 17908, 55459, 55707, 55709])) {
  180. util::fail('你不能销单哈。。');
  181. }
  182. }
  183. //小齐鲜花总店和出车,多处请搜索关键词 xq_clear_control
  184. if (in_array($this->shopId, [41467, 42946])) {
  185. if (!in_array($this->adminId, [40144, 42912, 42023])) {
  186. util::fail('您不能充值销单哦。');
  187. }
  188. }
  189. } else {
  190. if (in_array($this->shopId, [36523])) {
  191. if ($this->adminId != 919) {
  192. util::fail('暂不能操作充值销单哈');
  193. }
  194. }
  195. }
  196. $get = Yii::$app->request->get();
  197. $amount = $get['amount'] ?? 0;
  198. $customId = $get['customId'] ?? 0;
  199. $payWay = $get['payWay'] ?? -1;
  200. $remark = $get['remark'] ?? '';
  201. $rechargeType = $get['rechargeType'] ?? 0;
  202. if ($rechargeType == 0 && $payWay < 0) {
  203. util::fail('请选择付款方式');
  204. }
  205. if ($amount <= 0) {
  206. //util::fail('充值金额需要大于0');
  207. }
  208. //解决重复充值问题
  209. $cacheKey = 'help_custom_recharge_' . $customId;
  210. $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
  211. if (!empty($has)) {
  212. util::fail('已充值,请15秒后再操作');
  213. return false;
  214. }
  215. Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 15, 'has']);
  216. $custom = CustomClass::getLockById($customId);
  217. if (empty($custom)) {
  218. util::fail('没有找到客户');
  219. }
  220. if ($custom->ownMainId != $this->mainId) {
  221. util::fail('不是你的客户,无法充值');
  222. }
  223. $customShopId = $custom->shopId ?? 0;
  224. $shop = $this->shop;
  225. if ($customShopId == $shop->lsShopId) {
  226. util::fail('不能给自己充值');
  227. }
  228. $connection = Yii::$app->db;
  229. $transaction = $connection->beginTransaction();
  230. try {
  231. $staff = $this->shopAdmin;
  232. $params = ['remark' => $remark, 'rechargeType' => $rechargeType];
  233. $recharge = CustomService::rechargeClear($custom, $amount, $this->shop, $staff, $payWay, $params);
  234. $transaction->commit();
  235. WxMessageClass::customRechargeClearInform($shop, $recharge);
  236. util::complete('充值成功');
  237. } catch (\Exception $e) {
  238. Yii::info("充值失败原因:" . $e->getMessage());
  239. $transaction->rollBack();
  240. util::fail('充值失败');
  241. }
  242. }
  243. //生成货位号 ssh 20231215
  244. public function actionCreateSeatSn()
  245. {
  246. $get = Yii::$app->request->get();
  247. $id = $get['id'] ?? 0;
  248. $custom = CustomClass::getById($id, true);
  249. if ($custom->ownMainId != $this->mainId) {
  250. util::fail('不是您的客户');
  251. }
  252. $seatSn = $custom->seatSn ?? '';
  253. if (!empty($seatSn)) {
  254. util::fail('已经有货位号了');
  255. }
  256. $new = CustomClass::createSeatSn($this->mainId);
  257. $custom->seatSn = $new;
  258. $custom->save();
  259. //预订相关表的货位同步
  260. $shop = $this->shop;
  261. CustomClass::syncBookSeat($shop, $custom, $new);
  262. util::complete('已生成');
  263. }
  264. //修改货位号 ssh 20231215
  265. public function actionModifySeatSn()
  266. {
  267. $get = Yii::$app->request->get();
  268. $id = $get['id'] ?? 0;
  269. $new = $get['seatSn'] ?? 0;
  270. $custom = CustomClass::getById($id, true);
  271. if ($custom->ownMainId != $this->mainId) {
  272. util::fail('不是您的客户');
  273. }
  274. if (is_numeric($new) == false) {
  275. util::fail('请填写数字');
  276. }
  277. $custom->seatSn = $new;
  278. $custom->save();
  279. //预订相关表的货位同步
  280. $shop = $this->shop;
  281. CustomClass::syncBookSeat($shop, $custom, $new);
  282. util::complete('修改成功');
  283. }
  284. //修改客户地址 ssh 20230929
  285. public function actionModifyAddress()
  286. {
  287. $post = Yii::$app->request->post();
  288. $id = $post['id'] ?? 0;
  289. unset($post['id']);
  290. $custom = CustomClass::getById($id, true);
  291. if ($custom->ownMainId != $this->mainId) {
  292. util::fail('不是您的客户哦');
  293. }
  294. $city = $post['city'] ?? '';
  295. $dist = $post['dist'] ?? '';
  296. $address = $post['address'] ?? '';
  297. $floor = $post['floor'] ?? '';
  298. $post['fullAddress'] = $city . $dist . $address . $floor;
  299. $shopId = $custom->shopId ?? 0;
  300. ShopClass::updateById($shopId, $post);
  301. CustomClass::updateByCondition(['shopId' => $shopId], $post);
  302. util::complete('修改成功');
  303. }
  304. //修改花店散客身份 ssh 20230216
  305. public function actionChangeIsHd()
  306. {
  307. $get = Yii::$app->request->get();
  308. $id = $get['customId'] ?? 0;
  309. $isHd = $get['isHd'] ?? 1;
  310. $custom = CustomClass::getById($id, true);
  311. if (empty($custom)) {
  312. util::fail('没有找到客户');
  313. }
  314. if ($custom->ownMainId != $this->mainId) {
  315. util::fail('没有权限');
  316. }
  317. $ghsId = $custom->ghsId ?? 0;
  318. $ghs = GhsClass::getById($ghsId, true);
  319. if (empty($ghs)) {
  320. util::fail('修改失败了');
  321. }
  322. $ghs->isHd = $isHd;
  323. $ghs->save();
  324. $custom->isHd = $isHd;
  325. $custom->save();
  326. util::complete('修改成功');
  327. }
  328. //修改物流名称 ssh 20230112
  329. public function actionChangeWlName()
  330. {
  331. $get = Yii::$app->request->get();
  332. $id = $get['id'] ?? 0;
  333. $wlName = $get['wlName'] ?? 0;
  334. $custom = CustomClass::getById($id, true);
  335. if (empty($custom) || $custom->ownMainId != $this->mainId) {
  336. util::fail('修改失败');
  337. }
  338. $ghsId = $custom->ghsId ?? 0;
  339. $ghs = GhsClass::getById($ghsId, true);
  340. if (empty($ghs)) {
  341. util::fail('修改失败');
  342. }
  343. $ghs->customWlName = $wlName;
  344. $ghs->save();
  345. $custom->wlName = $wlName;
  346. $custom->save();
  347. util::complete('已修改');
  348. }
  349. //修改短名 ssh 2025312
  350. public function actionModifyShortName()
  351. {
  352. $get = Yii::$app->request->get();
  353. $id = $get['id'] ?? 0;
  354. $shortName = $get['shortName'] ?? 0;
  355. $custom = CustomClass::getById($id, true);
  356. if (empty($custom) || $custom->ownMainId != $this->mainId) {
  357. util::fail('修改失败');
  358. }
  359. $custom->shortName = $shortName;
  360. $custom->save();
  361. util::complete('修改成功');
  362. }
  363. //修改物流信息 ssh 20230105
  364. public function actionChangeWl()
  365. {
  366. util::fail('修改失败');
  367. }
  368. //修改名称 ssh 2022096
  369. public function actionChangeName()
  370. {
  371. $get = Yii::$app->request->get();
  372. $name = $get['name'] ?? '';
  373. $id = $get['id'] ?? 0;
  374. if (empty($name)) {
  375. util::fail('请填写名称');
  376. }
  377. $py = stringUtil::py($name);
  378. $custom = CustomClass::getById($id, true);
  379. CustomClass::valid($custom, $this->shopId);
  380. $custom->name = $name;
  381. $custom->py = $py;
  382. $custom->save();
  383. OrderClass::updateByCondition(['customId' => $id], ['customName' => $name, 'customNamePy' => $py]);
  384. $customShopId = $custom->shopId ?? 0;
  385. //在首店修改客户名称,直营店自动同步
  386. $masterShop = $this->shop;
  387. if (isset($masterShop->default) && $masterShop->default == 1) {
  388. $sjId = $masterShop->sjId ?? 0;
  389. $shopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
  390. foreach ($shopList as $shop) {
  391. $shopId = $shop->id ?? 0;
  392. if (isset($shop->join) && $shop->join == 1) {
  393. //加盟店不同步修改
  394. continue;
  395. }
  396. if ($shopId == $masterShop->id) {
  397. //前面已经同步修改过了
  398. continue;
  399. }
  400. $custom = CustomClass::getByCondition(['ownShopId' => $shopId, 'shopId' => $customShopId], true);
  401. if (empty($custom)) {
  402. continue;
  403. }
  404. $custom->name = $name;
  405. $custom->py = $py;
  406. $custom->save();
  407. }
  408. }
  409. util::complete('修改成功');
  410. }
  411. //帮客户添加员工 ssh 20220613
  412. public function actionAddStaff()
  413. {
  414. $post = Yii::$app->request->post();
  415. $customId = $post['id'] ?? 0;
  416. $mobile = $post['mobile'] ?? 0;
  417. if (stringUtil::isMobile($mobile) == false) {
  418. util::fail('手机号填写错误');
  419. }
  420. $info = CustomService::getById($customId, true);
  421. CustomClass::valid($info, $this->shopId);
  422. $connection = Yii::$app->db;
  423. $transaction = $connection->beginTransaction();
  424. try {
  425. $shopId = $info->shopId ?? 0;
  426. $customShop = ShopClass::getById($shopId, true);
  427. if (empty($customShop)) {
  428. util::fail('没有找到客户的门店');
  429. }
  430. $mainId = $customShop->mainId ?? 0;
  431. $ptStyle = dict::getDict('ptStyle', 'hd');
  432. $adminInfo = ['name' => $mobile, 'mobile' => $mobile, 'style' => $ptStyle, 'currentShopId' => $shopId];
  433. $fromApp = dict::getDict('userSourceGetId', 'app', 'id');
  434. $admin = \bizGhs\admin\classes\AdminClass::replaceAdmin($adminInfo, $fromApp);
  435. $roleList = AdminRoleClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
  436. if (empty($roleList)) {
  437. util::fail('客户门店没有员工角色');
  438. }
  439. $currentRoleId = 0;
  440. foreach ($roleList as $role) {
  441. $roleId = $role->id ?? 0;
  442. $currentRoleId = $roleId;
  443. if ($role->roleName == '员工') {
  444. break;
  445. }
  446. }
  447. $params = [
  448. 'shopId' => $shopId,
  449. 'mobile' => $mobile,
  450. 'roleId' => $currentRoleId,
  451. ];
  452. \bizHd\staff\classes\StaffClass::appGenerateStaff($params, $admin);
  453. $transaction->commit();
  454. util::complete('添加成功');
  455. } catch (\Exception $e) {
  456. $transaction->rollBack();
  457. util::fail('添加失败');
  458. }
  459. }
  460. //添加新花店 ssh 2021.1.8
  461. public function actionAdd()
  462. {
  463. $post = Yii::$app->request->post();
  464. $post['style'] = SjClass::STYLE_RETAIL;
  465. $post['introSjId'] = $this->sjId;
  466. $post['introStyle'] = SjClass::STYLE_SUPPLIER;
  467. $mobile = $post['mobile'] ?? '';
  468. $confirmMobile = $post['confirmMobile'];
  469. $address = $post['address'] ?? '';
  470. util::fail('功能已停用');
  471. if (stringUtil::isMobile($mobile) == false) {
  472. util::fail(' 请填写正确的手机号');
  473. }
  474. if ($mobile != $confirmMobile) {
  475. util::fail('二次号码填写不一致');
  476. }
  477. $name = $post['name'] ?? '';
  478. if (empty($name)) {
  479. util::fail('名称不能为空');
  480. }
  481. if (stringUtil::getWordNum($name) > 15) {
  482. util::fail('名称不能超过15个汉字');
  483. }
  484. $has = SjClass::getByCondition(['name' => $name, 'style' => SjClass::STYLE_RETAIL]);
  485. if (!empty($has)) {
  486. util::fail('名称已经存在');
  487. }
  488. $has = ApplyClass::getByCondition(['mobile' => $mobile, 'style' => SjClass::STYLE_RETAIL]);
  489. if (!empty($has)) {
  490. util::fail('手机号已经添加过');
  491. }
  492. if (empty($address)) {
  493. util::fail('请填写地址');
  494. }
  495. $connection = Yii::$app->db;
  496. $transaction = $connection->beginTransaction();
  497. try {
  498. $shop = $this->shop;
  499. $sjId = $this->sjId;
  500. $shopId = $this->shopId;
  501. $sjName = $this->sj->name ?? '';
  502. $city = $shop->city ?? '';
  503. $dist = $shop->dist ?? '';
  504. $applyData = [
  505. 'name' => $name,
  506. 'licenseNo' => $mobile,
  507. 'certType' => ApplyClass::CERT_TYPE_MOBILE,
  508. 'mobile' => $mobile,
  509. 'introSjId' => $sjId,
  510. 'introSjName' => $sjName,
  511. 'introShopId' => $shopId,
  512. 'introStyle' => SjClass::STYLE_SUPPLIER,
  513. 'from' => ApplyClass::FROM_GHS,
  514. 'style' => SjClass::STYLE_RETAIL,
  515. 'province' => $shop->province ?? '',
  516. 'city' => $city,
  517. 'dist' => $dist,
  518. 'address' => $address,
  519. 'status' => ApplyClass::STATUS_PASS,
  520. 'replace' => 1,//1表示供货商添加的客户
  521. ];
  522. $apply = ApplyService::replaceRetail($applyData);
  523. $id = $apply['id'] ?? 0;
  524. $respond = ApplyService::pass($id);
  525. $shop = $respond['shop'] ?? [];
  526. $sj = $respond['sj'] ?? [];
  527. $hdSjId = $sj['id'] ?? 0;
  528. $hdShopId = $shop->id ?? 0;
  529. ApplyClass::updateById($id, ['sjId' => $hdSjId, 'shopId' => $hdShopId]);
  530. if (empty($hdShopId)) {
  531. util::fail('客户没有添加成功!');
  532. }
  533. $custom = CustomClass::build($this->shopId, $hdShopId);
  534. $custom['avatar'] = imgUtil::groupImg($custom['avatar']);
  535. //客户欠款额度设置
  536. $debt = isset($post['debt']) && $post['debt'] == CustomClass::IS_DEBT_YES ? CustomClass::IS_DEBT_YES : CustomClass::IS_DEBT_NO;
  537. $customId = $custom['id'] ?? 0;
  538. $debtLimit = isset($post['debtLimit']) && is_numeric($post['debtLimit']) ? $post['debtLimit'] : 0;
  539. CustomClass::updateById($customId, ['debtLimit' => $debtLimit, 'debt' => $debt]);
  540. $transaction->commit();
  541. util::success($custom);
  542. } catch (\Exception $exception) {
  543. $transaction->rollBack();
  544. Yii::info("添加客户没有成功:" . $exception->getMessage());
  545. util::fail('添加客户没有成功');
  546. }
  547. }
  548. //向队列写入新花店数据 shizhongqi 2022.6.8
  549. public function actionCreateCustomers()
  550. {
  551. $post = Yii::$app->request->post();
  552. $virtual = $post['virtual'] ?? 0;
  553. $arr = [];
  554. for ($i = 1; $i <= 5; $i++) {
  555. $name = $post['name' . $i] ?? '';
  556. $mobile = $post['mobile' . $i] ?? '';
  557. $confirmMobile = $post['confirmMobile' . $i] ?? '';
  558. if (empty($name) && empty($mobile) && empty($confirmMobile)) {
  559. continue;
  560. }
  561. if (empty($name)) {
  562. util::fail('花店名称不能为空');
  563. }
  564. if (stringUtil::getWordNum($name) > 15) {
  565. util::fail('名称不能超过15个汉字');
  566. }
  567. if (empty($mobile)) {
  568. //添加虚拟客户
  569. if ($virtual == 1) {
  570. $mobile = orderSn::getMobileSn();
  571. $confirmMobile = $mobile;
  572. } else {
  573. util::fail($name . " 手机号不能为空");
  574. }
  575. }
  576. if (stringUtil::isMobile($mobile) == false) {
  577. util::fail($name . " 手机号格式不正确");
  578. }
  579. if ($mobile != $confirmMobile) {
  580. util::fail($name . " 二次手机号不一致");
  581. }
  582. $hasShop = ShopClass::getByCondition(['mobile' => $mobile], true);
  583. if (!empty($hasShop)) {
  584. $shop = ShopClass::getByCondition(['mobile' => $mobile, 'ptStyle' => 1], true);
  585. if (!empty($shop)) {
  586. $ghsShopId = $this->shopId;
  587. $hdShopId = $shop->id;
  588. $custom = CustomClass::build($ghsShopId, $hdShopId);
  589. $customId = $custom['id'] ?? 0;
  590. $custom = CustomClass::getById($customId, true);
  591. if (!empty($custom)) {
  592. $custom->name = $name;
  593. $py = stringUtil::py($name);
  594. $custom->py = $py;
  595. $custom->save();
  596. }
  597. util::success(['customId' => $customId], $shop->merchantName . ' 添加成功');
  598. }
  599. util::fail($mobile . "手机号已经添加过了");
  600. }
  601. $has = ApplyClass::getByCondition(['mobile' => $mobile]);
  602. if (!empty($has)) {
  603. util::fail($mobile . "手机号已经申请添加过了");
  604. }
  605. $arr[] = ['name' => $name, 'mobile' => $mobile];
  606. }
  607. if (empty($arr)) {
  608. util::fail('请填写客户');
  609. }
  610. foreach ($arr as $item) {
  611. $name = $item['name'] ?? '';
  612. $mobile = $item['mobile'] ?? '';
  613. //队列方式去处理
  614. $customerCachedKey = 'batch_create_customer_list';
  615. $value = $name . '_' . $mobile . '_' . $this->sjId . '_' . $this->shop->id . '_' . $this->sj->name . '_' . $this->shopAdminId;
  616. Yii::$app->redis->executeCommand('LPUSH', [$customerCachedKey, $value]);
  617. Yii::info("供货商添加客户:name - " . $name . ' == mobile - ' . $mobile);
  618. Yii::info("shopAdminId: " . $this->shopAdminId);
  619. }
  620. util::complete('已提交,15秒后生效');
  621. }
  622. //从其它店同步客户 shizhongqi 2022.6.9
  623. public function actionCopyCustomers()
  624. {
  625. $get = Yii::$app->request->get();
  626. $fromShopId = $get['fromShopId'] ?? 0;
  627. $fromShop = ShopClass::getById($fromShopId, true);
  628. if (empty($fromShop)) {
  629. util::fail('门店不存在');
  630. }
  631. $toShopId = $this->shopId;
  632. if ($fromShopId == $toShopId) {
  633. util::fail('本店无需同步');
  634. }
  635. $fromShopName = $fromShop->shopName ?? '';
  636. if ($fromShop->syncCustom == 0) {
  637. util::fail('不允许从' . $fromShopName . '同步客户');
  638. }
  639. $toShop = $this->shop;
  640. $toShopName = $toShop->shopName ?? '';
  641. if ($toShop->syncCustom == 0) {
  642. util::fail($toShopName . '已关闭同步功能');
  643. }
  644. $toSjId = $toShop->sjId ?? 0;
  645. $fromSjId = $fromShop->sjId ?? 0;
  646. if ($toSjId != $fromSjId) {
  647. util::fail('不是您的门店');
  648. }
  649. $cachedKey = 'copy_other_shop_customers';
  650. Yii::$app->redis->executeCommand('LPUSH', [$cachedKey, $toShopId . '_' . $fromShopId]);
  651. Yii::info("从其他门店同步客户:目标门店id = " . $toShopId . ' 来源门店id = ' . $fromShopId);
  652. util::complete('已提交,1分钟后生效');
  653. }
  654. //客户列表 ssh 2021.7.8
  655. public function actionList()
  656. {
  657. $staff = $this->shopAdmin;
  658. if (isset($staff->identity) && $staff->identity == 2) {
  659. util::success(['list' => []]);
  660. }
  661. $get = Yii::$app->request->get();
  662. $type = $get['type'] ?? 0;
  663. $name = $get['name'] ?? '';
  664. $export = $get['export'] ?? 0;
  665. $mainId = $this->mainId;
  666. $isCashier = $get['isCashier'] ?? 0;
  667. if ($isCashier == 1) {
  668. //去掉收银台提示价格更新
  669. $staffId = $this->shopAdminId;
  670. Yii::$app->redis->executeCommand('DEL', ['ghs_cashier_' . $mainId . '_' . $staffId . '_may_refresh']);
  671. }
  672. $where = ['ownMainId' => $this->mainId];
  673. $sort = 'visitTime DESC';
  674. $where['delStatus'] = 0;
  675. if ($type == 1) {
  676. //消费排行
  677. $sort = 'buyAmount DESC';
  678. } else if ($type == 2) {
  679. //欠款客户
  680. $where['isDebt'] = 1;
  681. $sort = '(debtAmount-balance) DESC';
  682. } else if ($type == 3) {
  683. //大客户
  684. $where['level'] = 2;
  685. } else if ($type == 4) {
  686. //零售客户
  687. $where['level'] = 0;
  688. } else if ($type == 5) {
  689. //休眠客户
  690. $recentDay = isset($get['recentDay']) && is_numeric($get['recentDay']) ? (int)$get['recentDay'] : 7;
  691. $totalSecond = bcmul(86400, $recentDay);
  692. $currentSecond = bcsub(time(), $totalSecond);
  693. $currentDate = date("Y-m-d H:i:s", $currentSecond);
  694. $where['recentExpend<'] = $currentDate;
  695. $sort = 'recentExpend desc';
  696. } else if ($type == 6) {
  697. //黑名单
  698. $where['black'] = 2;
  699. } else if ($type == 7) {
  700. //已删除
  701. $where['delStatus'] = 1;
  702. }
  703. $name = trim($name);
  704. if (!empty($name)) {
  705. if (is_numeric($name)) {
  706. if (stringUtil::isMobile($name)) {
  707. $where['mobile'] = $name;
  708. } else {
  709. $shop = $this->shop;
  710. //如果花大苪,搜索数字还是优先搜索客户名称,因为客户名称经常会编号
  711. if ($shop->id == 8249) {
  712. $where['name'] = ['like', $name];
  713. } else {
  714. $where['mobile'] = ['like', $name];
  715. }
  716. }
  717. } else if (stringUtil::isLetter($name)) {
  718. $where['py'] = ['like', $name];
  719. } else {
  720. $where['name'] = ['like', $name];
  721. }
  722. }
  723. if ($export == 1) {
  724. ini_set('memory_limit', '2045M');
  725. set_time_limit(0);
  726. CustomClass::exportCustom($where, $sort, $this->mainId);
  727. util::stop();
  728. }
  729. $list = CustomService::getCustomSortList($where, $sort);
  730. $main = $this->main;
  731. $list['totalUser'] = $main->totalUser ?? 0;
  732. $list['mayGatheringNum'] = $main->mayGatheringNum ?? 0;
  733. $list['shopInfo'] = $this->shop;
  734. util::success($list);
  735. }
  736. //今日访客 ssh 20211022
  737. public function actionGetVisit()
  738. {
  739. $ids = StatVisitClass::getVisitCustomIds($this->shop);
  740. if (empty($ids)) {
  741. util::success(['list' => []]);
  742. }
  743. $sort = 'visitTime DESC';
  744. $where = ['id' => ['in', $ids]];
  745. $respond = CustomService::getCustomSortList($where, $sort);
  746. util::success($respond);
  747. }
  748. //客户详情 ssh 2021.1.8
  749. public function actionDetail()
  750. {
  751. $get = Yii::$app->request->get();
  752. $customId = $get['id'] ?? 0;
  753. $info = CustomService::getCustomInfo($customId);
  754. CustomClass::valid($info, $this->shopId);
  755. $mainId = $info['mainId'] ?? 0;
  756. //超管的信息
  757. $superInfo = ShopAdminClass::getManager($mainId);
  758. $superName = $superInfo['name'] ?? '';
  759. $currentSuper = ['name' => $superName];
  760. $info['superInfo'] = $currentSuper;
  761. util::success($info);
  762. }
  763. //修改是否显示库存 ssh 20221022
  764. public function actionChangeShowStock()
  765. {
  766. $get = Yii::$app->request->get();
  767. $showStock = $get['showStock'] ?? 0;
  768. $customId = $get['customId'] ?? 0;
  769. $custom = CustomClass::getById($customId, true);
  770. CustomClass::valid($custom, $this->shopId);
  771. $ghsId = $custom->ghsId ?? 0;
  772. $ghs = GhsClass::getById($ghsId, true);
  773. if (empty($ghs)) {
  774. util::fail('没有找到供货商');
  775. }
  776. $ghs->showStock = $showStock;
  777. $ghs->save();
  778. $custom->showStock = $showStock;
  779. $custom->save();
  780. util::complete();
  781. }
  782. //修改状态 ssh 20240924
  783. public function actionChangePassStatus()
  784. {
  785. $get = Yii::$app->request->get();
  786. $passStatus = isset($get['passStatus']) ? $get['passStatus'] : 0;
  787. $customId = isset($get['customId']) ? $get['customId'] : 0;
  788. $custom = CustomClass::getById($customId, true);
  789. CustomClass::valid($custom, $this->shopId);
  790. $ghsId = $custom->ghsId ?? 0;
  791. $ghs = GhsClass::getById($ghsId, true);
  792. if (empty($ghs)) {
  793. util::fail('没有找到供货商');
  794. }
  795. $ghs->passStatus = $passStatus;
  796. $ghs->save();
  797. $custom->passStatus = $passStatus;
  798. $custom->save();
  799. util::complete();
  800. }
  801. public function actionChangeHome()
  802. {
  803. $get = Yii::$app->request->get();
  804. $home = isset($get['home']) ? $get['home'] : 0;
  805. $customId = !empty($get['customId']) ? $get['customId'] : 0;
  806. $custom = CustomClass::getById($customId, true);
  807. if (empty($custom)) {
  808. util::fail('没有找到客户呢');
  809. }
  810. if ($custom->ownShopId != $this->shopId) {
  811. util::fail('不是你的客户');
  812. }
  813. $ghsId = $custom->ghsId ?? 0;
  814. $ghs = GhsClass::getById($ghsId, true);
  815. if (empty($ghs)) {
  816. util::fail('没有找到供货商');
  817. }
  818. $ghs->home = $home;
  819. $ghs->save();
  820. $custom->home = $home;
  821. $custom->save();
  822. util::complete();
  823. }
  824. /**
  825. * 上门最低消费设置 -- 单个修改
  826. */
  827. public function actionModifyHomeAmount()
  828. {
  829. $get = Yii::$app->request->get();
  830. $id = $get['id'] ?? 0;
  831. $homeAmount = $get['homeAmount'] ?? 0;
  832. $homeType = $get['homeType'] ?? 0;
  833. $custom = CustomClass::getById($id, true);
  834. if (empty($custom)) {
  835. util::fail('没有找到客户');
  836. }
  837. if ($custom->ownMainId != $this->mainId) {
  838. util::fail('不是你的客户');
  839. }
  840. $ghsId = $custom->ghsId ?? 0;
  841. $ghs = GhsClass::getById($ghsId, true);
  842. if (empty($ghs)) {
  843. util::fail('没有找到供货商');
  844. }
  845. $custom->homeAmount = $homeAmount;
  846. $custom->homeType = $homeType;
  847. $custom->save();
  848. $ghs->homeAmount = $homeAmount;
  849. $ghs->homeType = $homeType;
  850. $ghs->save();
  851. util::complete('修改成功');
  852. }
  853. /**
  854. * 上门最低消费设置 -- 针对批发商客户进行批量修改
  855. */
  856. public function actionModifyAllHomeAmount()
  857. {
  858. $get = Yii::$app->request->get();
  859. $homeAmount = $get['homeAmount'] ?? 0;
  860. $homeType = $get['homeType'] ?? 0;
  861. $shopId = $this->shopId;
  862. ShopClass::updateById($shopId, ['homeAmount' => $homeAmount, 'homeType' => $homeType]);
  863. // 批量更新客户信息
  864. CustomClass::updateByCondition(['ownMainId' => $this->mainId], ['homeAmount' => $homeAmount, 'homeType' => $homeType]);
  865. //批量更新供货商信息
  866. GhsClass::updateByCondition(['shopId' => $shopId], ['homeAmount' => $homeAmount, 'homeType' => $homeType]);
  867. util::complete('修改成功');
  868. }
  869. //允许月结开关 ssh 2021.1.8
  870. public function actionDebt()
  871. {
  872. if (getenv('YII_ENV') == 'production') {
  873. if ($this->mainId == 4884) {
  874. if ($this->shopAdminId != 130738) {
  875. util::fail('只有倩姐才能修改');
  876. }
  877. }
  878. }
  879. $get = Yii::$app->request->get();
  880. $debt = isset($get['debt']) ? $get['debt'] : 0;
  881. $customId = isset($get['customId']) ? $get['customId'] : 0;
  882. $custom = CustomClass::getById($customId);
  883. CustomClass::valid($custom, $this->shopId);
  884. CustomClass::debt($custom, $debt);
  885. util::complete();
  886. }
  887. //采购查看权限的黑白名单开关 shizhongqi 2021.08.08
  888. public function actionSetBlack()
  889. {
  890. $black = Yii::$app->request->get('black', 2);
  891. $customId = Yii::$app->request->get('customId', 0);
  892. $custom = CustomClass::getById($customId, true);
  893. CustomClass::valid($custom, $this->shopId);
  894. $custom->black = $black;
  895. $custom->save();
  896. $ghsId = $custom->ghsId ?? 0;
  897. $ghs = GhsClass::getById($ghsId, true);
  898. if (empty($ghs)) {
  899. util::fail('出错了');
  900. }
  901. $ghs->black = $black;
  902. $ghs->save();
  903. util::complete();
  904. }
  905. //欠款客户 ssh 2021.2.4
  906. public function actionDebtList()
  907. {
  908. $get = Yii::$app->request->get();
  909. $where = ['ownShopId' => $this->shopId, 'isDebt' => 1];
  910. if (isset($get['name']) && !empty($get['name'])) {
  911. $where['name'] = ['like', $get['name']];
  912. }
  913. $list = CustomService::getDebtList($where);
  914. //共X个客户,合计欠款XXX元
  915. $main = $this->main;
  916. $list['customNum'] = $main->mayGatheringNum ?? 0;
  917. $list['debtAmount'] = $main->mayGathering ?? 0.00;
  918. util::success($list);
  919. }
  920. //修改欠款额度 ssh 20210625
  921. public function actionUpdateDebtLimit()
  922. {
  923. $shopAdmin = $this->shopAdmin;
  924. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  925. util::fail('管理员才能操作');
  926. }
  927. if (getenv('YII_ENV') == 'production') {
  928. if ($this->mainId == 4884) {
  929. if ($this->shopAdminId != 130738) {
  930. util::fail('请倩姐修改');
  931. }
  932. }
  933. if ($this->mainId == 10536) {
  934. if ($this->shopAdminId != 136416 && $this->shopAdminId != 136419) {
  935. util::fail('请闵总修改');
  936. }
  937. }
  938. }
  939. $get = Yii::$app->request->get();
  940. $id = $get['id'] ?? 0;
  941. $debtLimit = $get['debtLimit'] ?? 0;
  942. if (is_numeric($debtLimit) == false || $debtLimit < 0) {
  943. util::fail('请填写金额');
  944. }
  945. $custom = CustomClass::getById($id, true);
  946. CustomClass::valid($custom, $this->shopId);
  947. $custom->debtLimit = $debtLimit;
  948. $custom->save();
  949. util::complete();
  950. }
  951. //修改货位名称 ssh 20241006
  952. public function actionUpdateSeatSnName()
  953. {
  954. $get = Yii::$app->request->get();
  955. $id = $get['id'] ?? 0;
  956. $seatSnName = $get['seatSnName'] ?? '';
  957. $custom = CustomClass::getById($id, true);
  958. CustomClass::valid($custom, $this->shopId);
  959. $custom->seatSnName = $seatSnName;
  960. $custom->save();
  961. util::complete();
  962. }
  963. //修改折扣 ssh 20210913
  964. public function actionChangeDiscount()
  965. {
  966. $shopAdmin = $this->shopAdmin;
  967. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  968. util::fail('管理员才能操作');
  969. }
  970. $get = Yii::$app->request->get();
  971. $id = $get['id'] ?? 0;
  972. $discount = $get['discount'] ?? 0;
  973. if (is_numeric($discount) == false || $discount > 1 || $discount == 0) {
  974. util::fail('请填写小数值');
  975. }
  976. $custom = CustomClass::getById($id, true);
  977. CustomClass::valid($custom, $this->shopId);
  978. $custom->discount = $discount;
  979. $custom->save();
  980. $ghsId = $custom->ghsId ?? 0;
  981. $ghs = GhsClass::getById($ghsId, true);
  982. $ghs->giveDiscount = $discount;
  983. $ghs->save();
  984. util::complete();
  985. }
  986. //修改客户等级 ssh 20211007
  987. public function actionChangeLevel()
  988. {
  989. $shopAdmin = $this->shopAdmin;
  990. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  991. util::fail('超管才能修改');
  992. }
  993. //泉城的只有苏小娟才能修改
  994. if (getenv('YII_ENV') == 'production') {
  995. if ($this->mainId == 60) {
  996. if (in_array($this->adminId, [2499, 4]) == false) {
  997. util::fail('请小娟修改');
  998. }
  999. }
  1000. }
  1001. $get = Yii::$app->request->get();
  1002. $customId = $get['customId'] ?? 0;
  1003. $level = $get['level'] ?? 1;
  1004. $custom = CustomClass::getById($customId, true);
  1005. CustomClass::valid($custom, $this->shopId);
  1006. $custom->level = $level;
  1007. $custom->save();
  1008. $ghsId = $custom->ghsId ?? 0;
  1009. $ghs = GhsClass::getById($ghsId, true);
  1010. if (empty($ghs)) {
  1011. util::fail('出错了');
  1012. }
  1013. $ghs->giveLevel = $level;
  1014. $ghs->save();
  1015. $map = CustomClass::$levelMap;
  1016. $name = $map[$level] ?? '';
  1017. util::success(['levelName' => $name]);
  1018. }
  1019. //打印货位号 ssh 20241006
  1020. public function actionPrintSeatSn()
  1021. {
  1022. $get = Yii::$app->request->get();
  1023. $customId = $get['id'] ?? 0;
  1024. $custom = CustomClass::getById($customId, true);
  1025. CustomClass::valid($custom, $this->shopId);
  1026. $seatSn = $custom->seatSn ?? 0;
  1027. if ($seatSn == 0) {
  1028. util::fail('没有货位');
  1029. }
  1030. $customName = $custom->name ?? '';
  1031. if (isset($custom->seatSnName) && !empty($custom->seatSnName)) {
  1032. $customName = $custom->seatSnName ?? '';
  1033. }
  1034. $customName = stringUtil::subStringUtf8($customName, 7, '..');
  1035. $a4Print = [
  1036. 'customName' => $customName,
  1037. 'seatSn' => $seatSn,
  1038. ];
  1039. $info['printData'] = $a4Print;
  1040. $template = '{"panels":[{"index":0,"name":1,"height":297,"width":210,"paperHeader":49.5,"paperFooter":780,"printElements":[{"options":{"left":12,"top":786,"height":49,"width":49},"printElementType":{"title":"html","type":"html"}},{"options":{"left":45,"top":52.5,"height":52,"width":128,"title":"文本","right":172.25,"bottom":104.5,"vCenter":108.25,"hCenter":78.5,"field":"seatSn","testData":"593","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":50,"fontWeight":"bold","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":148.5,"top":52.5,"height":52,"width":400,"title":"文本","field":"customName","testData":"小林","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":50,"fontWeight":"bolder","textAlign":"right","textContentVerticalAlign":"middle","qrCodeLevel":0,"right":566.5,"bottom":90.25,"vCenter":366.5,"hCenter":71.75},"printElementType":{"title":"文本","type":"text"}}],"paperNumberLeft":547.5,"paperNumberTop":786,"paperNumberDisabled":true,"paperNumberContinue":true,"fontFamily":"Microsoft YaHei","watermarkOptions":{"content":"","rotate":25,"timestamp":false,"format":"YYYY-MM-DD HH:mm","fillStyle":"rgba(184, 184, 184, 0.3)","fontSize":"14px","width":200,"height":200},"panelLayoutOptions":{"layoutType":"column","layoutRowGap":0,"layoutColumnGap":0}}]}';
  1041. $info['template'] = $template;
  1042. $custom->printSeatSn = 1;
  1043. $custom->save();
  1044. util::success($info);
  1045. }
  1046. //总赊账和总余额汇总 ssh 20250620
  1047. public function actionShowTotalBalance()
  1048. {
  1049. $lookMoney = \bizGhs\shop\classes\ShopAdminClass::lookMoneyPower($this->shopAdmin, $this->shop);
  1050. if ($lookMoney == 0) {
  1051. util::fail('无法查看哦');
  1052. }
  1053. $pfShop = $this->shop;
  1054. $lsShopId = $pfShop->lsShopId;
  1055. $pfShopId = $this->shopId;
  1056. $respond = CustomClass::showTotalBalance($pfShopId, $lsShopId);
  1057. $respond['pfShopId'] = $pfShopId;
  1058. $respond['lsShopId'] = $lsShopId;
  1059. util::success($respond);
  1060. }
  1061. public function actionChangeDelStatus()
  1062. {
  1063. $get = Yii::$app->request->get();
  1064. $customId = $get['id'] ?? 0;
  1065. $delStatus = $get['delStatus'] ?? 0;
  1066. $custom = CustomClass::getById($customId, true);
  1067. CustomClass::valid($custom, $this->shopId);
  1068. $ghsId = $custom->ghsId ?? 0;
  1069. $ghs = GhsClass::getById($ghsId, true);
  1070. if (empty($ghs)) {
  1071. util::fail('客户信息有缺失');
  1072. }
  1073. $custom->delStatus = $delStatus;
  1074. $custom->save();
  1075. $ghs->delStatus = $delStatus;
  1076. $ghs->save();
  1077. util::complete('删除成功');
  1078. }
  1079. }