ProductController.php 22 KB

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