Goodsbatchset.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy riht 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace app\shop\controller;
  11. use app\model\goods\Batch;
  12. /**
  13. * 实物商品
  14. * Class Goods
  15. * @package app\shop\controller
  16. */
  17. class Goodsbatchset extends BaseShop
  18. {
  19. /**
  20. *编辑商品价格(批量)
  21. */
  22. public function setPrice()
  23. {
  24. $type = input('type', '');// 金额 money 公式计算 calculate
  25. $price_type = input('price_type', '');// 价格字段 sale 销售价 cost 成本价 market 划线价
  26. $goods_ids = input('goods_ids', '');
  27. $calculate_price_type = input('calculate_price_type', '');//计算所用价格字段 sale 销售价 cost 成本价 market 划线价
  28. $price = input('price', 0);//设置的价格
  29. $sign = input('sign', '');//运算符号 add 加法subtract减法 multiply 乘法 division 除法
  30. $precise = input('precise', '');//精度 1 全部保留 2 抹分 3 抹角 4 四舍五入到分 5 四舍五入到角 6 四舍五入到元 7
  31. $calculate_price = input('calculate_price', 0);
  32. $params = array(
  33. 'site_id' => $this->site_id,
  34. 'type' => $type,
  35. 'price_type' => $price_type,
  36. 'goods_ids' => $goods_ids,
  37. 'price' => $price,
  38. 'sign' => $sign,
  39. 'precise' => $precise,
  40. 'calculate_price_type' => $calculate_price_type,
  41. 'calculate_price' => $calculate_price
  42. );
  43. $batch_model = new Batch();
  44. $result = $batch_model->setPrice($params);
  45. return $result;
  46. }
  47. }