Goodssku.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863
  1. <?php
  2. /**
  3. * Goodssku.php
  4. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  5. * =========================================================
  6. * Copy right 2015-2025 杭州牛之云科技有限公司, 保留所有权利。
  7. * ----------------------------------------------
  8. * 官方网址: https://www.niushop.com
  9. * =========================================================
  10. * @author : niuteam
  11. * @date : 2022.8.8
  12. * @version : v5.0.0.1
  13. */
  14. namespace app\api\controller;
  15. use addon\bundling\api\controller\Bundling;
  16. use addon\coupon\api\controller\Coupon;
  17. use addon\coupon\model\CouponType;
  18. use addon\manjian\api\controller\Manjian;
  19. use app\model\express\Config as ExpressConfig;
  20. use app\model\goods\Goods;
  21. use app\model\goods\GoodsCategory as GoodsCategoryModel;
  22. use app\model\goods\GoodsService;
  23. use app\model\member\Member as MemberModel;
  24. use app\model\web\Config as ConfigModel;
  25. use think\facade\Db;
  26. /**
  27. * 商品sku
  28. * @author Administrator
  29. *
  30. */
  31. class Goodssku extends BaseApi
  32. {
  33. public function __construct()
  34. {
  35. parent::__construct();
  36. $this->initStoreData();
  37. }
  38. /**
  39. * 【废弃】基础信息
  40. */
  41. public function info()
  42. {
  43. $sku_id = isset($this->params[ 'sku_id' ]) ? $this->params[ 'sku_id' ] : 0;
  44. if (empty($sku_id)) {
  45. return $this->response($this->error('', 'REQUEST_SKU_ID'));
  46. }
  47. $goods = new Goods();
  48. $field = 'gs.goods_id,gs.sku_id,g.goods_image,g.goods_name,g.keywords,gs.sku_name,gs.sku_spec_format,gs.price,gs.market_price,gs.discount_price,gs.promotion_type
  49. ,gs.start_time,gs.end_time,gs.stock,gs.sku_image,gs.sku_images,gs.goods_spec_format,gs.unit,gs.max_buy,gs.min_buy,gs.is_limit,gs.limit_type';
  50. $info = $goods->getGoodsSkuDetail($sku_id, $this->site_id, $field);
  51. if (empty($info[ 'data' ])) return $this->response($this->error());
  52. $token = $this->checkToken();
  53. if ($token[ 'code' ] >= 0) {
  54. // 是否参与会员等级折扣
  55. $goods_member_price = $goods->getGoodsPrice($sku_id, $this->member_id)[ 'data' ];
  56. if (!empty($goods_member_price[ 'member_price' ])) {
  57. $info[ 'data' ][ 'member_price' ] = $goods_member_price[ 'member_price' ];
  58. }
  59. if ($info[ 'data' ][ 'is_limit' ] && $info[ 'data' ][ 'limit_type' ] == 2 && $info[ 'data' ][ 'max_buy' ] > 0) $res[ 'goods_sku_detail' ][ 'purchased_num' ] = $goods->getGoodsPurchasedNum($info[ 'data' ][ 'goods_id' ], $this->member_id);
  60. }
  61. // 查询当前商品参与的营销活动信息
  62. $goods_promotion = event('GoodsPromotion', [ 'goods_id' => $info[ 'data' ][ 'goods_id' ], 'sku_id' => $info[ 'data' ][ 'sku_id' ] ]);
  63. $info[ 'data' ][ 'goods_promotion' ] = $goods_promotion;
  64. //判断是否参与预售
  65. $is_join_presale = event('IsJoinPresale', [ 'sku_id' => $sku_id ], true);
  66. if (!empty($is_join_presale) && $is_join_presale[ 'code' ] == 0) {
  67. $info[ 'data' ] = array_merge($info[ 'data' ], $is_join_presale[ 'data' ]);
  68. }
  69. return $this->response($info);
  70. }
  71. /**
  72. * 详情信息
  73. */
  74. public function detail()
  75. {
  76. $sku_id = isset($this->params[ 'sku_id' ]) ? $this->params[ 'sku_id' ] : 0;
  77. $goods_id = isset($this->params[ 'goods_id' ]) ? $this->params[ 'goods_id' ] : 0;
  78. if (empty($sku_id) && empty($goods_id)) {
  79. return $this->response($this->error('', 'REQUEST_ID'));
  80. }
  81. $goods = new Goods();
  82. if (empty($sku_id) && !empty($goods_id)) {
  83. $sku_id = $goods->getGoodsInfo([ [ 'goods_id', '=', $goods_id ] ], 'sku_id')[ 'data' ][ 'sku_id' ] ?? 0;
  84. }
  85. $condition = [
  86. [ 'gs.sku_id', '=', $sku_id ],
  87. [ 'gs.site_id', '=', $this->site_id ]
  88. ];
  89. $field = 'gs.goods_id,gs.sku_id,gs.qr_id,gs.goods_name,gs.sku_name,gs.sku_spec_format,gs.price,gs.market_price,gs.discount_price,gs.promotion_type,gs.start_time
  90. ,gs.end_time,gs.stock,gs.click_num,(g.sale_num + g.virtual_sale) as sale_num,gs.collect_num,gs.sku_image,gs.sku_images
  91. ,gs.goods_content,gs.goods_state,gs.is_free_shipping,gs.goods_spec_format,gs.goods_attr_format,gs.introduction,gs.unit,gs.video_url
  92. ,gs.is_virtual,gs.goods_service_ids,gs.max_buy,gs.min_buy,gs.is_limit,gs.limit_type,gs.support_trade_type,g.goods_image,g.keywords,g.stock_show,g.sale_show,g.market_price_show,g.barrage_show,g.evaluate,g.goods_class,g.sale_store,g.sale_channel,g.label_name,g.category_id';
  93. $join = [
  94. [ 'goods g', 'g.goods_id = gs.goods_id', 'inner' ]
  95. ];
  96. // 如果是连锁运营模式
  97. if ($this->store_data[ 'config' ][ 'store_business' ] == 'store') {
  98. $join[] = [ 'store_goods_sku sgs', 'gs.sku_id = sgs.sku_id and sgs.store_id=' . $this->store_id, 'left' ];
  99. $field .= ',IFNULL(sgs.status, 0) as store_goods_status';
  100. $field = str_replace('gs.price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sgs.price), gs.price) as price', $field);
  101. $field = str_replace('gs.discount_price', 'IFNULL(IF(g.is_unify_price = 1,gs.discount_price,sgs.price), gs.discount_price) as discount_price', $field);
  102. if ($this->store_data[ 'store_info' ][ 'stock_type' ] == 'store') {
  103. $field = str_replace('gs.stock', 'IFNULL(sgs.stock, 0) as stock', $field);
  104. }
  105. }
  106. $goods_sku_detail = $goods->getGoodsSkuInfo($condition, $field, 'gs', $join)[ 'data' ];
  107. if (empty($goods_sku_detail)) return $this->response($this->error());
  108. // 处理商品支持的配送方式
  109. if ($this->store_data[ 'config' ][ 'store_business' ] == 'store') {
  110. $support_trade_type = explode(',', $goods_sku_detail[ 'support_trade_type' ]);
  111. $support_trade_type = array_map(function($item) {
  112. if ($item == 'express' && $this->store_data[ 'store_info' ][ 'is_express' ]) return $item;
  113. elseif ($item == 'local' && $this->store_data[ 'store_info' ][ 'is_o2o' ]) return $item;
  114. elseif ($item == 'store' && $this->store_data[ 'store_info' ][ 'is_pickup' ]) return $item;
  115. }, $support_trade_type);
  116. $goods_sku_detail[ 'support_trade_type' ] = implode(',', array_filter($support_trade_type));
  117. }
  118. $goods_sku_detail[ 'purchased_num' ] = 0; // 该商品已购数量
  119. $res[ 'goods_sku_detail' ] = $goods_sku_detail;
  120. $token = $this->checkToken();
  121. if ($token[ 'code' ] >= 0) {
  122. // 是否参与会员等级折扣
  123. $goods_member_price = $goods->getGoodsPrice($goods_sku_detail[ 'sku_id' ], $this->member_id, $this->store_id)[ 'data' ];
  124. if (!empty($goods_member_price[ 'member_price' ])) {
  125. $res[ 'goods_sku_detail' ][ 'member_price' ] = $goods_member_price[ 'member_price' ];
  126. }
  127. if ($goods_sku_detail[ 'is_limit' ] && $goods_sku_detail[ 'limit_type' ] == 2 && $goods_sku_detail[ 'max_buy' ] > 0) {
  128. $res[ 'goods_sku_detail' ][ 'purchased_num' ] = $goods->getGoodsPurchasedNum($goods_sku_detail[ 'goods_id' ], $this->member_id);
  129. }
  130. if (addon_is_exit('supermember')) {
  131. $member_model = new MemberModel();
  132. $member_info = $member_model->getMemberInfo([ [ 'member_id', '=', $this->member_id, [ 'site_id', '=', $this->site_id ] ] ], 'member_level_type')[ 'data' ];
  133. if ($member_info[ 'member_level_type' ] == 0) {
  134. $member_card_api = new \addon\supermember\api\controller\Membercard();
  135. $res[ 'goods_sku_detail' ][ 'membercard' ] = json_decode($member_card_api->recommendCard($goods_sku_detail[ 'sku_id' ]), true)[ 'data' ];
  136. }
  137. }
  138. }
  139. // 查询当前商品参与的营销活动信息
  140. $goods_promotion = event('GoodsPromotion', [ 'goods_id' => $goods_sku_detail[ 'goods_id' ], 'sku_id' => $goods_sku_detail[ 'sku_id' ] ]);
  141. $res[ 'goods_sku_detail' ][ 'goods_promotion' ] = $goods_promotion;
  142. // 判断是否参与预售
  143. $is_join_presale = event('IsJoinPresale', [ 'sku_id' => $goods_sku_detail[ 'sku_id' ] ], true);
  144. if (!empty($is_join_presale) && $is_join_presale[ 'code' ] == 0) {
  145. $res[ 'goods_sku_detail' ] = array_merge($res[ 'goods_sku_detail' ], $is_join_presale[ 'data' ]);
  146. }
  147. // 卡项商品
  148. if (addon_is_exit('cardservice') && $goods_sku_detail[ 'goods_class' ] == 5) {
  149. $card_model = new \addon\cardservice\model\CardGoods();
  150. $res[ 'goods_sku_detail' ][ 'card_info' ] = $card_model->getGoodsCardDetail($goods_sku_detail[ 'goods_id' ], $this->site_id, $this->store_data)[ 'data' ];
  151. }
  152. // 分销佣金详情
  153. if (addon_is_exit('fenxiao')) {
  154. $fenxiao_api = new \addon\fenxiao\api\controller\Goods();
  155. $res[ 'goods_sku_detail' ][ 'fenxiao_detail' ] = json_decode($fenxiao_api->detail($goods_sku_detail[ 'sku_id' ]), true)[ 'data' ];
  156. }
  157. // 查询商品可用的优惠券
  158. if (addon_is_exit('coupon')) {
  159. $coupon_api = new Coupon();
  160. $res[ 'goods_sku_detail' ][ 'coupon_list' ] = json_decode($coupon_api->goodsCoupon($goods_sku_detail[ 'goods_id' ]), true)[ 'data' ];
  161. }
  162. // 组合套餐,连锁门店没有营销活动
  163. if (addon_is_exit('bundling') && $this->store_data[ 'config' ][ 'store_business' ] == 'shop') {
  164. $bundling_api = new Bundling();
  165. $res[ 'goods_sku_detail' ][ 'bundling_list' ] = json_decode($bundling_api->lists($goods_sku_detail[ 'sku_id' ]), true)[ 'data' ];
  166. }
  167. // 满减
  168. if (addon_is_exit('manjian')) {
  169. $manjian_api = new Manjian();
  170. $res[ 'goods_sku_detail' ][ 'manjian' ] = json_decode($manjian_api->info($goods_sku_detail[ 'goods_id' ]), true)[ 'data' ];
  171. }
  172. // 处理公共数据
  173. $this->handleGoodsDetailData($res[ 'goods_sku_detail' ]);
  174. return $this->response($this->success($res));
  175. }
  176. /**
  177. * 查询商品SKU集合
  178. * @return false|string
  179. */
  180. public function goodsSku()
  181. {
  182. $goods_id = isset($this->params[ 'goods_id' ]) ? $this->params[ 'goods_id' ] : 0;
  183. if (empty($goods_id)) {
  184. return $this->response($this->error('', 'REQUEST_ID'));
  185. }
  186. $goods = new Goods();
  187. $condition = [
  188. [ 'gs.goods_id', '=', $goods_id ],
  189. [ 'gs.site_id', '=', $this->site_id ]
  190. ];
  191. $field = 'gs.sku_id,g.goods_image,gs.sku_name,gs.sku_spec_format,gs.price,gs.discount_price,gs.promotion_type,gs.end_time,gs.stock,gs.sku_image,gs.sku_images,gs.goods_spec_format,gs.is_limit,gs.limit_type,gs.market_price,g.goods_state';
  192. $join = [
  193. [ 'goods g', 'g.goods_id = gs.goods_id', 'inner' ]
  194. ];
  195. // 如果是连锁运营模式
  196. if ($this->store_data[ 'config' ][ 'store_business' ] == 'store') {
  197. $join[] = [ 'store_goods_sku sgs', 'gs.sku_id = sgs.sku_id and sgs.store_id=' . $this->store_id, 'left' ];
  198. $field = str_replace('gs.price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sgs.price), gs.price) as price', $field);
  199. $field = str_replace('gs.discount_price', 'IFNULL(IF(g.is_unify_price = 1,gs.discount_price,sgs.price), gs.discount_price) as discount_price', $field);
  200. if ($this->store_data[ 'store_info' ][ 'stock_type' ] == 'store') {
  201. $field = str_replace('gs.stock', 'IFNULL(sgs.stock, 0) as stock', $field);
  202. }
  203. }
  204. $list = $goods->getGoodsSkuList($condition, $field, 'gs.sku_id asc', null, 'gs', $join);
  205. $token = $this->checkToken();
  206. foreach ($list[ 'data' ] as $k => $v) {
  207. if ($token[ 'code' ] >= 0) {
  208. // 是否参与会员等级折扣
  209. $goods_member_price = $goods->getGoodsPrice($v[ 'sku_id' ], $this->member_id, $this->store_id)[ 'data' ];
  210. if (!empty($goods_member_price[ 'member_price' ])) {
  211. $list[ 'data' ][ $k ][ 'member_price' ] = $goods_member_price[ 'member_price' ];
  212. }
  213. if (addon_is_exit('supermember')) {
  214. $member_model = new MemberModel();
  215. $member_info = $member_model->getMemberInfo([ [ 'member_id', '=', $this->member_id, [ 'site_id', '=', $this->site_id ] ] ], 'member_level_type')[ 'data' ];
  216. if ($member_info[ 'member_level_type' ] == 0) {
  217. $member_card_api = new \addon\supermember\api\controller\Membercard();
  218. $list[ 'data' ][ $k ][ 'membercard' ] = json_decode($member_card_api->recommendCard($v[ 'sku_id' ]), true)[ 'data' ];
  219. }
  220. }
  221. if ($v[ 'is_limit' ] && $v[ 'limit_type' ] == 2 && $v[ 'max_buy' ] > 0) {
  222. $list[ 'data' ][ $k ][ 'purchased_num' ] = $goods->getGoodsPurchasedNum($v[ 'goods_id' ], $this->member_id);
  223. }
  224. }
  225. // 查询当前商品参与的营销活动信息
  226. $goods_promotion = event('GoodsPromotion', [ 'goods_id' => $goods_id, 'sku_id' => $v[ 'sku_id' ] ]);
  227. $list[ 'data' ][ $k ][ 'goods_promotion' ] = $goods_promotion;
  228. //判断是否参与预售
  229. $is_join_presale = event('IsJoinPresale', [ 'sku_id' => $v[ 'sku_id' ] ], true);
  230. if (!empty($is_join_presale) && $is_join_presale[ 'code' ] == 0) {
  231. $list[ 'data' ][ $k ] = array_merge($list[ 'data' ][ $k ], $is_join_presale[ 'data' ]);
  232. }
  233. // 分销佣金详情
  234. if (addon_is_exit('fenxiao')) {
  235. $fenxiao_api = new \addon\fenxiao\api\controller\Goods();
  236. $list[ 'data' ][ $k ][ 'fenxiao_detail' ] = json_decode($fenxiao_api->detail($v[ 'sku_id' ]), true)[ 'data' ];
  237. }
  238. }
  239. return $this->response($list);
  240. }
  241. /**
  242. * 商品详情,商品分类用
  243. * @return false|string
  244. */
  245. public function getInfoForCategory()
  246. {
  247. $sku_id = isset($this->params[ 'sku_id' ]) ? $this->params[ 'sku_id' ] : 0;
  248. if (empty($sku_id)) {
  249. return $this->response($this->error('', 'REQUEST_SKU_ID'));
  250. }
  251. $goods = new Goods();
  252. $condition = [
  253. [ 'gs.sku_id', '=', $sku_id ],
  254. [ 'gs.site_id', '=', $this->site_id ]
  255. ];
  256. $field = 'gs.goods_id,gs.sku_id,gs.goods_name,gs.is_limit,gs.limit_type,gs.sku_name,gs.sku_spec_format,gs.price,gs.discount_price,gs.stock,gs.sku_image,gs.goods_spec_format,gs.unit,gs.max_buy,gs.min_buy,gs.goods_state';
  257. $join = [
  258. [ 'goods g', 'g.goods_id = gs.goods_id', 'inner' ]
  259. ];
  260. // 如果是连锁运营模式
  261. if ($this->store_data[ 'config' ][ 'store_business' ] == 'store') {
  262. $join[] = [ 'store_goods_sku sgs', 'gs.sku_id = sgs.sku_id and sgs.store_id=' . $this->store_id, 'left' ];
  263. $field = str_replace('gs.price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sgs.price), gs.price) as price', $field);
  264. $field = str_replace('gs.discount_price', 'IFNULL(IF(g.is_unify_price = 1,gs.discount_price,sgs.price), gs.discount_price) as discount_price', $field);
  265. if ($this->store_data[ 'store_info' ][ 'stock_type' ] == 'store') {
  266. $field = str_replace('gs.stock', 'IFNULL(sgs.stock, 0) as stock', $field);
  267. }
  268. }
  269. $goods_sku_detail = $goods->getGoodsSkuInfo($condition, $field, 'gs', $join);
  270. $token = $this->checkToken();
  271. if ($token[ 'code' ] >= 0) {
  272. // 是否参与会员等级折扣
  273. $goods_member_price = $goods->getGoodsPrice($sku_id, $this->member_id, $this->store_id)[ 'data' ];
  274. if (!empty($goods_member_price[ 'member_price' ])) {
  275. $goods_sku_detail[ 'data' ][ 'member_price' ] = $goods_member_price[ 'member_price' ];
  276. }
  277. if ($goods_sku_detail[ 'data' ][ 'max_buy' ] > 0) $goods_sku_detail[ 'data' ][ 'purchased_num' ] = $goods->getGoodsPurchasedNum($goods_sku_detail[ 'data' ][ 'goods_id' ], $this->member_id);
  278. }
  279. return $this->response($goods_sku_detail);
  280. }
  281. /**
  282. * 查询商品SKU集合,商品分类用
  283. * @return false|string
  284. */
  285. public function goodsSkuByCategory()
  286. {
  287. $goods_id = isset($this->params[ 'goods_id' ]) ? $this->params[ 'goods_id' ] : 0;
  288. if (empty($goods_id)) {
  289. return $this->response($this->error('', 'REQUEST_ID'));
  290. }
  291. $goods = new Goods();
  292. $condition = [
  293. [ 'gs.goods_id', '=', $goods_id ],
  294. [ 'gs.site_id', '=', $this->site_id ]
  295. ];
  296. $field = 'gs.sku_id,gs.sku_name,gs.sku_spec_format,gs.price,gs.discount_price,gs.promotion_type,gs.end_time,gs.stock,gs.sku_image,gs.goods_spec_format';
  297. $join = [
  298. [ 'goods g', 'g.goods_id = gs.goods_id', 'inner' ]
  299. ];
  300. // 如果是连锁运营模式
  301. if ($this->store_data[ 'config' ][ 'store_business' ] == 'store') {
  302. $join[] = [ 'store_goods_sku sgs', 'gs.sku_id = sgs.sku_id and sgs.store_id=' . $this->store_id, 'left' ];
  303. $field = str_replace('gs.price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sgs.price), gs.price) as price', $field);
  304. $field = str_replace('gs.discount_price', 'IFNULL(IF(g.is_unify_price = 1,gs.discount_price,sgs.price), gs.discount_price) as discount_price', $field);
  305. if ($this->store_data[ 'store_info' ][ 'stock_type' ] == 'store') {
  306. $field = str_replace('gs.stock', 'IFNULL(sgs.stock, 0) as stock', $field);
  307. }
  308. }
  309. $list = $goods->getGoodsSkuList($condition, $field, 'gs.sku_id asc', null, 'gs', $join);
  310. $token = $this->checkToken();
  311. foreach ($list[ 'data' ] as $k => $v) {
  312. if ($token[ 'code' ] >= 0) {
  313. // 是否参与会员等级折扣
  314. $goods_member_price = $goods->getGoodsPrice($v[ 'sku_id' ], $this->member_id, $this->store_id)[ 'data' ];
  315. if (!empty($goods_member_price[ 'member_price' ])) {
  316. $list[ 'data' ][ $k ][ 'member_price' ] = $goods_member_price[ 'member_price' ];
  317. }
  318. }
  319. }
  320. return $this->response($list);
  321. }
  322. /**
  323. * 列表信息
  324. */
  325. public function page()
  326. {
  327. $page = isset($this->params[ 'page' ]) ? $this->params[ 'page' ] : 1;
  328. $page_size = isset($this->params[ 'page_size' ]) ? $this->params[ 'page_size' ] : PAGE_LIST_ROWS;
  329. $goods_id_arr = isset($this->params[ 'goods_id_arr' ]) ? $this->params[ 'goods_id_arr' ] : '';//goods_id数组
  330. $keyword = isset($this->params[ 'keyword' ]) ? trim($this->params[ 'keyword' ]) : '';//关键词
  331. $category_id = isset($this->params[ 'category_id' ]) ? $this->params[ 'category_id' ] : 0;//分类
  332. $brand_id = $this->params[ 'brand_id' ] ?? 0; //品牌
  333. $min_price = isset($this->params[ 'min_price' ]) ? $this->params[ 'min_price' ] : 0;//价格区间,小
  334. $max_price = isset($this->params[ 'max_price' ]) ? $this->params[ 'max_price' ] : 0;//价格区间,大
  335. $is_free_shipping = isset($this->params[ 'is_free_shipping' ]) ? $this->params[ 'is_free_shipping' ] : 0;//是否免邮
  336. $order = isset($this->params[ 'order' ]) ? $this->params[ 'order' ] : "";//排序(综合、销量、价格)
  337. $sort = isset($this->params[ 'sort' ]) ? $this->params[ 'sort' ] : "";//升序、降序
  338. $coupon = isset($this->params[ 'coupon' ]) ? $this->params[ 'coupon' ] : 0;//优惠券
  339. $condition = [];
  340. $condition[] = [ 'gs.site_id', '=', $this->site_id ];
  341. $condition[] = [ '', 'exp', Db::raw("(g.sale_channel = 'all' OR g.sale_channel = 'online')") ];
  342. if (!empty($goods_id_arr)) {
  343. $condition[] = [ 'gs.goods_id', 'in', $goods_id_arr ];
  344. }
  345. if (!empty($keyword)) {
  346. $condition[] = [ 'g.goods_name|gs.sku_name|gs.keywords|g.introduction', 'like', '%' . $keyword . '%' ];
  347. }
  348. if (!empty($brand_id)) {
  349. $condition[] = [ 'g.brand_id', '=', $brand_id ];
  350. }
  351. if (!empty($category_id)) {
  352. $goods_category_model = new GoodsCategoryModel();
  353. // 查询当前
  354. $category_list = $goods_category_model->getCategoryList([ [ 'category_id', '=', $category_id ], [ 'site_id', '=', $this->site_id ] ], 'category_id,pid,level')[ 'data' ];
  355. // 查询子级
  356. $category_child_list = $goods_category_model->getCategoryList([ [ 'pid', '=', $category_id ], [ 'site_id', '=', $this->site_id ] ], 'category_id,pid,level')[ 'data' ];
  357. $temp_category_list = [];
  358. if (!empty($category_list)) {
  359. $temp_category_list = $category_list;
  360. } elseif (!empty($category_child_list)) {
  361. $temp_category_list = $category_child_list;
  362. }
  363. if (!empty($temp_category_list)) {
  364. $category_id_arr = [];
  365. foreach ($temp_category_list as $k => $v) {
  366. // 三级分类,并且都能查询到
  367. if ($v[ 'level' ] == 3 && !empty($category_list) && !empty($category_child_list)) {
  368. array_push($category_id_arr, $v[ 'pid' ]);
  369. } else {
  370. array_push($category_id_arr, $v[ 'category_id' ]);
  371. }
  372. }
  373. $category_id_arr = array_unique($category_id_arr);
  374. $temp_condition = [];
  375. foreach ($category_id_arr as $ck => $cv) {
  376. $temp_condition[] = '%,' . $cv . ',%';
  377. }
  378. $category_condition = $temp_condition;
  379. $condition[] = [ 'g.category_id', 'like', $category_condition, 'or' ];
  380. }
  381. }
  382. if ($min_price != "" && $max_price != "") {
  383. $condition[] = [ 'gs.discount_price', 'between', [ $min_price, $max_price ] ];
  384. } elseif ($min_price != "") {
  385. $condition[] = [ 'gs.discount_price', '>=', $min_price ];
  386. } elseif ($max_price != "") {
  387. $condition[] = [ 'gs.discount_price', '<=', $max_price ];
  388. }
  389. if (!empty($is_free_shipping)) {
  390. $condition[] = [ 'gs.is_free_shipping', '=', $is_free_shipping ];
  391. }
  392. // 非法参数进行过滤
  393. if ($sort != "desc" && $sort != "asc") {
  394. $sort = "";
  395. }
  396. // 非法参数进行过滤
  397. if ($order != '') {
  398. if ($order != "sale_num" && $order != "discount_price" && $order != "create_time") {
  399. $order = 'gs.sort';
  400. } elseif ($order == "sale_num") {
  401. $order = 'sale_sort';
  402. } elseif ($order == "create_time") {
  403. $order = 'g.create_time';
  404. } else {
  405. $order = 'gs.' . $order;
  406. }
  407. $order_by = $order . ' ' . $sort;
  408. } else {
  409. $config_model = new ConfigModel();
  410. $sort_config = $config_model->getGoodsSort($this->site_id);
  411. $sort_config = $sort_config[ 'data' ][ 'value' ];
  412. $order_by = 'g.sort ' . $sort_config[ 'type' ] . ',g.create_time desc';
  413. }
  414. // 优惠券
  415. if (!empty($coupon)) {
  416. $coupon_type = new CouponType();
  417. $coupon_type_info = $coupon_type->getInfo([
  418. [ 'coupon_type_id', '=', $coupon ],
  419. [ 'site_id', '=', $this->site_id ],
  420. [ 'goods_type', '=', 2 ]
  421. ], 'goods_ids')[ 'data' ];
  422. if (isset($coupon_type_info[ 'goods_ids' ]) && !empty($coupon_type_info[ 'goods_ids' ])) {
  423. $condition[] = [ 'g.goods_id', 'in', explode(',', trim($coupon_type_info[ 'goods_ids' ], ',')) ];
  424. }
  425. }
  426. $condition[] = [ 'g.goods_state', '=', 1 ];
  427. $condition[] = [ 'g.is_delete', '=', 0 ];
  428. $alias = 'gs';
  429. $field = 'gs.is_consume_discount,gs.discount_config,gs.discount_method,gs.member_price,gs.goods_id,gs.sort,gs.sku_id,gs.sku_name,gs.price,gs.market_price,gs.discount_price,gs.stock,(g.sale_num + g.virtual_sale) as sale_num,(gs.sale_num + gs.virtual_sale) as sale_sort,gs.sku_image,gs.goods_name,gs.site_id,gs.is_free_shipping,gs.introduction,gs.promotion_type,g.goods_image,g.promotion_addon,gs.is_virtual,g.goods_spec_format,g.recommend_way,gs.max_buy,gs.min_buy,gs.unit,gs.is_limit,gs.limit_type,g.label_name,g.stock_show,g.sale_show,g.market_price_show,g.barrage_show,g.sale_channel,g.sale_store';
  430. $join = [
  431. [ 'goods g', 'gs.sku_id = g.sku_id', 'inner' ]
  432. ];
  433. // 如果是连锁运营模式
  434. if ($this->store_data[ 'config' ][ 'store_business' ] == 'store') {
  435. $join[] = [ 'store_goods_sku sgs', 'g.sku_id = sgs.sku_id and sgs.store_id=' . $this->store_id, 'left' ];
  436. $condition[] = [ 'g.sale_store', 'like', [ '%all%', '%,' . $this->store_id . ',%' ], 'or' ];
  437. $condition[] = [ 'sgs.status', '=', 1 ];
  438. $field = str_replace('gs.price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sgs.price), gs.price) as price', $field);
  439. $field = str_replace('gs.discount_price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sgs.price), gs.price) as discount_price', $field);
  440. if ($this->store_data[ 'store_info' ][ 'stock_type' ] == 'store') {
  441. $field = str_replace('gs.stock', 'IFNULL(sgs.stock, 0) as stock', $field);
  442. }
  443. }
  444. $goods = new Goods();
  445. $list = $goods->getGoodsSkuPageList($condition, $page, $page_size, $order_by, $field, $alias, $join);
  446. if (!empty($list[ 'data' ][ 'list' ])) {
  447. // 商品列表配置
  448. $config_model = new ConfigModel();
  449. $goods_list_config = $config_model->getGoodsListConfig($this->site_id, $this->app_module)[ 'data' ][ 'value' ];
  450. $list[ 'data' ][ 'config' ] = $goods_list_config;
  451. }
  452. $token = $this->checkToken();
  453. if ($token[ 'code' ] >= 0) {
  454. if (!empty($list[ 'data' ][ 'list' ])) {
  455. $list[ 'data' ][ 'list' ] = $goods->getGoodsListMemberPrice($list[ 'data' ][ 'list' ], $this->member_id);
  456. }
  457. }
  458. return $this->response($list);
  459. }
  460. /**
  461. * 查询商品列表供组件调用
  462. */
  463. public function pageComponents()
  464. {
  465. $token = $this->checkToken();
  466. $page = isset($this->params[ 'page' ]) ? $this->params[ 'page' ] : 1;
  467. $page_size = isset($this->params[ 'page_size' ]) ? $this->params[ 'page_size' ] : PAGE_LIST_ROWS;
  468. $goods_id_arr = isset($this->params[ 'goods_id_arr' ]) ? $this->params[ 'goods_id_arr' ] : '';//goods_id数组
  469. $category_id = isset($this->params[ 'category_id' ]) ? $this->params[ 'category_id' ] : 0;//分类
  470. $order = isset($this->params[ 'order' ]) ? $this->params[ 'order' ] : "";//排序(综合、销量、价格)
  471. $condition = [
  472. [ 'g.goods_state', '=', 1 ],
  473. [ 'g.is_delete', '=', 0 ],
  474. [ 'g.site_id', '=', $this->site_id ],
  475. [ '', 'exp', Db::raw("(g.sale_channel = 'all' OR g.sale_channel = 'online')") ]
  476. ];
  477. if (!empty($category_id)) {
  478. $condition[] = [ 'category_id', 'like', '%,' . $category_id . ',%' ];
  479. }
  480. if (!empty($goods_id_arr)) {
  481. $condition[] = [ 'g.goods_id', 'in', $goods_id_arr ];
  482. }
  483. // 非法参数进行过滤
  484. if ($order != '') {
  485. if ($order == 'default') {
  486. // 综合排序
  487. $order = 'g.sort asc,g.create_time';
  488. $sort = 'desc';
  489. } elseif ($order == 'sales') {
  490. // 销量排序
  491. $order = 'sale_num';
  492. $sort = 'desc';
  493. } else if ($order == 'price') {
  494. // 价格排序
  495. $order = 'gs.discount_price';
  496. $sort = 'asc';
  497. } else if ($order == 'news') {
  498. // 上架时间排序
  499. $order = 'g.create_time';
  500. $sort = 'desc';
  501. } else {
  502. $order = 'g.' . $order;
  503. $sort = 'asc';
  504. }
  505. $order_by = $order . ' ' . $sort;
  506. } else {
  507. $config_model = new ConfigModel();
  508. $sort_config = $config_model->getGoodsSort($this->site_id);
  509. $sort_config = $sort_config[ 'data' ][ 'value' ];
  510. $order_by = 'g.sort ' . $sort_config[ 'type' ] . ',g.create_time desc';
  511. }
  512. $field = 'gs.goods_id,gs.sku_id,gs.price,gs.market_price,gs.discount_price,g.goods_stock,(g.sale_num + g.virtual_sale) as sale_num,g.goods_name,gs.site_id,gs.is_free_shipping,g.goods_image,gs.is_virtual,g.recommend_way,gs.unit,gs.promotion_type,g.label_name,g.goods_spec_format';
  513. if ($token[ 'code' ] >= 0) {
  514. $field .= ',gs.is_consume_discount,gs.discount_config,gs.member_price,gs.discount_method';
  515. }
  516. $alias = 'gs';
  517. $join = [
  518. [ 'goods g', 'gs.sku_id = g.sku_id', 'inner' ]
  519. ];
  520. // 如果是连锁运营模式
  521. if ($this->store_data[ 'config' ][ 'store_business' ] == 'store') {
  522. $join[] = [ 'store_goods sg', 'g.goods_id=sg.goods_id and sg.store_id=' . $this->store_id, 'left' ];
  523. $condition[] = [ 'g.sale_store', 'like', [ '%all%', '%,' . $this->store_id . ',%' ], 'or' ];
  524. $condition[] = [ 'sg.status', '=', 1 ];
  525. $field = str_replace('gs.price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sg.price), gs.price) as price', $field);
  526. $field = str_replace('gs.discount_price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sg.price), gs.price) as discount_price', $field);
  527. if ($this->store_data[ 'store_info' ][ 'stock_type' ] == 'store') {
  528. $field = str_replace('g.goods_stock', 'IFNULL(sg.stock, 0) as goods_stock', $field);
  529. }
  530. }
  531. $goods = new Goods();
  532. $list = $goods->getGoodsSkuPageList($condition, $page, $page_size, $order_by, $field, $alias, $join);
  533. if (!empty($list[ 'data' ][ 'list' ]) && $token[ 'code' ] >= 0) {
  534. $list[ 'data' ][ 'list' ] = $goods->getGoodsListMemberPrice($list[ 'data' ][ 'list' ], $this->member_id);
  535. }
  536. return $this->response($list);
  537. }
  538. /**
  539. * 查询商品列表供组件调用
  540. */
  541. public function components()
  542. {
  543. $token = $this->checkToken();
  544. $num = isset($this->params[ 'num' ]) ? $this->params[ 'num' ] : 0;
  545. $goods_id_arr = isset($this->params[ 'goods_id_arr' ]) ? $this->params[ 'goods_id_arr' ] : '';//goods_id数组
  546. $category_id = isset($this->params[ 'category_id' ]) ? $this->params[ 'category_id' ] : 0;//分类
  547. $order = isset($this->params[ 'order' ]) ? $this->params[ 'order' ] : "";//排序(综合、销量、价格)
  548. $condition = [
  549. [ 'g.goods_state', '=', 1 ],
  550. [ 'g.is_delete', '=', 0 ],
  551. [ 'g.site_id', '=', $this->site_id ],
  552. [ '', 'exp', Db::raw("(g.sale_channel = 'all' OR g.sale_channel = 'online')") ]
  553. ];
  554. if (!empty($category_id)) {
  555. $condition[] = [ 'category_id', 'like', '%,' . $category_id . ',%' ];
  556. }
  557. if (!empty($goods_id_arr)) {
  558. $condition[] = [ 'g.goods_id', 'in', $goods_id_arr ];
  559. }
  560. // 非法参数进行过滤
  561. if ($order != '') {
  562. if ($order == 'default') {
  563. // 综合排序
  564. $order = 'g.sort asc,g.create_time';
  565. $sort = 'desc';
  566. } elseif ($order == 'sales') {
  567. // 销量排序
  568. $order = 'sale_num';
  569. $sort = 'desc';
  570. } else if ($order == 'price') {
  571. // 价格排序
  572. $order = 'gs.discount_price';
  573. $sort = 'desc';
  574. } else if ($order == 'news') {
  575. // 上架时间排序
  576. $order = 'g.create_time';
  577. $sort = 'desc';
  578. } else {
  579. $order = 'g.' . $order;
  580. $sort = 'asc';
  581. }
  582. $order_by = $order . ' ' . $sort;
  583. } else {
  584. $config_model = new ConfigModel();
  585. $sort_config = $config_model->getGoodsSort($this->site_id);
  586. $sort_config = $sort_config[ 'data' ][ 'value' ];
  587. $order_by = 'g.sort ' . $sort_config[ 'type' ] . ',g.create_time desc';
  588. }
  589. $field = 'gs.goods_id,gs.sku_id,gs.price,gs.market_price,gs.discount_price,gs.stock,(g.sale_num + g.virtual_sale) as sale_num,g.goods_name,gs.site_id,gs.is_free_shipping,g.goods_image,gs.is_virtual,g.recommend_way,gs.unit,gs.promotion_type,g.label_name,g.goods_spec_format';
  590. if ($token[ 'code' ] >= 0) {
  591. $field .= ',gs.is_consume_discount,gs.discount_config,gs.member_price,gs.discount_method';
  592. }
  593. $alias = 'gs';
  594. $join = [
  595. [ 'goods g', 'gs.sku_id = g.sku_id', 'inner' ]
  596. ];
  597. // 如果是连锁运营模式
  598. if ($this->store_data[ 'config' ][ 'store_business' ] == 'store') {
  599. $join[] = [ 'store_goods sg', 'g.goods_id=sg.goods_id and sg.store_id=' . $this->store_id, 'left' ];
  600. $condition[] = [ 'g.sale_store', 'like', [ '%all%', '%,' . $this->store_id . ',%' ], 'or' ];
  601. $condition[] = [ 'sg.status', '=', 1 ];
  602. $field = str_replace('gs.price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sg.price), gs.price) as price', $field);
  603. $field = str_replace('gs.discount_price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sg.price), gs.price) as discount_price', $field);
  604. if ($this->store_data[ 'store_info' ][ 'stock_type' ] == 'store') {
  605. $field = str_replace('gs.stock', 'IFNULL(sg.stock, 0) as stock', $field);
  606. }
  607. }
  608. $goods = new Goods();
  609. $list = $goods->getGoodsSkuList($condition, $field, $order_by, $num, $alias, $join);
  610. if (!empty($list[ 'data' ]) && $token[ 'code' ] >= 0) {
  611. $list[ 'data' ] = $goods->getGoodsListMemberPrice($list[ 'data' ], $this->member_id);
  612. }
  613. return $this->response($list);
  614. }
  615. /**
  616. * 商品推荐
  617. * @return string
  618. */
  619. public function recommend()
  620. {
  621. $token = $this->checkToken();
  622. $page = isset($this->params[ 'page' ]) ? $this->params[ 'page' ] : 1;
  623. $page_size = isset($this->params[ 'page_size' ]) ? $this->params[ 'page_size' ] : PAGE_LIST_ROWS;
  624. $route = isset($this->params[ 'route' ]) ? $this->params[ 'route' ] : '';
  625. // PC端
  626. if ($this->params[ 'app_type' ] == 'pc') {
  627. $route = 'goods_detail';
  628. }
  629. if (empty($route)) {
  630. return $this->response($this->error('',));
  631. }
  632. $condition[] = [ 'gs.goods_state', '=', 1 ];
  633. $condition[] = [ 'gs.is_delete', '=', 0 ];
  634. $condition[] = [ 'gs.site_id', '=', $this->site_id ];
  635. $condition[] = [ '', 'exp', Db::raw("(g.sale_channel = 'all' OR g.sale_channel = 'online')") ];
  636. $goods = new Goods();
  637. $alias = 'gs';
  638. $config_model = new ConfigModel();
  639. $order_by = '';
  640. // 根据后台设置推荐商品
  641. $guess_you_like = $config_model->getGuessYouLike($this->site_id, $this->app_module)[ 'data' ][ 'value' ];
  642. if (in_array($route, $guess_you_like[ 'supportPage' ]) === false) {
  643. return $this->response($this->error('',));
  644. }
  645. if ($guess_you_like[ 'sources' ] == 'sort') {
  646. $sort_config = $config_model->getGoodsSort($this->site_id)[ 'data' ][ 'value' ];
  647. $order_by = 'gs.sort ' . $sort_config[ 'type' ] . ',gs.create_time desc';
  648. } else if ($guess_you_like[ 'sources' ] == 'browse') {
  649. $condition[] = [ 'gb.member_id', '=', $this->member_id ];
  650. $condition[] = [ 'gb.site_id', '=', $this->site_id ];
  651. $order_by = 'browse_time desc';
  652. } else if ($guess_you_like[ 'sources' ] == 'sale') {
  653. $order_by = 'sale_num desc';
  654. } else if ($guess_you_like[ 'sources' ] == 'diy') {
  655. $condition[] = [ 'gs.goods_id', 'in', $guess_you_like[ 'goodsIds' ] ];
  656. }
  657. $field = 'gs.is_consume_discount,gs.discount_config,gs.discount_method,gs.member_price,g.market_price_show,g.sale_show,gs.goods_id,gs.sku_id,gs.sku_name,gs.price,gs.market_price,gs.discount_price,gs.stock,(g.sale_num + g.virtual_sale) as sale_num,gs.goods_name,gs.promotion_type,g.goods_image,gs.unit,g.label_name,gs.sku_image,gs.is_virtual';
  658. if ($guess_you_like[ 'sources' ] == 'browse') {
  659. $join = [
  660. [ 'goods g', 'gs.sku_id = g.sku_id', 'inner' ],
  661. [ 'goods_browse gb', 'gb.sku_id = gs.sku_id', 'inner' ]
  662. ];
  663. } else {
  664. $join = [
  665. [ 'goods g', 'gs.sku_id = g.sku_id', 'inner' ]
  666. ];
  667. }
  668. // 如果是连锁运营模式
  669. if ($this->store_data[ 'config' ][ 'store_business' ] == 'store') {
  670. $join[] = [ 'store_goods_sku sgs', 'g.sku_id = sgs.sku_id and sgs.store_id=' . $this->store_id, 'left' ];
  671. $condition[] = [ 'g.sale_store', 'like', [ '%all%', '%,' . $this->store_id . ',%' ], 'or' ];
  672. $condition[] = [ 'sgs.status', '=', 1 ];
  673. $field = str_replace('gs.price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sgs.price), gs.price) as price', $field);
  674. $field = str_replace('gs.discount_price', 'IFNULL(IF(g.is_unify_price = 1,gs.price,sgs.price), gs.price) as discount_price', $field);
  675. if ($this->store_data[ 'store_info' ][ 'stock_type' ] == 'store') {
  676. $field = str_replace('gs.stock', 'IFNULL(sgs.stock, 0) as stock', $field);
  677. }
  678. }
  679. $list = $goods->getGoodsSkuPageList($condition, $page, $page_size, $order_by, $field, $alias, $join);
  680. if (!empty($list[ 'data' ][ 'list' ])) {
  681. $list[ 'data' ][ 'list' ] = $goods->getGoodsListMemberPrice($list[ 'data' ][ 'list' ], $this->member_id);
  682. $list[ 'data' ][ 'config' ] = $guess_you_like;
  683. }
  684. return $this->response($list);
  685. }
  686. /**
  687. * 商品二维码
  688. * return
  689. */
  690. public function goodsQrcode()
  691. {
  692. $sku_id = isset($this->params[ 'sku_id' ]) ? $this->params[ 'sku_id' ] : 0;
  693. if (empty($sku_id)) {
  694. return $this->response($this->error('', 'REQUEST_SKU_ID'));
  695. }
  696. $goods_model = new Goods();
  697. $goods_sku_info = $goods_model->getGoodsSkuInfo([ [ 'sku_id', '=', $sku_id ] ], 'goods_id,sku_id,goods_name')[ 'data' ];
  698. $res = $goods_model->qrcode($goods_sku_info[ 'goods_id' ], $goods_sku_info[ 'goods_name' ], $this->site_id);
  699. return $this->response($res);
  700. }
  701. /**
  702. * 处理商品详情公共数据
  703. * @param $data
  704. */
  705. public function handleGoodsDetailData(&$data)
  706. {
  707. $goods = new Goods();
  708. if (!empty($data[ 'sku_images' ])) $data[ 'sku_images_list' ] = $goods->getGoodsImage($data[ 'sku_images' ], $this->site_id)[ 'data' ] ?? [];
  709. if (!empty($data[ 'sku_image' ])) $data[ 'sku_image_list' ] = $goods->getGoodsImage($data[ 'sku_image' ], $this->site_id)[ 'data' ] ?? [];
  710. if (!empty($data[ 'goods_image' ])) $data[ 'goods_image_list' ] = $goods->getGoodsImage($data[ 'goods_image' ], $this->site_id)[ 'data' ] ?? [];
  711. // 商品服务
  712. $goods_service = new GoodsService();
  713. $data[ 'goods_service' ] = $goods_service->getServiceList([ [ 'site_id', '=', $this->site_id ], [ 'id', 'in', $data[ 'goods_service_ids' ] ] ], 'service_name,desc,icon')[ 'data' ];
  714. // 商品详情配置
  715. $config_model = new ConfigModel();
  716. $data[ 'config' ] = $config_model->getGoodsDetailConfig($this->site_id)[ 'data' ][ 'value' ];
  717. if ($data[ 'is_virtual' ] == 0) {
  718. $data[ 'express_type' ] = ( new ExpressConfig() )->getEnabledExpressType($this->site_id);
  719. }
  720. // 获取用户是否关注
  721. $goods_collect_api = new Goodscollect();
  722. $data[ 'is_collect' ] = json_decode($goods_collect_api->iscollect($data[ 'goods_id' ]), true)[ 'data' ];
  723. // 评价查询
  724. $goods_evaluate_api = new Goodsevaluate();
  725. $data[ 'evaluate_config' ] = json_decode($goods_evaluate_api->config(), true)[ 'data' ];
  726. $data[ 'evaluate_list' ] = json_decode($goods_evaluate_api->firstinfo($data[ 'goods_id' ]), true)[ 'data' ];
  727. $data[ 'evaluate_count' ] = json_decode($goods_evaluate_api->count($data[ 'goods_id' ]), true)[ 'data' ];
  728. }
  729. }