ShopController.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <?php
  2. namespace hd\controllers;
  3. use biz\shop\classes\ShopClass;
  4. use biz\sj\services\MerchantExtendService;
  5. use bizGhs\admin\classes\AdminClass;
  6. use bizGhs\custom\classes\CustomClass;
  7. use bizHd\admin\classes\ShopAdminClass;
  8. use bizHd\custom\classes\CustomClass as HdCustomClass;
  9. use bizHd\custom\classes\HdClass;
  10. use bizHd\merchant\classes\SjClass;
  11. use bizHd\merchant\services\ShopService;
  12. use bizHd\purchase\classes\PurchaseClass;
  13. use bizHd\saas\services\RegionService;
  14. use bizHd\shop\classes\ShopExtClass;
  15. use common\components\dict;
  16. use common\components\dirUtil;
  17. use common\components\imgUtil;
  18. use common\components\stringUtil;
  19. use common\components\util;
  20. use common\components\wxUtil;
  21. use Yii;
  22. class ShopController extends BaseController
  23. {
  24. public $guestAccess = ['all', 'gathering-img-url', 'check-shop'];
  25. public function actionModifySjName()
  26. {
  27. $get = Yii::$app->request->get();
  28. $adminId = $this->adminId;
  29. $staff = $this->shopAdmin;
  30. if ($staff->founder != 2 && $adminId != 4) {
  31. util::fail('老板才能改店名');
  32. }
  33. $name = $get['name'] ?? '';
  34. if (empty($name)) {
  35. util::fail('请填写名称');
  36. }
  37. //开启事务
  38. $connection = Yii::$app->db;
  39. $transaction = $connection->beginTransaction();
  40. try {
  41. $shop = $this->shop;
  42. $shop->merchantName = $name;
  43. $shop->save();
  44. $sj = SjClass::getById($shop->sjId, true);
  45. if (empty($sj)) {
  46. util::fail('门店信息缺失呢');
  47. }
  48. $sj->name = $name;
  49. $sj->save();
  50. $fullName = $shop->shopName == '首店' ? $name : $name . ' ' . $shop->shopName;
  51. $shopId = $shop->id;
  52. HdClass::updateByCondition(['shopId' => $shopId], ['name' => $fullName]);
  53. CustomClass::updateByCondition(['shopId' => $shopId], ['originName' => $fullName]);
  54. $transaction->commit();
  55. util::complete('修改成功');
  56. } catch (\Exception $exception) {
  57. $transaction->rollBack();
  58. Yii::error("修改门店名称失败:" . $exception->getMessage());
  59. util::fail('修改门店名称失败');
  60. }
  61. }
  62. //我的可以进入的门店 ssh 20230424
  63. public function actionMyShop()
  64. {
  65. $staff = $this->shopAdmin;
  66. $shopList = [];
  67. if (isset($staff->super) && $staff->super == 1) {
  68. $sjId = $this->sjId ?? 0;
  69. $shopList = ShopClass::getAllByCondition(['sjId' => $sjId, 'ptStyle' => 1], null, 'id,shopName,merchantName,sjId,mainId,ptStyle', 'id');
  70. }
  71. $adminId = $this->adminId ?? 0;
  72. $staffList = ShopAdminClass::getAllByCondition(['adminId' => $adminId], null, '*', null, true);
  73. $mainIdList = [];
  74. if (!empty($staffList)) {
  75. foreach ($staffList as $staff) {
  76. $isPt = $staff->isPt ?? 0;
  77. $delStatus = $staff->delStatus ?? 0;
  78. //$super = $staff->super ?? 0;
  79. $mainId = $staff->mainId ?? 0;
  80. if ($isPt == 0 && $delStatus == 0) {
  81. $mainIdList[] = $mainId;
  82. }
  83. }
  84. }
  85. if (!empty($mainIdList)) {
  86. $addShopList = ShopClass::getAllByCondition(['mainId' => ['in', $mainIdList], 'ptStyle' => 1], null, 'id,shopName,merchantName,sjId,mainId,ptStyle', 'id');
  87. if (!empty($addShopList)) {
  88. foreach ($addShopList as $addShop) {
  89. $addShopId = $addShop['id'] ?? 0;
  90. if (isset($shopList[$addShopId]) == false) {
  91. $shopList[$addShopId] = $addShop;
  92. }
  93. }
  94. }
  95. }
  96. $list = array_values($shopList);
  97. util::success(['list' => $list]);
  98. }
  99. //是否开启完整功能 ssh 20230226
  100. public function actionChangeOnlyCg()
  101. {
  102. $shop = $this->shop;
  103. $get = Yii::$app->request->get();
  104. $onlyCg = $get['onlyCg'] ?? 1;
  105. $shop->onlyCg = $onlyCg;
  106. $shop->save();
  107. util::complete('操作成功');
  108. }
  109. public function actionCheckShop()
  110. {
  111. $get = Yii::$app->request->get();
  112. $mobile = $get['mobile'] ?? '';
  113. if(empty($mobile)){
  114. util::success(['has' => 0]);
  115. }
  116. $shop = ShopClass::getByCondition(['mobile' => $mobile], true);
  117. if (!empty($shop)) {
  118. util::success(['has' => 1]);
  119. }
  120. util::success(['has' => 0]);
  121. }
  122. //获取当前门店信息 ssh 2021.3.27
  123. public function actionCurrentShop()
  124. {
  125. $shopExt = ShopExtClass::getByCondition(['shopId' => $this->shop->id], false, false, 'reachVip');
  126. $shop = $this->shop->attributes;
  127. $shop['reachVip'] = $shopExt['reachVip'];
  128. util::success($shop);
  129. }
  130. //门店列表 ssh 20202.2.29
  131. public function actionList()
  132. {
  133. $where = [];
  134. $where['sjId'] = $this->sjId;
  135. $where['delStatus'] = 0;
  136. $list = \bizHd\shop\classes\ShopClass::getShopList($where);
  137. util::success($list);
  138. }
  139. //更新门店 ssh 2020.2.29
  140. public function actionUpdate()
  141. {
  142. $data = Yii::$app->request->post();
  143. $data['sjId'] = $this->sjId;
  144. $id = isset($data['id']) ? $data['id'] : 0;
  145. unset($data['id']);
  146. $data['meetNum'] = isset($data['meetNum']) ? intval($data['meetNum']) : 0;
  147. $data['meetAmount'] = isset($data['meetAmount']) ? floatval($data['meetAmount']) : 0;
  148. $data['cutAmount'] = isset($data['cutAmount']) ? floatval($data['cutAmount']) : 0;
  149. $shop = ShopService::getById($id);
  150. ShopClass::valid($shop, $this->sjId);
  151. $data['img'] = isset($data['img']) && is_array($data['img']) ? json_encode($data['img']) : '';
  152. //手机号具有唯一性,暂时不允许修改 --- 同批发端 app-ghs/controllers/ShopController.php 保持一致
  153. unset($data['mobile']);
  154. // 添加事务处理
  155. $connection = Yii::$app->db;
  156. $transaction = $connection->beginTransaction();
  157. try {
  158. ShopClass::updateShop($shop, $data);
  159. $transaction->commit();
  160. util::complete();
  161. } catch (\Exception $exception) {
  162. $transaction->rollBack();
  163. Yii::error("更新门店失败:" . $exception->getMessage());
  164. util::fail('更新门店失败');
  165. }
  166. }
  167. //修改门店营业时间
  168. public function actionUpdateOpenTime()
  169. {
  170. $post = Yii::$app->request->post();
  171. $shopId = intval($post['shopId'] ?? $post['id'] ?? 0);
  172. if ($shopId <= 0) {
  173. $shopId = intval($this->shopId);
  174. }
  175. if ($shopId != intval($this->shopId)) {
  176. util::fail('不是您的门店');
  177. }
  178. $shop = ShopClass::getShopInfo($shopId);
  179. if (empty($shop)) {
  180. util::fail('门店不存在');
  181. }
  182. ShopClass::valid($shop, $this->sjId);
  183. ShopClass::updateOpenTime($shop, $post);
  184. util::complete('修改成功');
  185. }
  186. public function actionAdd()
  187. {
  188. $data = Yii::$app->request->post();
  189. $data['sjId'] = $this->sjId;
  190. $data['shopId'] = $this->shopId;
  191. if (isset($data['shopName']) == false || empty($data['shopName'])) {
  192. util::fail('请填写门店名称');
  193. }
  194. $sj = $this->sj;
  195. $sjName = $sj->name ?? '';
  196. $data['merchantName'] = $sjName;
  197. $ptStyle = $sj->style ?? dict::getDict('ptStyle', 'hd');
  198. $data['ptStyle'] = $ptStyle;
  199. $connection = Yii::$app->db;
  200. $transaction = $connection->beginTransaction();
  201. try {
  202. $mobile = $data['mobile'] ?? 0;
  203. if (stringUtil::isMobile($mobile) == false) {
  204. util::fail('请填写正确手机号');
  205. }
  206. $adminInfo = ['name' => $mobile, 'mobile' => $mobile];
  207. $fromApp = dict::getDict('userSourceGetId', 'app', 'id');
  208. $admin = AdminClass::replaceAdmin($adminInfo, $fromApp);
  209. $adminId = $admin['id'] ?? 0;
  210. $data['adminId'] = $adminId;
  211. \bizHd\shop\classes\ShopClass::addMainShop($data, $this->shop, $this->sj);
  212. $transaction->commit();
  213. util::complete();
  214. } catch (\Exception $exception) {
  215. $transaction->rollBack();
  216. util::fail();
  217. }
  218. }
  219. //切换门店 lqh 2021.1.31
  220. public function actionToggleShop()
  221. {
  222. $adminId = $this->adminId;
  223. $mainId = $this->mainId;
  224. //多处要同步修改,关键词 no_allow_toggle_shop
  225. if (getenv('YII_ENV') == 'production') {
  226. //安海恋善不允许切换门店
  227. if (in_array($mainId, [44759, 56314, 56315, 56452])) {
  228. if (in_array($adminId, [54630, 54723])) {
  229. util::fail('专用账号,不允许切换门店');
  230. }
  231. }
  232. //惠雅南城不允许切换门店
  233. if ($mainId == 52 && $adminId == 3539) {
  234. util::fail('收银专用账号,不允许切换门店');
  235. }
  236. //惠雅莞城不允许切换门店
  237. if ($mainId == 1459 && $adminId == 2812) {
  238. util::fail('收银专用账号,不允许切换门店');
  239. }
  240. //淘花里中山店
  241. if ($mainId == 16948 && $adminId == 17908) {
  242. util::fail('收银专用账号,不允许切换门店');
  243. }
  244. //淘花里小榄店
  245. if ($mainId == 72057 && $adminId == 69792) {
  246. util::fail('收银专用账号,不允许切换门店');
  247. }
  248. }
  249. $shopAdmin = $this->shopAdmin;
  250. $switchShop = \biz\shop\classes\ShopAdminClass::hasSwitchShopRight($shopAdmin);
  251. if ($switchShop == 0) {
  252. util::fail('不能切换门店');
  253. }
  254. $newShopId = Yii::$app->request->post('shopId', 0);
  255. $deviceId = Yii::$app->request->post('deviceId', '');
  256. $newShop = ShopClass::getById($newShopId, true);
  257. if (empty($newShop)) {
  258. util::fail('没有找到门店30');
  259. }
  260. $res = \bizHd\admin\classes\AdminClass::toggleShop($this->admin, $newShop, $this->sjId, $this->shopAdmin);
  261. if ($deviceId != '') {
  262. //设备登录状态更新
  263. $oldDevice = \bizHd\device\classes\HdDeviceClass::getByCondition(['shopId' => $this->shopId, 'deviceId' => $deviceId], true);
  264. if ($oldDevice) {
  265. $oldDevice->status = 0;
  266. $oldDevice->save();
  267. }
  268. $newLoginDevice = \bizHd\device\classes\HdDeviceClass::getByCondition(['shopId' => $newShopId, 'deviceId' => $deviceId], true);
  269. if ($newLoginDevice) {
  270. $newLoginDevice->status = 1;
  271. $newLoginDevice->save();
  272. }
  273. }
  274. util::success($res);
  275. }
  276. //网页端使用,下载微信和支付宝收款码 ssh 20250821
  277. public function actionGatheringCode()
  278. {
  279. $id = Yii::$app->request->get('id', 0);
  280. $shop = ShopService::getById($id, true);
  281. if (empty($shop)) {
  282. util::fail('没有找到门店31');
  283. }
  284. ShopClass::valid($shop->attributes, $this->sjId);
  285. $imgUrl = ShopClass::generateGatheringCode($this->sjId, $id);
  286. $shopName = $shop->shopName ?? '';
  287. $file = fopen($imgUrl, "rb");
  288. Header("Content-type: application/octet-stream ");
  289. Header("Accept-Ranges: bytes ");
  290. Header("Content-Disposition: attachment;filename={$shopName}收款码.jpg");
  291. $contents = "";
  292. while (!feof($file)) {
  293. $contents .= fread($file, 8192);
  294. }
  295. echo $contents;
  296. fclose($file);
  297. }
  298. //小程序端使用,下载收款码 ssh 20250821
  299. public function actionMiniGatheringCode()
  300. {
  301. $shop = $this->shop;
  302. $shopId = $shop->id;
  303. $imgUrl = ShopClass::generateGatheringCode($this->sjId, $shopId);
  304. util::success(['imgUrl' => $imgUrl]);
  305. }
  306. //获取二维码
  307. public function actionGetGatheringCodeUrl()
  308. {
  309. $id = Yii::$app->request->get('id', 0);
  310. $shop = ShopService::getById($id, true);
  311. if (empty($shop)) {
  312. util::fail('没有找到门店32');
  313. }
  314. ShopClass::valid($shop->attributes, $this->sjId);
  315. $imgUrl = Yii::$app->params['hdHost'] . '/auth/gathering-img-url?id=' . $id;
  316. util::success(['url' => $imgUrl]);
  317. }
  318. public function actionGatheringImgUrl()
  319. {
  320. $id = Yii::$app->request->get('id', 0);
  321. $shop = ShopService::getById($id, true);
  322. if (empty($shop)) {
  323. util::fail('没有找到门店33');
  324. }
  325. $sjId = $shop->sjId;
  326. $imgUrl = ShopClass::generateGatheringCode($sjId, $id);
  327. $fileResource = file_get_contents($imgUrl);
  328. header('Content-type: image/jpeg');
  329. echo $fileResource;
  330. }
  331. //获取小程序的收款码 ssh
  332. public function actionGatheringMiniCode()
  333. {
  334. $id = Yii::$app->request->get('id', 0);
  335. $extend = MerchantExtendService::getBySjId($this->sjId);
  336. if ($extend['miniAuth'] == 0) {
  337. util::fail('您的小程序还没有授权');
  338. }
  339. $shop = ShopService::getById($id);
  340. ShopService::valid($shop, $this->sjId);
  341. $applyMemberCode = wxUtil::generateGatheringMiniCode($this->sj->attributes, $id);
  342. $file = dirUtil::getImgDir() . $applyMemberCode;
  343. if (file_exists($file) == false) {
  344. util::fail('没有找到注册会员码');
  345. }
  346. $fileName = "门店({$id})小程序收款码.jpg";
  347. $contentType = 'image/jpeg';
  348. header("Cache-control: private");
  349. header("Content-type: $contentType"); //设置要下载的文件类型
  350. header("Content-Length:" . filesize($file)); //设置要下载文件的文件大小
  351. header("Content-Disposition: attachment; filename=" . urldecode($fileName)); //设置要下载文件的文件名
  352. readfile($file);
  353. }
  354. //下载会员注册码 ssh 2020.2.29
  355. public function actionApplyMemberCode()
  356. {
  357. $id = Yii::$app->request->get('id', 0);
  358. $extend = MerchantExtendService::getBySjId($this->sjId);
  359. if ($extend['miniAuth'] == 0) {
  360. util::fail('您的小程序还没有授权');
  361. }
  362. $shop = ShopService::getById($id);
  363. ShopService::valid($shop, $this->sjId);
  364. $applyMemberCode = wxUtil::generateMemberCode($this->sj->attributes, $id);
  365. $file = dirUtil::getImgDir() . $applyMemberCode;
  366. if (file_exists($file) == false) {
  367. util::fail('没有找到注册会员码');
  368. }
  369. $fileName = "注册会员码{$id}.jpg";
  370. $contentType = 'image/jpeg';
  371. header("Cache-control: private");
  372. header("Content-type: $contentType"); //设置要下载的文件类型
  373. header("Content-Length:" . filesize($file)); //设置要下载文件的文件大小
  374. header("Content-Disposition: attachment; filename=" . urldecode($fileName)); //设置要下载文件的文件名
  375. readfile($file);
  376. }
  377. //删除门店 ssh 2020.3.1
  378. public function actionDelete()
  379. {
  380. util::fail('禁止操作');
  381. $id = Yii::$app->request->get('id', 0);
  382. util::fail('功能开发中');
  383. $shop = ShopService::getById($id);
  384. ShopService::valid($shop, $this->sjId);
  385. ShopService::deleteShop($shop);
  386. util::complete();
  387. }
  388. //获取门店详情 ssh 2021.4.23
  389. public function actionDetail()
  390. {
  391. $shopId = Yii::$app->request->get('shopId');
  392. if (empty($shopId)) {
  393. $shopId = $this->shopId;
  394. }
  395. $shop = ShopClass::getShopInfo($shopId);
  396. $shop['hasMap'] = dict::getDict('hasMap'); //添加 hasMap 属性(字典中的 hasMap)
  397. util::success(['info' => $shop]);
  398. }
  399. //提现信息更新 ssh 2021.3.23
  400. public function actionCashUpdate()
  401. {
  402. $get = Yii::$app->request->get();
  403. $cashAccount = $get['cashAccount'] ?? '';
  404. $cashName = $get['cashName'] ?? '';
  405. $cashBank = $get['cashBank'] ?? '';
  406. if (empty($cashName)) {
  407. util::fail('请填写姓名');
  408. }
  409. if (empty($cashAccount)) {
  410. util::fail('请填写银行卡号');
  411. }
  412. if (empty($cashBank)) {
  413. util::fail('请输入开户行');
  414. }
  415. $shopAdmin = $this->shopAdmin;
  416. $shopId = $shopAdmin->shopId ?? 0;
  417. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  418. util::fail('超管才能操作');
  419. }
  420. ShopClass::updateById($shopId, ['cashAccount' => $cashAccount, 'cashName' => $cashName, 'cashBank' => $cashBank]);
  421. $shop = $this->shop;
  422. $sjName = $shop->merchantName ?? '';
  423. $shopName = $shop->shopName ?? '';
  424. //noticeUtil::push("{$sjName}-{$shopName} 修改提现账号,{$cashName} {$cashAccount} {$cashBank}", '15280215347');
  425. util::complete();
  426. }
  427. //获取所有门店lqh 2021.1.31
  428. public function actionAll()
  429. {
  430. $res = [];
  431. $shopAdmin = isset($this->shopAdmin) && !empty($this->shopAdmin) ? $this->shopAdmin->attributes : [];
  432. if (isset($shopAdmin['super']) && $shopAdmin['super'] == 1) {
  433. $res = ShopClass::getAllShop($this->sjId);
  434. }
  435. util::success($res);
  436. }
  437. //获取采购时的支付方式 ssh 20211004
  438. public function actionGetCgPayWay()
  439. {
  440. $get = Yii::$app->request->get();
  441. $id = $get['id'] ?? 0;
  442. $cg = PurchaseClass::getById($id, true);
  443. PurchaseClass::valid($cg, $this->shopId);
  444. $customId = $cg->customId ?? 0;
  445. $custom = CustomClass::getById($customId);
  446. $hasDebtPay = $custom['debt'] ?? 0;
  447. //预订单不能欠款
  448. if ($cg->book == 1) {
  449. $hasDebtPay = 0;
  450. }
  451. $current = time();
  452. $cgDeadTime = strtotime($cg->deadline);
  453. //让客户在失效前$aheadTime秒要支付,这样回调通知时订单才不会过期状态
  454. $aheadTime = dict::getDict('order_online_pay_has_ahead_time');
  455. $count = $cgDeadTime - $current - $aheadTime;
  456. $data = [];
  457. $data['balance'] = $this->shop->balance ?? 0;
  458. $data['count'] = $count;
  459. $data['hasDebtPay'] = $hasDebtPay;
  460. util::success($data);
  461. }
  462. //地区 ssh 20220606
  463. public function actionRegion()
  464. {
  465. $regionTree = RegionService::tree();
  466. util::success(['region' => $regionTree]);
  467. }
  468. //散客门店详情 ssh 20211007
  469. public function actionKjCustom()
  470. {
  471. $defaultCustomId = $this->shop->defaultCustomId ?? 0;
  472. $custom = [];
  473. if (!empty($defaultCustomId)) {
  474. $custom = HdCustomClass::getById($defaultCustomId);
  475. $avatar = $custom['avatar'] ?? '';
  476. $custom['avatar'] = imgUtil::groupImg($avatar) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
  477. }
  478. util::success(['custom' => $custom]);
  479. }
  480. //散客门店设置
  481. public function actionKjCustomSet()
  482. {
  483. $id = Yii::$app->request->get('id', 0);
  484. $custom = HdCustomClass::getById($id, true);
  485. if (empty($custom)) {
  486. util::fail('没有找到客户');
  487. }
  488. if ($custom->shopId != $this->shopId) {
  489. util::fail('客户不属于当前门店');
  490. }
  491. $shop = $this->shop;
  492. $shop->defaultCustomId = $id;
  493. $shop->save();
  494. util::complete('修改成功');
  495. }
  496. public function actionUpdateShopAvatar()
  497. {
  498. $data = Yii::$app->request->post();
  499. $id = isset($data['id']) ? $data['id'] : 0;
  500. $shop = ShopClass::getById($id, true, 'id, sjId, avatar');
  501. ShopService::valid($shop, $this->sjId);
  502. if (isset($data['avatar']) && $data['avatar'] != '') {
  503. $shop->avatar = $data['avatar'];
  504. $re = $shop->save();
  505. if ($re) {
  506. \bizGhs\custom\classes\CustomClass::updateByCondition(['shopId' => $id], [
  507. 'avatar' => $data['avatar']
  508. ]);
  509. util::complete('头像修改完成');
  510. }
  511. util::fail('头像修改失败');
  512. }
  513. util::fail('头像参数出错');
  514. }
  515. //获取充值设置
  516. public function actionGetRechargeSetting()
  517. {
  518. $shopId = $this->shop->id;
  519. $shop = ShopClass::getById($shopId, false, 'rechargeWeal');
  520. $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], false, false, 'reachVip');
  521. $return = [
  522. 'rechargeRule' => $shop['rechargeWeal'] == 3 ? 2 : $shop['rechargeWeal'],
  523. 'isVipMember' => $shopExt['reachVip'] > 0 ? 1 : 0,
  524. 'vipAmount' => $shopExt['reachVip'],
  525. 'hbPayable' => $shop['rechargeWeal'] == 2 ? 1 : 0,
  526. ];
  527. util::success($return);
  528. }
  529. //充值设置
  530. public function actionSaveRechargeSetting()
  531. {
  532. $data = Yii::$app->request->post();
  533. $rechargeWeal = intval($data['rechargeRule']);
  534. $isVipMember = intval($data['isVipMember']);
  535. if ($isVipMember == 1 && $data['vipAmount'] >= 0.01) {
  536. $reachVip = floatval($data['vipAmount']);
  537. } else {
  538. $reachVip = 0;
  539. }
  540. $hbPayable = intval($data['hbPayable']);
  541. if ($rechargeWeal == 2 && $hbPayable == 0) {
  542. $rechargeWeal = 3;
  543. }
  544. $shopAdmin = $this->shopAdmin;
  545. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  546. util::fail('超管才能操作');
  547. }
  548. $shopId = $this->shop->id;
  549. ShopClass::updateById($shopId, ['rechargeWeal' => $rechargeWeal]);
  550. ShopExtClass::updateByCondition(['shopId' => $shopId], ['reachVip' => $reachVip]);
  551. util::complete('充值设置成功');
  552. }
  553. }