StoreIntegral.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <?php
  2. namespace app\admin\controller\ump;
  3. use app\admin\controller\AuthController;
  4. use app\admin\model\store\{StoreDescription,
  5. StoreProductAttr,
  6. StoreProductAttrResult,
  7. StoreProduct as ProductModel,
  8. StoreProductAttrValue
  9. };
  10. use crmeb\traits\CurdControllerTrait;
  11. use think\Exception;
  12. use think\exception\ErrorException;
  13. use think\exception\ValidateException;
  14. use think\facade\Route as Url;
  15. use app\admin\model\system\{SystemAttachment, SystemGroupData, ShippingTemplates};
  16. use app\admin\model\ump\{StoreIntegral as StoreIntegralModel, StoreIntegralAttrResult};
  17. use crmeb\services\{
  18. FormBuilder as Form, UtilService as Util, JsonService as Json
  19. };
  20. use app\admin\model\store\StoreCategory;
  21. /**
  22. * 限时秒杀 控制器
  23. * Class StoreSeckill
  24. * @package app\admin\controller\store
  25. */
  26. class StoreIntegral extends AuthController
  27. {
  28. use CurdControllerTrait;
  29. protected $bindModel = StoreIntegralModel::class;
  30. /**
  31. * 显示资源列表
  32. *
  33. * @return \think\Response
  34. */
  35. public function index()
  36. {
  37. $this->assign('countSeckill', StoreIntegralModel::getSeckillCount());
  38. $this->assign('seckillId', StoreIntegralModel::getSeckillIdAll());
  39. return $this->fetch();
  40. }
  41. public function save_excel()
  42. {
  43. $where = Util::getMore([
  44. ['status', ''],
  45. ['store_name', '']
  46. ]);
  47. StoreIntegralModel::SaveExcel($where);
  48. }
  49. /**
  50. * 异步获取砍价数据
  51. */
  52. public function get_seckill_list()
  53. {
  54. $where = Util::getMore([
  55. ['page', 1],
  56. ['limit', 20],
  57. ['status', ''],
  58. ['store_name', '']
  59. ]);
  60. $seckillList = StoreIntegralModel::systemPage($where);
  61. if (is_object($seckillList['list'])) $seckillList['list'] = $seckillList['list']->toArray();
  62. $data = $seckillList['list']['data'];
  63. return Json::successlayui(['count' => $seckillList['list']['total'], 'data' => $data]);
  64. }
  65. public function get_seckill_id()
  66. {
  67. return Json::successlayui(StoreIntegralModel::getSeckillIdAll());
  68. }
  69. /**
  70. * 添加秒杀商品
  71. * @return form-builder
  72. */
  73. public function create()
  74. {
  75. $f = array();
  76. $f[] = Form::frameImageOne('product', '选择商品', Url::buildUrl('productList', array('fodder' => 'product')))->icon('plus')->width('100%')->height('500px');
  77. $f[] = Form::hidden('product_id', '');
  78. $f[] = Form::hidden('description', '');
  79. $f[] = Form::input('title', '商品标题');
  80. $f[] = Form::input('info', '活动简介')->type('textarea');
  81. $f[] = Form::input('unit_name', '单位')->placeholder('个、位');
  82. $f[] = Form::select('temp_id', '运费模板')->setOptions(function () {
  83. $list = ShippingTemplates::getList(['page' => 1, 'limit' => 20]);
  84. $menus = [];
  85. foreach ($list['data'] as $menu) {
  86. $menus[] = ['value' => $menu['id'], 'label' => $menu['name']];
  87. }
  88. return $menus;
  89. })->filterable(1)->col(12);
  90. $f[] = Form::frameImageOne('image', '商品主图片(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')))->icon('image')->width('100%')->height('500px');
  91. $f[] = Form::frameImages('images', '商品轮播图(640*640px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'images')))->maxLength(5)->icon('images')->width('100%')->height('500px');
  92. $f[] = Form::number('sort', '排序')->col(12);
  93. $f[] = Form::number('num', '单次购买商品个数')->precision(0)->col(12);
  94. $f[] = Form::number('give_integral', '赠送积分')->min(0)->precision(0)->col(12);
  95. $f[] = Form::radio('is_hot', '热门推荐', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]])->col(12);
  96. $form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('save'));
  97. $this->assign(compact('form'));
  98. return $this->fetch('public/form-builder');
  99. }
  100. /**
  101. * 保存秒杀商品
  102. * @param int $id
  103. */
  104. public function save($id = 0)
  105. {
  106. $data = Util::postMore([
  107. 'title',
  108. 'product_id',
  109. 'info',
  110. 'unit_name',
  111. ['image', ''],
  112. ['images', []],
  113. ['price', 0],
  114. ['ot_price', 0],
  115. ['cost', 0],
  116. ['sales', 0],
  117. ['stock', 0],
  118. ['sort', 0],
  119. ['give_integral', 0],
  120. ['postage', 0],
  121. ['is_postage', 0],
  122. ['cost', 0],
  123. ['is_hot', 0],
  124. ['status', 0],
  125. ['num', 0],
  126. 'temp_id',
  127. ['weight', 0],
  128. ['volume', 0],
  129. ]);
  130. $data['description'] = StoreDescription::getDescription($data['product_id']);
  131. if (!$data['title']) return Json::fail('请输入商品标题');
  132. if (!$data['unit_name']) return Json::fail('请输入商品单位');
  133. if (!$data['product_id']) return Json::fail('商品ID不能为空');
  134. if (!$data['image']) return Json::fail('请选择推荐图');
  135. if (count($data['images']) < 1) return Json::fail('请选择轮播图');
  136. $data['images'] = json_encode($data['images']);
  137. if ($data['num'] < 1) return Json::fail('请输入单次购买个数');
  138. if ($id) {
  139. unset($data['description']);
  140. $product = StoreIntegralModel::get($id);
  141. if (!$product) return Json::fail('数据不存在!');
  142. StoreIntegralModel::edit($data, $id);
  143. return Json::successful('编辑成功!');
  144. } else {
  145. $data['add_time'] = time();
  146. $res = StoreIntegralModel::create($data);
  147. $description['product_id'] = $res['id'];
  148. $description['description'] = htmlspecialchars_decode($data['description']);
  149. $description['type'] = 4;
  150. StoreDescription::create($description);
  151. return Json::successful('添加成功!');
  152. }
  153. }
  154. /** 开启秒杀
  155. * @param $id
  156. * @return mixed|void
  157. */
  158. public function seckill($id)
  159. {
  160. if (!$id) return $this->failed('数据不存在');
  161. $product = ProductModel::get($id);
  162. if (!$product) return Json::fail('数据不存在!');
  163. $f = array();
  164. $f[] = Form::input('title', '商品标题', $product->getData('store_name'));
  165. $f[] = Form::hidden('product_id', $id);
  166. $f[] = Form::input('info', '活动简介', $product->getData('store_info'))->type('textarea');
  167. $f[] = Form::input('unit_name', '单位', $product->getData('unit_name'))->placeholder('个、位');
  168. $f[] = Form::select('temp_id', '运费模板', (string)$product->getData('temp_id'))->setOptions(function () {
  169. $list = ShippingTemplates::getList(['page' => 1, 'limit' => 20]);
  170. $menus = [];
  171. foreach ($list['data'] as $menu) {
  172. $menus[] = ['value' => $menu['id'], 'label' => $menu['name']];
  173. }
  174. return $menus;
  175. })->filterable(1)->col(12);
  176. $f[] = Form::frameImageOne('image', '商品主图片(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')), $product->getData('image'))->icon('image')->width('100%')->height('500px');
  177. $f[] = Form::frameImages('images', '商品轮播图(640*640px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'images')), json_decode($product->getData('slider_image')))->maxLength(5)->icon('images')->width('100%')->height('500px');
  178. $f[] = Form::number('price', '积分价')->min(0)->col(12);
  179. $f[] = Form::number('integral', '消耗积分')->min(0)->col(12);
  180. $f[] = Form::number('ot_price', '原价', $product->getData('price'))->min(0)->col(12);
  181. $f[] = Form::number('cost', '成本价', $product->getData('cost'))->min(0)->col(12);
  182. $f[] = Form::number('stock', '库存', $product->getData('stock'))->min(0)->precision(0)->col(12);
  183. $f[] = Form::number('sales', '销量', $product->getData('sales'))->min(0)->precision(0)->col(12);
  184. $f[] = Form::number('sort', '排序', $product->getData('sort'))->col(12);
  185. $f[] = Form::number('num', '单次购买商品个数', 1)->precision(0)->col(12);
  186. $f[] = Form::number('give_integral', '赠送积分', $product->getData('give_integral'))->min(0)->precision(0)->col(12);
  187. $f[] = Form::number('weight', '重量', 0)->min(0)->col(12);
  188. $f[] = Form::number('volume', '体积', 0)->min(0)->col(12);
  189. // $f[] = Form::number('deposit', '押金', 0)->min(0)->col(12);
  190. $f[] = Form::radio('is_hot', '热门推荐', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]])->col(12);
  191. $f[] = Form::radio('status', '活动状态', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]])->col(12);
  192. $form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('save'));
  193. $this->assign(compact('form'));
  194. return $this->fetch('public/form-builder');
  195. }
  196. /**
  197. * 显示编辑资源表单页.
  198. *
  199. * @param int $id
  200. * @return \think\Response
  201. */
  202. public function edit($id)
  203. {
  204. if (!$id) return $this->failed('数据不存在');
  205. $product = StoreIntegralModel::get($id);
  206. // $time = StoreSeckillTime::getSeckillTime($id);
  207. if (!$product) return Json::fail('数据不存在!');
  208. $f = array();
  209. $f[] = Form::input('product_id', '产品ID', $product->getData('product_id'))->disabled(true);
  210. $f[] = Form::input('title', '商品标题', $product->getData('title'));
  211. $f[] = Form::input('info', '活动简介', $product->getData('info'))->type('textarea');
  212. $f[] = Form::input('unit_name', '单位', $product->getData('unit_name'))->placeholder('个、位');
  213. $f[] = Form::select('temp_id', '运费模板', (string)$product->getData('temp_id'))->setOptions(function () {
  214. $list = ShippingTemplates::getList(['page' => 1, 'limit' => 20]);
  215. $menus = [];
  216. foreach ($list['data'] as $menu) {
  217. $menus[] = ['value' => $menu['id'], 'label' => $menu['name']];
  218. }
  219. return $menus;
  220. })->filterable(1)->col(12);
  221. $f[] = Form::frameImageOne('image', '商品主图片(305*305px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'image')), $product->getData('image'))->icon('image')->width('100%')->height('500px');
  222. $f[] = Form::frameImages('images', '商品轮播图(640*640px)', Url::buildUrl('admin/widget.images/index', array('fodder' => 'images')), json_decode($product->getData('images')))->maxLength(5)->icon('images')->width('100%')->height('500px');
  223. $f[] = Form::number('sort', '排序', $product->getData('sort'))->col(12);
  224. $f[] = Form::hidden('stock', $product->getData('stock'));
  225. $f[] = Form::hidden('price', $product->getData('price'));
  226. $f[] = Form::hidden('integral', $product->getData('integral'));
  227. $f[] = Form::hidden('ot_price', $product->getData('ot_price'));
  228. $f[] = Form::hidden('sales', $product->getData('sales'));
  229. $f[] = Form::number('num', '单次购买商品个数', $product->getData('num'))->precision(0)->col(12);
  230. $f[] = Form::number('give_integral', '赠送积分', $product->getData('give_integral'))->min(0)->precision(0)->col(12);
  231. $f[] = Form::radio('is_hot', '热门推荐', $product->getData('is_hot'))->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]])->col(12);
  232. $f[] = Form::hidden('status', $product->getData('status'));
  233. $form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('save', compact('id')));
  234. $this->assign(compact('form'));
  235. return $this->fetch('public/form-builder');
  236. }
  237. /**
  238. * 删除指定资源
  239. *
  240. * @param int $id
  241. * @return \think\Response
  242. */
  243. public function delete($id)
  244. {
  245. if (!$id) return $this->failed('数据不存在');
  246. $product = StoreIntegralModel::get($id);
  247. if (!$product) return Json::fail('数据不存在!');
  248. if ($product['is_del']) return Json::fail('已删除!');
  249. $data['is_del'] = 1;
  250. if (!StoreIntegralModel::edit($data, $id))
  251. return Json::fail(StoreIntegralModel::getErrorInfo('删除失败,请稍候再试!'));
  252. else
  253. return Json::successful('删除成功!');
  254. }
  255. public function edit_content($id)
  256. {
  257. if (!$id) return $this->failed('数据不存在');
  258. $seckill = StoreIntegralModel::get($id);
  259. if (!$seckill) return Json::fail('数据不存在!');
  260. $this->assign([
  261. 'content' => htmlspecialchars_decode(StoreDescription::getDescription($id, 4)),
  262. 'field' => 'description',
  263. 'action' => Url::buildUrl('change_field', ['id' => $id, 'field' => 'description'])
  264. ]);
  265. return $this->fetch('public/edit_content');
  266. }
  267. public function change_field($id)
  268. {
  269. if (!$id) return $this->failed('数据不存在');
  270. $seckill = StoreIntegralModel::get($id);
  271. if (!$seckill) return Json::fail('数据不存在!');
  272. $data['description'] = request()->post('description');
  273. StoreDescription::saveDescription($data['description'], $id, 4);
  274. $res = StoreIntegralModel::edit($data, $id);
  275. if ($res)
  276. return Json::successful('添加成功');
  277. else
  278. return Json::fail('添加失败');
  279. }
  280. /**
  281. * 属性页面
  282. * @param $id
  283. * @return mixed|void
  284. */
  285. public function attr($id)
  286. {
  287. if (!$id) return $this->failed('数据不存在!');
  288. $result = StoreIntegralAttrResult::getResult($id);
  289. $image = StoreIntegralModel::where('id', $id)->value('image');
  290. $this->assign(compact('id', 'result', 'image'));
  291. return $this->fetch();
  292. }
  293. /**
  294. * 秒杀属性选择页面
  295. * @param $id
  296. * @return string|void
  297. * @throws \think\db\exception\DataNotFoundException
  298. * @throws \think\db\exception\DbException
  299. * @throws \think\db\exception\ModelNotFoundException
  300. */
  301. public function attr_list($id)
  302. {
  303. if (!$id) return $this->failed('数据不存在!');
  304. $seckillInfo = StoreIntegralModel::where('id', $id)->find();
  305. $seckillResult = StoreProductAttrResult::where('product_id', $id)->where('type', 4)->value('result');
  306. $productResult = StoreProductAttrResult::where('product_id', $seckillInfo['product_id'])->where('type', 0)->value('result');
  307. if ($productResult) {
  308. $attr = json_decode($productResult, true)['attr'];
  309. $productAttr = $this->get_attr($attr, $seckillInfo['product_id'], 0);
  310. $seckillAttr = $this->get_attr($attr, $id, 4);
  311. foreach ($productAttr as $pk => $pv) {
  312. foreach ($seckillAttr as $sv) {
  313. if ($pv['detail'] == $sv['detail']) {
  314. $productAttr[$pk] = $sv;
  315. }
  316. }
  317. }
  318. } else {
  319. if ($seckillResult) {
  320. $attr = json_decode($seckillResult, true)['attr'];
  321. $productAttr = $this->get_attr($attr, $id, 1);
  322. } else {
  323. $attr[0]['value'] = '默认';
  324. $attr[0]['detailValue'] = '';
  325. $attr[0]['attrHidden'] = '';
  326. $attr[0]['detail'][0] = '默认';
  327. $productAttr[0]['value1'] = '默认';
  328. $productAttr[0]['detail'] = json_encode(['默认' => '默认']);
  329. $productAttr[0]['pic'] = $seckillInfo['image'];
  330. $productAttr[0]['price'] = $seckillInfo['price'];
  331. $productAttr[0]['integral'] = $seckillInfo['integral'];
  332. $productAttr[0]['cost'] = $seckillInfo['cost'];
  333. $productAttr[0]['ot_price'] = $seckillInfo['ot_price'];
  334. $productAttr[0]['stock'] = $seckillInfo['stock'];
  335. $productAttr[0]['quota'] = 0;
  336. $productAttr[0]['bar_code'] = $seckillInfo['bar_code'];
  337. $productAttr[0]['weight'] = 0;
  338. $productAttr[0]['volume'] = 0;
  339. $productAttr[0]['deposit'] = 0;
  340. $productAttr[0]['brokerage'] = 0;
  341. $productAttr[0]['brokerage_two'] = 0;
  342. $productAttr[0]['check'] = 0;
  343. }
  344. }
  345. $attrs['attr'] = $attr;
  346. $attrs['value'] = $productAttr;
  347. $this->assign('attr', $attrs);
  348. $this->assign('id', $id);
  349. return $this->fetch();
  350. }
  351. /**
  352. * 秒杀属性保存页面
  353. * @throws \think\db\exception\DataNotFoundException
  354. * @throws \think\db\exception\DbException
  355. * @throws \think\db\exception\ModelNotFoundException
  356. */
  357. public function save_attr()
  358. {
  359. $data = Util::postMore([
  360. ['attr', []],
  361. ['ids', []],
  362. ['id', 0],
  363. ]);
  364. if (!$data['id']) return Json::fail('数据不存在!');
  365. if (!$data['ids']) return Json::fail('你没有选择任何规格!');
  366. $productId = StoreIntegralModel::where('id', $data['id'])->value('product_id');
  367. $attr = json_decode(StoreProductAttrResult::where('product_id', $productId)->where('type', 0)->value('result'), true)['attr'];
  368. foreach ($data['attr'] as $k => $v) {
  369. if (in_array($k, $data['ids'])) {
  370. $v['detail'] = json_decode(htmlspecialchars_decode($v['detail']), true);
  371. $detail[$k] = $v;
  372. }
  373. }
  374. if (min(array_column($detail, 'quota')) == 0) return Json::fail('限购不能为0');
  375. $price = min(array_column($detail, 'price'));
  376. $integral = min(array_column($detail, 'integral'));
  377. $otPrice = min(array_column($detail, 'ot_price'));
  378. $quota = array_sum(array_column($detail, 'quota'));
  379. $stock = array_sum(array_column($detail, 'stock'));
  380. $deposit = min(array_column($detail, 'deposit'));
  381. if (!$attr) {
  382. $attr[0]['value'] = '默认';
  383. $attr[0]['detailValue'] = '';
  384. $attr[0]['attrHidden'] = '';
  385. $attr[0]['detail'][0] = '默认';
  386. }
  387. StoreProductAttr::createProductAttr($attr, $detail, $data['id'], 4);
  388. StoreIntegralModel::where('id', $data['id'])->update(['deposit' => $deposit, 'stock' => $stock, 'quota' => $quota, 'quota_show' => $quota, 'price' => $price, 'integral' => $integral, 'ot_price' => $otPrice]);
  389. return Json::successful('修改成功!');
  390. }
  391. /**
  392. * 生成属性
  393. * @param int $id
  394. */
  395. public function is_format_attr($id = 0)
  396. {
  397. if (!$id) return Json::fail('商品不存在');
  398. list($attr, $detail) = Util::postMore([
  399. ['items', []],
  400. ['attrs', []]
  401. ], $this->request, true);
  402. $product = StoreIntegralModel::get($id);
  403. if (!$product) return Json::fail('商品不存在');
  404. $attrFormat = attr_format($attr)[1];
  405. if (count($detail)) {
  406. foreach ($attrFormat as $k => $v) {
  407. foreach ($detail as $kk => $vv) {
  408. if ($v['detail'] == $vv['detail']) {
  409. $attrFormat[$k]['price'] = $vv['price'];
  410. $attrFormat[$k]['integral'] = $vv['integral'];
  411. $attrFormat[$k]['sales'] = $vv['sales'];
  412. $attrFormat[$k]['pic'] = $vv['pic'];
  413. $attrFormat[$k]['check'] = false;
  414. break;
  415. } else {
  416. $attrFormat[$k]['price'] = '';
  417. $attrFormat[$k]['integral'] = '';
  418. $attrFormat[$k]['sales'] = '';
  419. $attrFormat[$k]['pic'] = $product['image'];
  420. $attrFormat[$k]['check'] = true;
  421. }
  422. }
  423. }
  424. } else {
  425. foreach ($attrFormat as $k => $v) {
  426. $attrFormat[$k]['price'] = $product['price'];
  427. $attrFormat[$k]['integral'] = $product['integral'];
  428. $attrFormat[$k]['sales'] = $product['stock'];
  429. $attrFormat[$k]['pic'] = $product['image'];
  430. $attrFormat[$k]['check'] = false;
  431. }
  432. }
  433. return Json::successful($attrFormat);
  434. }
  435. /**
  436. * 修改秒杀商品状态
  437. * @param $status
  438. * @param int $id
  439. */
  440. public function set_seckill_status($status, $id = 0)
  441. {
  442. if (!$id) return Json::fail('参数错误');
  443. $res = StoreProductAttrValue::where('product_id', $id)->where('type', 4)->find();
  444. if (!$res) return Json::fail('请先配置规格');
  445. $res = StoreIntegralModel::edit(['status' => $status], $id);
  446. if ($res) return Json::successful('修改成功');
  447. else return Json::fail('修改失败');
  448. }
  449. /**
  450. * 秒杀获取商品列表
  451. * @return string
  452. * @throws \Exception
  453. */
  454. public function productList()
  455. {
  456. $cate = StoreCategory::getTierList(null, 4);
  457. $this->assign('cate', $cate);
  458. return $this->fetch();
  459. }
  460. /**
  461. * 获取秒杀商品规格
  462. * @param $attr
  463. * @param $id
  464. * @param $type
  465. * @return array
  466. */
  467. public function get_attr($attr, $id, $type)
  468. {
  469. $value = attr_format($attr)[1];
  470. // var_dump($value);
  471. // var_dump($type);
  472. $valueNew = [];
  473. $count = 0;
  474. foreach ($value as $key => $item) {
  475. $detail = $item['detail'];
  476. // sort($item['detail'], SORT_STRING);
  477. $suk = implode(',', $item['detail']);
  478. $sukValue = StoreProductAttrValue::where('product_id', $id)->where('type', $type)->where('suk', $suk)->column('bar_code,cost,price,ot_price,stock,image as pic,weight,volume,deposit,brokerage,brokerage_two,quota,integral', 'suk');
  479. if (count($sukValue)) {
  480. foreach (array_values($detail) as $k => $v) {
  481. $valueNew[$count]['value' . ($k + 1)] = $v;
  482. }
  483. $valueNew[$count]['detail'] = json_encode($detail);
  484. $valueNew[$count]['pic'] = $sukValue[$suk]['pic'] ?? '';
  485. $valueNew[$count]['price'] = $sukValue[$suk]['price'] ? floatval($sukValue[$suk]['price']) : 0;
  486. $valueNew[$count]['integral'] = isset($sukValue[$suk]['integral']) ? floatval($sukValue[$suk]['integral']) : 0;
  487. $valueNew[$count]['cost'] = $sukValue[$suk]['cost'] ? floatval($sukValue[$suk]['cost']) : 0;
  488. $valueNew[$count]['ot_price'] = isset($sukValue[$suk]['ot_price']) ? floatval($sukValue[$suk]['ot_price']) : 0;
  489. $valueNew[$count]['stock'] = $sukValue[$suk]['stock'] ? intval($sukValue[$suk]['stock']) : 0;
  490. $valueNew[$count]['quota'] = $sukValue[$suk]['quota'] ? intval($sukValue[$suk]['quota']) : 0;
  491. $valueNew[$count]['bar_code'] = $sukValue[$suk]['bar_code'] ?? '';
  492. $valueNew[$count]['weight'] = $sukValue[$suk]['weight'] ?? 0;
  493. $valueNew[$count]['volume'] = $sukValue[$suk]['volume'] ?? 0;
  494. $valueNew[$count]['deposit'] = $sukValue[$suk]['deposit'] ?? 0;
  495. $valueNew[$count]['brokerage'] = $sukValue[$suk]['brokerage'] ?? 0;
  496. $valueNew[$count]['brokerage_two'] = $sukValue[$suk]['brokerage_two'] ?? 0;
  497. $valueNew[$count]['check'] = $type != 0 ? 1 : 0;
  498. $count++;
  499. }
  500. }
  501. return $valueNew;
  502. }
  503. }