ShopController.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\shop\classes\MainClass;
  4. use biz\shop\classes\ShopAdminClass;
  5. use biz\shop\classes\ShopExtClass;
  6. use biz\sj\services\MerchantExtendService;
  7. use bizGhs\admin\classes\AdminClass;
  8. use bizGhs\custom\classes\CustomClass;
  9. use bizGhs\ghs\classes\GhsClass;
  10. use bizGhs\merchant\classes\ShopClass;
  11. use bizGhs\merchant\services\ShopService;
  12. use bizGhs\pictext\classes\PicTextClass;
  13. use bizHd\saas\services\RegionService;
  14. use common\components\arrayUtil;
  15. use common\components\dict;
  16. use common\components\dirUtil;
  17. use common\components\httpUtil;
  18. use common\components\imgUtil;
  19. use common\components\stringUtil;
  20. use common\components\util;
  21. use common\components\wxUtil;
  22. use Yii;
  23. use bizGhs\stat\classes\StatSaleClass;
  24. class ShopController extends BaseController
  25. {
  26. public $guestAccess = ['all'];
  27. //修改客户微信二维码 ssh 20240714
  28. public function actionChangeWx()
  29. {
  30. $get = Yii::$app->request->get();
  31. $url = $get['url'] ?? '';
  32. $shop = $this->shop;
  33. $shop->superWx = $url;
  34. $shop->save();
  35. util::complete('修改成功');
  36. }
  37. //我的可以进入的门店 ssh 20230424
  38. public function actionMyShop()
  39. {
  40. $staff = $this->shopAdmin;
  41. $shopList = [];
  42. if (isset($staff->super) && $staff->super == 1) {
  43. $sjId = $this->sjId ?? 0;
  44. $shopList = ShopClass::getAllByCondition(['sjId' => $sjId, 'ptStyle' => 2], null, 'id,shopName,merchantName,sjId,mainId,ptStyle', 'id');
  45. }
  46. $adminId = $this->adminId;
  47. $staffList = ShopAdminClass::getAllByCondition(['adminId' => $adminId], null, '*', null, true);
  48. $mainIdList = [];
  49. if (!empty($staffList)) {
  50. foreach ($staffList as $staff) {
  51. $isPt = $staff->isPt ?? 0;
  52. $delStatus = $staff->delStatus ?? 0;
  53. //$super = $staff->super ?? 0;
  54. $mainId = $staff->mainId ?? 0;
  55. if ($isPt == 0 && $delStatus == 0) {
  56. $mainIdList[] = $mainId;
  57. }
  58. }
  59. }
  60. if (!empty($mainIdList)) {
  61. $addShopList = ShopClass::getAllByCondition(['mainId' => ['in', $mainIdList], 'ptStyle' => 2], null, 'id,shopName,merchantName,sjId,mainId,ptStyle', 'id');
  62. if (!empty($addShopList)) {
  63. foreach ($addShopList as $addShop) {
  64. $addShopId = $addShop['id'] ?? 0;
  65. if (!isset($shopList[$addShopId])) {
  66. $shopList[$addShopId] = $addShop;
  67. }
  68. }
  69. }
  70. }
  71. $list = array_values($shopList);
  72. util::success(['list' => $list]);
  73. }
  74. //绑定零售店 ssh 20220430
  75. public function actionBindLsShop()
  76. {
  77. $id = Yii::$app->request->get('id');
  78. $connection = Yii::$app->db;
  79. $transaction = $connection->beginTransaction();
  80. util::fail('此方法已停用,如需启用请确认有没问题');
  81. try {
  82. $shop = $this->shop ?? [];
  83. $lsShopId = $shop->lsShopId ?? 0;
  84. if (!empty($lsShopId)) {
  85. util::fail('您已经绑定过了');
  86. }
  87. ShopClass::bindLsShopByCustomId($shop, $id, $this->adminId);
  88. $transaction->commit();
  89. util::complete();
  90. } catch (\Exception $exception) {
  91. $transaction->rollBack();
  92. util::fail('绑定失败');
  93. }
  94. }
  95. //预订设置 ssh 20220324
  96. public function actionBookSet()
  97. {
  98. $get = Yii::$app->request->get();
  99. $presell = $get['presell'] ?? 0;
  100. $this->shop->presell = $presell;
  101. $this->shop->save();
  102. util::complete();
  103. }
  104. //当前门店信息
  105. public function actionInfo()
  106. {
  107. $shop = $this->shop ?? [];
  108. util::success($shop);
  109. }
  110. //获取当前门店信息 ssh 2021.3.27
  111. public function actionCurrentShop()
  112. {
  113. $main = $this->shop;
  114. util::success($main);
  115. }
  116. //门店列表 ssh 2021.1.14
  117. public function actionList()
  118. {
  119. $where = [];
  120. $where['sjId'] = $this->sjId;
  121. $where['delStatus'] = 0;
  122. $list = ShopClass::getShopList($where);
  123. util::success($list);
  124. }
  125. //更新门店 ssh 2020.2.29
  126. public function actionUpdate()
  127. {
  128. $post = Yii::$app->request->post();
  129. $post['sjId'] = $this->sjId;
  130. $id = $post['id'] ?? 0;
  131. $shop = ShopService::getById($id);
  132. if (empty($shop)) {
  133. util::fail('没有找到门店,编号657701');
  134. }
  135. $staff = $this->shopAdmin;
  136. if (isset($staff->finance) == false || $staff->finance == 0) {
  137. //花掌柜的小石,源花汇的小吕和小吴,没有财务权限也要能修改门店
  138. if (!in_array($this->adminId, [4, 11961, 11976])) {
  139. util::fail('没有修改门店权限');
  140. }
  141. }
  142. if (isset($staff->super) == false || $staff->super == 0) {
  143. //花掌柜的小石,源花汇的小吕和小吴,没有改库存改价格权限也要能修改门店
  144. if (!in_array($this->adminId, [4, 11961, 11976])) {
  145. util::fail('没有修改门店权限哦');
  146. }
  147. }
  148. if ($this->mainId == 59421) {
  149. if (!in_array($this->adminId, [4])) {
  150. util::fail('已停用,请联系管理员');
  151. }
  152. }
  153. $post['meetNum'] = isset($post['meetNum']) && !empty($post['meetNum']) ? $post['meetNum'] : 0;
  154. $post['meetAmount'] = isset($post['meetAmount']) && !empty($post['meetAmount']) ? $post['meetAmount'] : 0;
  155. $post['cutAmount'] = isset($post['cutAmount']) && !empty($post['cutAmount']) ? $post['cutAmount'] : 0;
  156. ShopClass::valid($shop, $this->sjId);
  157. //手机号具有唯一性,暂时不允许修改
  158. unset($post['mobile']);
  159. $post['img'] = isset($post['img']) && is_array($post['img']) ? json_encode($post['img']) : '';
  160. \biz\shop\classes\ShopClass::updateShop($shop, $post);
  161. util::complete();
  162. }
  163. // 更新门店头像
  164. public function actionUpdateAvatar()
  165. {
  166. $post = Yii::$app->request->post();
  167. $shopId = $post['shopId'];
  168. if ($post['shopId'] != $this->shopId or $this->mainId == 0) {
  169. util::fail('不是您的门店');
  170. }
  171. $avatar = $post['avatar'];
  172. if ($avatar == '') {
  173. util::fail('头像地址不能为空');
  174. }
  175. $shop = ShopClass::getById($shopId, true);
  176. $shop->avatar = $avatar;
  177. $shop->save();
  178. $ptStyle = $shop['ptStyle'] ?? dict::getDict('ptStyle', 'hd');
  179. $update = ['avatar' => $avatar];
  180. $where = ['mainId' => $this->mainId];
  181. if ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
  182. GhsClass::updateByCondition($where, $update);
  183. } else {
  184. util::fail('门店头像更新失败,平台类型错误');
  185. }
  186. $shopImg = imgUtil::groupImg($shop->avatar);
  187. $smallShopImg = imgUtil::groupImg($shop->avatar) . "?x-oss-process=image/resize,m_fill,h_80,w_80";
  188. util::success(['shopImg' => $shopImg, 'smallShopImg' => $smallShopImg], '门店头像更新成功');
  189. }
  190. //添加门店 ssh 2021.1.14
  191. public function actionAdd()
  192. {
  193. $shop = $this->shop;
  194. $default = $shop->default ?? 0;
  195. if ($default == 0) {
  196. util::fail('当前直营分店,请切回总店添加');
  197. }
  198. $adminId = $this->adminId;
  199. $ptSuperAdminId = \biz\admin\classes\AdminClass::getPtSuperAdminId();
  200. if ($adminId != $shop->adminId && $adminId != $ptSuperAdminId) {
  201. util::fail('本店超管才能添加门店');
  202. }
  203. $mainId = $this->mainId;
  204. if (getenv('YII_ENV') == 'production') {
  205. if ($mainId == 42490) {
  206. util::fail('无法建分店,请联系石头');
  207. }
  208. } else {
  209. if ($mainId == 644) {
  210. util::fail('无法建分店,请联系石头');
  211. }
  212. }
  213. $data = Yii::$app->request->post();
  214. $data['sjId'] = $this->sjId;
  215. $data['shopId'] = $this->shopId;
  216. $data['adminId'] = $this->adminId;
  217. if (isset($data['shopName']) == false || empty($data['shopName'])) {
  218. util::fail('请填写门店名称');
  219. }
  220. $sj = $this->sj;
  221. $sjName = $sj->name ?? '';
  222. $ptStyle = $sj->style ?? dict::getDict('ptStyle', 'hd');
  223. $data['ptStyle'] = $ptStyle;
  224. $data['merchantName'] = $sjName;
  225. $data['default'] = 0;
  226. $connection = Yii::$app->db;
  227. $transaction = $connection->beginTransaction();
  228. try {
  229. $mobile = $data['mobile'] ?? 0;
  230. if (stringUtil::isMobile($mobile) == false) {
  231. util::fail('请填写正确手机号');
  232. }
  233. $adminInfo = ['name' => $mobile, 'mobile' => $mobile];
  234. $fromApp = dict::getDict('userSourceGetId', 'app', 'id');
  235. $admin = AdminClass::replaceAdmin($adminInfo, $fromApp);
  236. $adminId = $admin['id'] ?? 0;
  237. $data['adminId'] = $adminId;
  238. ShopClass::addMainShop($data, $this->shop, $this->sj);
  239. $transaction->commit();
  240. util::complete();
  241. } catch (\Exception $exception) {
  242. $transaction->rollBack();
  243. util::fail();
  244. }
  245. }
  246. //PC下载微信和支付宝收款码 ssh 2020.2.29
  247. public function actionGatheringCode()
  248. {
  249. $id = Yii::$app->request->get('id', 0);
  250. $shop = ShopService::getById($id);
  251. ShopClass::valid($shop, $this->sjId);
  252. $gatheringCode = ShopClass::generateGatheringCode($this->sjId, $id);
  253. $file = dirUtil::getImgDir() . $gatheringCode;
  254. if (file_exists($file) == false) {
  255. util::fail('没有找到收款码');
  256. }
  257. if (httpUtil::isMiniProgram()) {
  258. $imgUrl = imgUtil::getPrefix() . $gatheringCode;
  259. util::success(['imgUrl' => $imgUrl]);
  260. }
  261. $fileName = "门店({$id})收款码.jpg";
  262. $contentType = 'image/jpeg';
  263. header("Cache-control: private");
  264. header("Content-type: $contentType"); //设置要下载的文件类型
  265. header("Content-Length:" . filesize($file)); //设置要下载文件的文件大小
  266. header("Content-Disposition: attachment; filename=" . urldecode($fileName)); //设置要下载文件的文件名
  267. readfile($file);
  268. }
  269. //PC获取小程序的收款码 ssh
  270. public function actionGatheringMiniCode()
  271. {
  272. $id = Yii::$app->request->get('id', 0);
  273. $extend = MerchantExtendService::getBySjId($this->sjId);
  274. if ($extend['miniAuth'] == 0) {
  275. util::fail('您的小程序还没有授权');
  276. }
  277. $shop = ShopService::getById($id);
  278. ShopClass::valid($shop, $this->sjId);
  279. $applyMemberCode = wxUtil::generateGatheringMiniCode($this->sj->attributes, $id);
  280. $file = dirUtil::getImgDir() . $applyMemberCode;
  281. if (file_exists($file) == false) {
  282. util::fail('没有找到注册会员码');
  283. }
  284. if (httpUtil::isMiniProgram()) {
  285. $imgUrl = imgUtil::getPrefix() . $applyMemberCode;
  286. util::success(['imgUrl' => $imgUrl]);
  287. }
  288. $fileName = "门店({$id})小程序收款码.jpg";
  289. $contentType = 'image/jpeg';
  290. header("Cache-control: private");
  291. header("Content-type: $contentType"); //设置要下载的文件类型
  292. header("Content-Length:" . filesize($file)); //设置要下载文件的文件大小
  293. header("Content-Disposition: attachment; filename=" . urldecode($fileName)); //设置要下载文件的文件名
  294. readfile($file);
  295. }
  296. //PC下载会员注册码 ssh 2020.2.29
  297. public function actionApplyMemberCode()
  298. {
  299. $id = Yii::$app->request->get('id', 0);
  300. $extend = MerchantExtendService::getBySjId($this->sjId);
  301. if ($extend['miniAuth'] == 0) {
  302. util::fail('您的小程序还没有授权');
  303. }
  304. $shop = ShopService::getById($id);
  305. ShopClass::valid($shop, $this->sjId);
  306. $applyMemberCode = wxUtil::generateMemberCode($this->sj->attributes, $id);
  307. $file = dirUtil::getImgDir() . $applyMemberCode;
  308. if (file_exists($file) == false) {
  309. util::fail('没有找到注册会员码');
  310. }
  311. if (httpUtil::isMiniProgram()) {
  312. $imgUrl = imgUtil::getPrefix() . $applyMemberCode;
  313. util::success(['imgUrl' => $imgUrl]);
  314. }
  315. $fileName = "注册会员码{$id}.jpg";
  316. $contentType = 'image/jpeg';
  317. header("Cache-control: private");
  318. header("Content-type: $contentType"); //设置要下载的文件类型
  319. header("Content-Length:" . filesize($file)); //设置要下载文件的文件大小
  320. header("Content-Disposition: attachment; filename=" . urldecode($fileName)); //设置要下载文件的文件名
  321. readfile($file);
  322. }
  323. //删除门店 ssh 2020.3.1
  324. public function actionDelete()
  325. {
  326. util::fail('禁止操作');
  327. $id = Yii::$app->request->get('id', 0);
  328. $shop = ShopService::getById($id);
  329. ShopClass::valid($shop, $this->sjId);
  330. ShopClass::deleteShop($shop);
  331. util::complete();
  332. }
  333. //获取所有门店lqh 2021.1.31
  334. public function actionAll()
  335. {
  336. $res = ShopClass::getAllShop($this->sjId);
  337. util::success($res);
  338. }
  339. //切换门店 lqh 2021.1.31
  340. public function actionToggleShop()
  341. {
  342. $mainId = $this->mainId;
  343. $adminId = $this->adminId;
  344. if (getenv('YII_ENV') == 'production') {
  345. //安海恋善指定人不能切换门店
  346. if (in_array($mainId, [44759, 56314, 56315, 56452])) {
  347. if (in_array($adminId, [54630, 54723])) {
  348. util::fail('不能切换门店,原因是容易误操作或收银机登录使用');
  349. }
  350. }
  351. } else {
  352. if (in_array($mainId, [644])) {
  353. if (in_array($adminId, [919])) {
  354. //util::fail('不能切换门店,原因是容易误操作或收银机登录使用');
  355. }
  356. }
  357. }
  358. $shopAdmin = $this->shopAdmin;
  359. $switchShop = ShopAdminClass::hasSwitchShopRight($shopAdmin);
  360. if ($switchShop == 0) {
  361. util::fail('不能切换门店');
  362. }
  363. $newShopId = Yii::$app->request->post('shopId', 0);
  364. $newShop = ShopClass::getById($newShopId, true);
  365. if (empty($newShop)) {
  366. util::fail('没有找到门店66');
  367. }
  368. $res = AdminClass::toggleShop($this->admin, $newShop, $this->sjId, $this->shopAdmin);
  369. util::success($res);
  370. }
  371. //提现信息更新 ssh 2021.3.23
  372. public function actionCashUpdate()
  373. {
  374. $get = Yii::$app->request->get();
  375. $cashAccount = $get['cashAccount'] ?? '';
  376. $cashName = $get['cashName'] ?? '';
  377. $cashBank = $get['cashBank'] ?? '';
  378. if (empty($cashName)) {
  379. util::fail('请填写姓名');
  380. }
  381. if (empty($cashAccount)) {
  382. util::fail('请填写银行卡号');
  383. }
  384. if (empty($cashBank)) {
  385. util::fail('请输入开户行');
  386. }
  387. $shopAdmin = $this->shopAdmin;
  388. $mainId = $shopAdmin->mainId ?? 0;
  389. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  390. util::fail('超管才能操作');
  391. }
  392. MainClass::updateById($mainId, ['cashAccount' => $cashAccount, 'cashName' => $cashName, 'cashBank' => $cashBank]);
  393. $shop = $this->shop;
  394. $sjName = $shop->merchantName ?? '';
  395. $shopName = $shop->shopName ?? '';
  396. //noticeUtil::push("{$sjName}-{$shopName} 修改提现账号,{$cashName} {$cashAccount} {$cashBank}", '15280215347');
  397. util::complete();
  398. }
  399. //获取门店详情 ssh 2021.4.23
  400. public function actionDetail()
  401. {
  402. $shopId = Yii::$app->request->get('shopId');
  403. if (empty($shopId)) {
  404. $shopId = $this->shopId;
  405. }
  406. $shop = ShopClass::getById($shopId, true);
  407. if ($shop->mainId != $this->mainId) {
  408. //这个注释不能打开,因为首店可能修改其它分店信息
  409. //util::fail('无法查看');
  410. }
  411. util::success(['info' => $shop]);
  412. }
  413. //获取平台所有的供货商门店 ssh 20210908
  414. public function actionGetPtGhsShop()
  415. {
  416. $hasSale = Yii::$app->request->get('hasSale', 0);
  417. $name = Yii::$app->request->get('name', '');
  418. $arr = ['ptStyle' => 2, 'live' => 1];
  419. if (!empty($name)) {
  420. $arr['merchantName'] = ['like', $name];
  421. $hasSale = 0;
  422. }
  423. $shopList = ShopClass::getAllByCondition($arr, 'id asc', '*');
  424. $totalSale = 0;
  425. $totalShopNum = 0;
  426. $totalBalance = 0;
  427. if (!empty($shopList)) {
  428. foreach ($shopList as $key => $shop) {
  429. $mainId = $shop['mainId'] ?? 0;
  430. $main = MainClass::getById($mainId, true);
  431. $balance = $main->balance ?? 0;
  432. if (!empty($name) || $hasSale == 0) {
  433. $incomeList = [];
  434. } else {
  435. $respond = StatSaleClass::profile($mainId);
  436. $incomeList = $respond['income'] ?? [];
  437. }
  438. $todaySale = 0;
  439. if (!empty($incomeList)) {
  440. foreach ($incomeList as $item) {
  441. //调拨出库暂时不算到收入里去
  442. if (isset($item['id']) && $item['id'] == 'allot') {
  443. continue;
  444. }
  445. $todaySale = bcadd($todaySale, $item['amount'], 2);
  446. }
  447. }
  448. $shopList[$key]['balance'] = $balance;
  449. $shopList[$key]['todaySale'] = $todaySale;
  450. $count = CustomClass::getCount(['ownMainId' => $mainId]);
  451. $count = $count > 0 ? $count : 0;
  452. $shopList[$key]['shopNum'] = $count;
  453. if ($hasSale == 1 && $todaySale <= 0) {
  454. unset($shopList[$key]);
  455. }
  456. $totalSale = bcadd($totalSale, $todaySale, 2);
  457. $totalSale = floatval($totalSale);
  458. $totalBalance = bcadd($totalBalance, $balance, 2);
  459. $totalBalance = floatval($totalBalance);
  460. $totalShopNum = bcadd($totalShopNum, $count);
  461. }
  462. $shopList = arrayUtil::arraySort($shopList, 'todaySale');
  463. }
  464. util::success(['list' => $shopList, 'totalSale' => $totalSale, 'totalBalance' => $totalBalance, 'totalShopNum' => $totalShopNum]);
  465. }
  466. //切换门店 ssh 20220624
  467. public function actionSwitchGhsShop()
  468. {
  469. $shopId = Yii::$app->request->get('shopId', 0);
  470. $shop = ShopClass::getById($shopId, true);
  471. if (empty($shop)) {
  472. util::fail('没有找到门店67');
  473. }
  474. $shopAdmin = $this->shopAdmin;
  475. $admin = $this->admin;
  476. $adminId = $this->adminId ?? 0;
  477. if (getenv('YII_ENV') == 'production') {
  478. if (in_array($adminId, [4]) == false) {
  479. util::fail('开发中');
  480. }
  481. } else {
  482. if (in_array($adminId, [919]) == false) {
  483. util::fail('开发中');
  484. }
  485. }
  486. ShopAdminClass::changeShopAddRelate($shopAdmin, $shop, 1);
  487. $admin->currentGhsShopId = $shopId;
  488. $lsShopId = $shop->lsShopId ?? 0;
  489. $admin->currentShopId = $lsShopId;
  490. $admin->save();
  491. util::complete();
  492. }
  493. //散客门店详情 ssh 20211007
  494. public function actionSkCustom()
  495. {
  496. $skCustomId = $this->shop->skCustomId ?? 0;
  497. $custom = [];
  498. if (!empty($skCustomId)) {
  499. $custom = CustomClass::getById($skCustomId);
  500. $avatar = $custom['avatar'] ?? '';
  501. $custom['avatar'] = imgUtil::groupImg($avatar) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
  502. }
  503. util::success(['custom' => $custom]);
  504. }
  505. //散客门店设置
  506. public function actionSkCustomSet()
  507. {
  508. $id = Yii::$app->request->get('id', 0);
  509. $custom = CustomClass::getById($id, true);
  510. CustomClass::valid($custom, $this->shopId);
  511. $this->shop->skCustomId = $id;
  512. $this->shop->save();
  513. util::complete('修改成功');
  514. }
  515. //运费模式和运费成本设置 ssh 20211014
  516. public function actionUpdateCgModel()
  517. {
  518. $get = Yii::$app->request->get();
  519. $cgModel = $get['cgModel'] ?? 0;
  520. $cgPerCost = $get['cgPerCost'] ?? 0;
  521. if ($cgModel == 1) {
  522. if (is_numeric($cgPerCost) == false || $cgPerCost < 0) {
  523. util::fail('请输入运费成本');
  524. }
  525. $this->shop->cgPerCost = $cgPerCost;
  526. }
  527. $this->shop->cgModel = $cgModel;
  528. $this->shop->save();
  529. util::complete('修改成功');
  530. }
  531. //地区 ssh 20220606
  532. public function actionRegion()
  533. {
  534. $regionTree = RegionService::tree();
  535. util::success(['region' => $regionTree]);
  536. }
  537. //获取购买须知信息
  538. public function actionPurchaseGuide()
  539. {
  540. $shopId = intval($this->shopId);
  541. if ($shopId <= 0) {
  542. util::fail('门店数据错误');
  543. }
  544. $shopExt = ShopExtClass::getByCondition(['shopId'=>$shopId], false, false, 'id, shopId, purchaseGuide');
  545. if ($shopExt['purchaseGuide'] > 0){
  546. $picText = PicTextClass::getById($shopExt['purchaseGuide'], false, 'id, title');
  547. }
  548. if ($shopExt) {
  549. $shopExt['title'] = isset($picText['title']) ? $picText['title'] : '';
  550. util::success(['shopExt'=>$shopExt]);
  551. }
  552. util::fail('获取数据失败');
  553. }
  554. }