ProductController.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <?php
  2. /**
  3. * User: admin
  4. * Date Time: 2021/1/15 20:36
  5. */
  6. namespace ghs\controllers;
  7. use biz\admin\classes\AdminRoleClass;
  8. use biz\ghs\classes\GhsClass;
  9. use biz\item\classes\PtItemClass;
  10. use bizGhs\custom\classes\CustomClass;
  11. use bizGhs\item\classes\ItemClassClass;
  12. use bizGhs\merchant\classes\ShopClass;
  13. use bizGhs\product\classes\ProductClass;
  14. use bizGhs\product\models\Product;
  15. use bizGhs\product\services\ProductService;
  16. use common\components\printUtil;
  17. use common\components\stringUtil;
  18. use common\components\util;
  19. use Yii;
  20. class ProductController extends BaseController
  21. {
  22. public $guestAccess = ['index'];
  23. //打印花材的标签 ssh 20220602
  24. public function actionPrint()
  25. {
  26. $get = Yii::$app->request->get();
  27. $id = $get['id'] ?? 0;
  28. $num = $get['num'] ?? 1;
  29. $info = ProductClass::getById($id, true);
  30. if (empty($info)) {
  31. util::fail('没有找到花材');
  32. }
  33. $name = $info->name ?? '';
  34. $ptItemId = $info->itemId ?? 0;
  35. $ext = $this->shopExt;
  36. $printLabelSn = $ext->printLabelSn ?? '';
  37. if (empty($printLabelSn)) {
  38. util::fail('请设置标签打印机');
  39. }
  40. $p = new printUtil($printLabelSn);
  41. $unit = $info->ratio . $info->smallUnit . '/' . $info->bigUnit;
  42. $p->times = $num;
  43. $content = '<TEXT x="360" y="30" font="12" w="2" h="2" r="90">' . $name . '</TEXT>';
  44. $content .= '<BC128 x="260" y="30" h="80" s="1" r="90" n="5" w="12">' . $ptItemId . '</BC128>';
  45. $content .= '<TEXT x="60" y="30" font="12" w="2" h="2" r="90">' . $unit . '</TEXT>';
  46. $p->printLabelMsg($content);
  47. util::complete();
  48. }
  49. //按分类列出所有花材
  50. public function actionIndex()
  51. {
  52. $py = Yii::$app->request->get('py', '');
  53. $requestType = Yii::$app->request->get('requestType', 'common');
  54. //默认显示上架商品
  55. $status = Yii::$app->request->get('status', 1);
  56. //默认显示未删除商品
  57. $delStatus = Yii::$app->request->get('delStatus', 0);
  58. //获取所有当前供应商的分类 (全部、常用)
  59. //根据分类组装分类下的花材信息
  60. //中央ID
  61. $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
  62. $where['mainId'] = $this->mainId;
  63. if ($py) {
  64. $pyName = strtolower($py);
  65. $where['py'] = $pyName;
  66. }
  67. if ($requestType == 'hasStock') {
  68. //改价只显示库存大于0的
  69. $where['stock>'] = 0;
  70. }
  71. if (!empty($status)) {
  72. $where['status'] = $status;
  73. }
  74. $where['delStatus'] = $delStatus;
  75. //客户等级
  76. $customId = Yii::$app->request->get('customId', 0);
  77. $level = 1;
  78. if (!empty($customId)) {
  79. $custom = CustomClass::getById($customId, true);
  80. $level = $custom->level ?? 1;
  81. }
  82. $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], "*");
  83. $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
  84. $data = ProductService::assembleData($classIds, $itemInfoData, true);
  85. util::success($data);
  86. }
  87. //所有花材分页和不分页
  88. public function actionList()
  89. {
  90. $where = [];
  91. $classId = Yii::$app->request->get('classId', 0);
  92. if (!empty($classId)) {
  93. $where['classId'] = $classId;
  94. }
  95. $name = Yii::$app->request->get('name', '');
  96. if (empty($name)) {
  97. $py = Yii::$app->request->get('py', '');
  98. $name = !empty($py) ? $py : '';
  99. }
  100. if (!empty($name)) {
  101. if (stringUtil::isLetter($name)) {
  102. $where['py'] = ['like', $name];
  103. } else {
  104. $where['name'] = ['like', $name];
  105. }
  106. }
  107. $status = Yii::$app->request->get('status', 0);
  108. if (!empty($status)) {
  109. $where['status'] = $status;
  110. }
  111. $delStatus = Yii::$app->request->get('delStatus', 0);
  112. if ($delStatus != 2) {
  113. $where['delStatus'] = $delStatus;
  114. }
  115. $where['mainId'] = $this->mainId;
  116. $productIds = Yii::$app->request->get('ids', '');
  117. if (!empty($productIds)) {
  118. $productIdArr = explode(',', $productIds);
  119. if (!empty($productIdArr)) {
  120. $where['id'] = ['in', $productIdArr];
  121. }
  122. }
  123. //输出标准会员价,即花店价,默认显示的是花店价
  124. $level = 1;
  125. $type = Yii::$app->request->get('type', '');
  126. $showPage = Yii::$app->request->get('showPage', 0);
  127. if ($showPage) {
  128. if ($type == 'waring') {
  129. $pro = Product::find()->where("mainId={$this->mainId}")->andWhere('`stock`<`stockWarning`')->select('id')->asArray()->all();
  130. $lackIds = array_column($pro, 'id');
  131. if (empty($lackIds)) {
  132. util::success([]);
  133. }
  134. $lackIds = array_filter(array_unique($lackIds));
  135. $where['id'] = ['in', $lackIds];
  136. $respond = ProductClass::getList("*", $where, "actualSold desc");
  137. } else {
  138. $respond = ProductClass::getList("*", $where, "inTurn desc");
  139. }
  140. $respond['list'] = ProductClass::groupProductInfo($respond['list'], $level);
  141. $respond['list'] = ProductClass::groupClassName($this->sjId, $respond['list']);
  142. util::success($respond);
  143. } else {
  144. if ($type == 'waring') {
  145. //库存预警 按库存从小到大排序
  146. $data = ProductClass::getAllByCondition($where, ['stock' => SORT_ASC, 'inTurn' => SORT_DESC], "*");
  147. } else {
  148. if (!empty($productIds)) {
  149. //优先按 $productIds 排序 "FIELD(`id`,4,5,6)"=>true
  150. $data = ProductClass::getAllByCondition($where, ["FIELD(`id`,$productIds)" => true, 'inTurn' => SORT_DESC], "*");
  151. } else {
  152. $data = ProductClass::getAllByCondition($where, ['actualSold' => SORT_DESC, 'inTurn' => SORT_DESC], "*");
  153. }
  154. }
  155. $data = ProductClass::groupProductInfo($data, $level);
  156. $data = ProductClass::groupClassName($this->sjId, $data);
  157. if ($type == 'waring') {
  158. //库存预警
  159. $newData = [];
  160. foreach ($data as $v) {
  161. if ($v['stock'] <= $v['stockWarning']) {
  162. $newData[] = $v;
  163. }
  164. }
  165. util::success(['list' => $newData]);
  166. }
  167. util::success(['list' => $data]);
  168. }
  169. }
  170. //所有花材
  171. public function actionAll()
  172. {
  173. $where = [];
  174. $where['mainId'] = $this->mainId;
  175. $classId = Yii::$app->request->get('classId', 0);
  176. if (!empty($classId)) {
  177. $where['classId'] = $classId;
  178. }
  179. $status = Yii::$app->request->get('status', 0);
  180. if (!empty($status)) {
  181. $where['status'] = $status;
  182. }
  183. $delStatus = Yii::$app->request->get('delStatus', 0);
  184. if ($delStatus != 2) {
  185. $where['delStatus'] = $delStatus;
  186. }
  187. //输出标准会员价,即花店价,默认显示的是花店价
  188. $level = 1;
  189. $data = ProductClass::getAllByCondition($where, ['actualSold' => SORT_DESC, 'inTurn' => SORT_DESC], "*");
  190. $data = ProductClass::groupProductInfo($data, $level);
  191. util::success(['list' => $data]);
  192. }
  193. //批量改价
  194. public function actionBatchChangePrice()
  195. {
  196. $shop = $this->shop;
  197. $join = $shop->join ?? 0;
  198. $default = $shop->default ?? 0;
  199. if ($join == 0 && $default == 0) {
  200. util::fail('请在总店操作');
  201. }
  202. $shopAdmin = $this->shopAdmin;
  203. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  204. util::fail('超管才能修改');
  205. }
  206. $shop = $this->shop;
  207. $default = $shop->default ?? 0;
  208. $data = Yii::$app->request->post('data', '');
  209. if (empty($data)) {
  210. util::fail('没有修改');
  211. }
  212. $arr = json_decode($data, true);
  213. if (empty($arr)) {
  214. util::fail('没有修改哦');
  215. }
  216. $connection = Yii::$app->db;
  217. $transaction = $connection->beginTransaction();
  218. try {
  219. $ids = array_column($arr, 'id');
  220. $ids = array_unique(array_filter($ids));
  221. if (empty($ids)) {
  222. util::fail('请选择花材');
  223. }
  224. $sjId = $shop->sjId ?? 0;
  225. $chainShopList = [];
  226. if ($default == 1) {
  227. $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId, 'join' => 0], null, '*', null, true);
  228. }
  229. $productList = ProductClass::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id', true);
  230. foreach ($arr as $product) {
  231. $productId = $product['id'];
  232. $productInfo = $productList[$productId] ?? [];
  233. if (empty($productInfo)) {
  234. util::fail('没有找到花材');
  235. }
  236. $productName = $productInfo->name ?? '';
  237. if (isset($product['id']) == false) {
  238. util::fail('没有花材');
  239. }
  240. if (isset($product['price']) == false || is_numeric($product['price']) == false || $product['price'] < 0) {
  241. util::fail('请填写' . $productName . '的花店价');
  242. }
  243. $price = $product['price'];
  244. if (isset($product['skPrice']) == false || is_numeric($product['skPrice']) == false || $product['skPrice'] < 0) {
  245. util::fail('请填写' . $productName . '的散客价');
  246. }
  247. $skPrice = $product['skPrice'];
  248. if (isset($productInfo->mainId) == false || $productInfo->mainId != $this->mainId) {
  249. util::fail('没有权限访问');
  250. }
  251. if (empty($price)) {
  252. continue;
  253. }
  254. $ptItemId = $productInfo->itemId;
  255. ProductClass::changeSinglePrice($shop, $ptItemId, $price, $skPrice);
  256. //在首店修改需要同步到所有直营店
  257. if ($default == 1) {
  258. foreach ($chainShopList as $chain) {
  259. if ($chain->id == $shop->id) {
  260. continue;
  261. }
  262. ProductClass::changeSinglePrice($chain, $ptItemId, $price, $skPrice);
  263. }
  264. }
  265. }
  266. $transaction->commit();
  267. util::complete('修改成功');
  268. } catch (\Exception $e) {
  269. $transaction->rollBack();
  270. Yii::info("修改失败原因:" . $e->getMessage());
  271. util::fail('修改失败');
  272. }
  273. }
  274. //改价
  275. public function actionChangePrice()
  276. {
  277. $shopAdmin = $this->shopAdmin;
  278. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  279. util::fail('超管才能修改');
  280. }
  281. $productId = Yii::$app->request->post('productId', 0);
  282. $productInfo = ProductClass::getById($productId, true);
  283. if (empty($productInfo)) {
  284. util::fail("花材不存在");
  285. }
  286. if ($productInfo->mainId != $this->mainId) {
  287. util::fail('没有权限');
  288. }
  289. $price = Yii::$app->request->post('price', '');
  290. if (is_numeric($price) && $price > 0) {
  291. ProductClass::changeSinglePrice($productInfo, $price, ProductClass::PRICE_LABEL_CHANGE);
  292. } else {
  293. $price = bcadd($productInfo->cost, $productInfo->addPrice, 2);
  294. ProductClass::changeSinglePrice($productInfo, $price, ProductClass::PRICE_LABEL_AUTO);
  295. }
  296. util::success(['price' => $price]);
  297. }
  298. //恢复自动调价
  299. public function actionAutoPrice()
  300. {
  301. $productId = Yii::$app->request->post('productId', 0);
  302. $productData = ProductClass::getById($productId);
  303. if (!$productData) {
  304. util::fail("花材不存在");
  305. }
  306. //2021.04.06改为用product中的成本价+加价
  307. $price = bcadd($productData['cost'], $productData['addPrice'], 2);
  308. ProductClass::changeSinglePrice($productId, $this->shopId, $price, ProductClass::PRICE_LABEL_AUTO);
  309. util::complete("操作成功");
  310. }
  311. //修改加价
  312. public function actionChangeAddPrice()
  313. {
  314. $productId = Yii::$app->request->post('productId', 0);
  315. $addPrice = Yii::$app->request->post('addPrice', '');
  316. if ($addPrice < 0) {
  317. util::fail("加价不能小于0");
  318. }
  319. $productData = ProductClass::getProductData($productId, $this->mainId);
  320. if (!$productData) {
  321. util::fail("花材不存在");
  322. }
  323. ProductClass::changeAddPrice($productId, $addPrice);
  324. util::complete();
  325. }
  326. //批量修改更多,包括排序、重量和保质期 ssh 20211211
  327. public function actionBatchChangeMore()
  328. {
  329. $shop = $this->shop;
  330. $join = $shop->join ?? 0;
  331. $default = $shop->default ?? 0;
  332. if ($join == 0 && $default == 0) {
  333. util::fail('请在总店操作');
  334. }
  335. $shopAdmin = $this->shopAdmin;
  336. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  337. util::fail('超管才能操作');
  338. }
  339. $addData = Yii::$app->request->post('addData', '');
  340. if (empty($addData)) {
  341. util::fail('没有花材');
  342. }
  343. $itemData = json_decode($addData, true);
  344. if (is_array($itemData) == false) {
  345. util::fail('没有花材...');
  346. }
  347. $ids = array_column($itemData, 'id');
  348. $infoList = ProductClass::getByIds($ids);
  349. if (empty($infoList)) {
  350. util::fail('没有花材');
  351. }
  352. foreach ($infoList as $info) {
  353. if (isset($info['mainId']) == false || $info['mainId'] != $this->mainId) {
  354. util::fail('非常访问,不是你的花材不能修改');
  355. }
  356. }
  357. foreach ($itemData as $key => $data) {
  358. $id = $data['id'] ?? 0;
  359. ProductClass::updateById($id, $data);
  360. }
  361. util::complete('修改成功');
  362. }
  363. //批量修改加价 ssh 20211211
  364. public function actionBatchChangeAddPrice()
  365. {
  366. $shop = $this->shop;
  367. $join = $shop->join ?? 0;
  368. $default = $shop->default ?? 0;
  369. if ($join == 0 && $default == 0) {
  370. util::fail('请在总店操作');
  371. }
  372. $shopAdmin = $this->shopAdmin;
  373. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  374. util::fail('超管才能操作');
  375. }
  376. $addData = Yii::$app->request->post('addData', '');
  377. if (empty($addData)) {
  378. util::fail('没有花材');
  379. }
  380. $itemData = json_decode($addData, true);
  381. if (is_array($itemData) == false) {
  382. util::fail('没有花材...');
  383. }
  384. $ids = array_column($itemData, 'id');
  385. $infoList = ProductClass::getByIds($ids, null, 'id');
  386. if (empty($infoList)) {
  387. util::fail('没有花材');
  388. }
  389. foreach ($infoList as $info) {
  390. if (isset($info['mainId']) == false || $info['mainId'] != $this->mainId) {
  391. util::fail('不能修改别人的花材');
  392. }
  393. }
  394. //首店修改同步到所有直营店
  395. $sjId = $shop->sjId ?? 0;
  396. $chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId], null, '*', null, true);
  397. foreach ($itemData as $key => $data) {
  398. $id = $data['id'] ?? 0;
  399. unset($data['id']);
  400. ProductClass::updateById($id, $data);
  401. $ptItemId = $infoList[$id]['itemId'] ?? 0;
  402. if (empty($ptItemId)) {
  403. continue;
  404. }
  405. if (isset($shop->default) && $shop->default == 1) {
  406. foreach ($chainShopList as $chainShop) {
  407. if (isset($chainShop->join) && $chainShop->join == 1) {
  408. continue;
  409. }
  410. $currentMainId = $chainShop->mainId ?? 0;
  411. if ($currentMainId == $shop->mainId) {
  412. //前面已经修改过了,不需要重复修改
  413. continue;
  414. }
  415. ProductClass::updateByCondition(['mainId' => $currentMainId, 'itemId' => $ptItemId], $data);
  416. }
  417. }
  418. }
  419. util::complete('修改成功');
  420. }
  421. public function actionUpdate()
  422. {
  423. $shop = $this->shop;
  424. $join = $shop->join ?? 0;
  425. $default = $shop->default ?? 0;
  426. if ($join == 0 && $default == 0) {
  427. util::fail('请在总店操作');
  428. }
  429. $shopAdmin = $this->shopAdmin;
  430. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  431. util::fail('超管才能操作');
  432. }
  433. $post = Yii::$app->request->post();
  434. $post['adminId'] = $this->adminId;
  435. $post['staffName'] = $this->shopAdmin->name;
  436. ProductClass::updateProduct($post, $this->shop);
  437. util::complete();
  438. }
  439. //上下架状态控制 ssh 20210713
  440. public function actionStatusUpdate()
  441. {
  442. $post = Yii::$app->request->post();
  443. $shopAdmin = $this->shopAdmin;
  444. $roleId = $shopAdmin['roleId'] ?? 0;
  445. $role = AdminRoleClass::getById($roleId);
  446. $roleName = $role['roleName'] ?? '';
  447. if ($roleName == '员工') {
  448. util::fail('没有权限操作哦');
  449. }
  450. $id = $post['id'] ?? 0;
  451. $status = $post['status'] ?? 1;
  452. $product = ProductClass::getById($id, true);
  453. if ($product->mainId != $this->mainId) {
  454. util::fail('没有权限操作');
  455. }
  456. $product->status = $status;
  457. if ($status == 2) {
  458. $product->discountPrice = 0;
  459. }
  460. $product->save();
  461. util::complete();
  462. }
  463. //花材展示状态控制 ssh 20210804
  464. public function actionDelStatusUpdate()
  465. {
  466. $post = Yii::$app->request->post();
  467. $shopAdmin = $this->shopAdmin;
  468. $roleId = $shopAdmin['roleId'] ?? 0;
  469. $role = AdminRoleClass::getById($roleId);
  470. $roleName = $role['roleName'] ?? '';
  471. if ($roleName == '员工') {
  472. util::fail('没有权限操作');
  473. }
  474. $id = $post['id'] ?? 0;
  475. $delStatus = $post['delStatus'] ?? 0;
  476. $product = ProductClass::getById($id, true);
  477. if ($product->mainId != $this->mainId) {
  478. util::fail('没有权限操作');
  479. }
  480. $product->delStatus = $delStatus;
  481. $product->save();
  482. util::complete();
  483. }
  484. //详情 ruidian 2021.5.3
  485. public function actionDetail()
  486. {
  487. $id = Yii::$app->request->get('id', 0);
  488. $respond = ProductClass::getItemInfo($id);
  489. $ptItemId = $respond['itemId'] ?? 0;
  490. $ptItemInfo = PtItemClass::getById($ptItemId);
  491. $respond['ptItemInfo'] = $ptItemInfo;
  492. util::success($respond);
  493. }
  494. //新增花材 2021.6.21
  495. public function actionAdd()
  496. {
  497. $post = Yii::$app->request->post();
  498. $shop = $this->shop;
  499. $join = $shop->join ?? 0;
  500. $default = $shop->default ?? 0;
  501. if ($join == 0 && $default == 0) {
  502. util::fail('请在总店操作');
  503. }
  504. $shopAdmin = $this->shopAdmin;
  505. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  506. util::fail('管理员才能添加花材');
  507. }
  508. $post['sjId'] = $this->sjId;
  509. $post['adminId'] = $this->adminId;
  510. $post['mainId'] = $this->mainId;
  511. $price = $post['price'] ?? 0;
  512. $addPrice = $post['addPrice'] ?? 0;
  513. if ($addPrice > $price) {
  514. util::fail('加价不能大于售价');
  515. }
  516. $cost = bcsub($price, $addPrice, 2);
  517. $post['cost'] = $cost;
  518. $post['staffName'] = $shopAdmin->name ?? '';
  519. ProductClass::addProduct($post, $this->shop);
  520. util::complete('添加成功');
  521. }
  522. //获取拼音缩写 ssh 20210707
  523. public function actionPy()
  524. {
  525. $name = Yii::$app->request->get('name');
  526. $py = stringUtil::py($name);
  527. util::success(['py' => $py]);
  528. }
  529. //(客户端-批发商)复制花材
  530. public function actionClone()
  531. {
  532. $post = Yii::$app->request->post();
  533. $shop = $this->shop;
  534. $join = $shop->join ?? 0;
  535. $default = $shop->default ?? 0;
  536. if ($join == 0 && $default == 0) {
  537. util::fail('请在总店操作');
  538. }
  539. $shopAdmin = $this->shopAdmin;
  540. if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
  541. util::fail('管理员才能添加花材');
  542. }
  543. $shop = $this->shop;
  544. $default = $shop->default ?? 0;
  545. if ($default != 1) {
  546. util::fail('请在总店添加');
  547. }
  548. $post['sjId'] = $this->sjId;
  549. $post['adminId'] = $this->adminId;
  550. $post['mainId'] = $this->mainId;
  551. $post['staffName'] = $shopAdmin->name ?? '';
  552. $price = $post['price'] ?? 0;
  553. $addPrice = $post['addPrice'] ?? 0;
  554. if ($addPrice > $price) {
  555. util::fail('加价不能大于售价');
  556. }
  557. $cost = bcsub($price, $addPrice, 2);
  558. $post['cost'] = $cost;
  559. $post['copy'] = 1; //复制标识
  560. //去除无用的字段
  561. unset($post['viewNum']);
  562. unset($post['actualSold']);
  563. unset($post['itemId']);
  564. unset($post['id']);
  565. unset($post['delStatus']);
  566. ProductClass::addProduct($post, $this->shop);
  567. util::complete('复制成功');
  568. }
  569. //下载价格表 ssh 20210922
  570. public function actionGeneratePriceTable()
  571. {
  572. $level = Yii::$app->request->get('level', 0);
  573. $respond = ProductService::generatePriceTable($this->sjId, $level, $this->mainId);
  574. $file = $respond['file'] ?? '';
  575. $shortFile = $respond['shortFile'] ?? '';
  576. $fileUrl = Yii::$app->params['ghsHost'] . $file;
  577. util::success(['file' => $fileUrl, 'shortFile' => $shortFile]);
  578. }
  579. //下载条形码 lqh 20211227
  580. public function actionGenerateBarcodeTable()
  581. {
  582. $respond = ProductService::generateBarcodeTable($this->sjId, $this->shopId, $this->mainId);
  583. $file = $respond['file'] ?? '';
  584. $shortFile = $respond['shortFile'] ?? '';
  585. $fileUrl = Yii::$app->params['ghsHost'] . $file;
  586. util::success(['file' => $fileUrl, 'shortFile' => $shortFile]);
  587. }
  588. }