CustomController.php 42 KB

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