GoodsPresaleModel.class.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Seller\Model;
  15. class GoodsPresaleModel{
  16. /**
  17. * @author yj
  18. * @desc 更新商品预售价格
  19. * @param $goods_id
  20. */
  21. public function modifyGoodsPresale( $goods_id )
  22. {
  23. $presale_type = I('post.presale_type', 0);//预售方式, 0 定金, 1 全款
  24. $presale_ding_money = I('post.presale_ding_money', 0 );//定金金额
  25. $presale_deduction_money = I('post.presale_deduction_money', 0);//定金可抵扣金额
  26. $presale_ding_time = I('post.presale_ding_time');//定金支付时间
  27. $presale_ding_time_start = strtotime( $presale_ding_time['start'] ); //开始
  28. $presale_ding_time_end = strtotime( $presale_ding_time['end'] );//结束
  29. $presale_limit_balancepaytime = I('post.presale_limit_balancepaytime', 0);//限制尾款支付时间 0 不限制,1 显示
  30. $presale_balance_paytime = I('post.presale_balance_paytime', 0 );//几天内要支付完尾款
  31. $presale_sendorder_type = I('post.presale_sendorder_type', 0);//预计发货时间 固定时间 0 固定日期, 1购买后几日发货
  32. $presale_sendorder_datetime = I('post.presale_sendorder_datetime');//尾款支付后,指定开始发货日期
  33. $presale_sendorder_afterday = I('post.presale_sendorder_afterday', 0);//尾款支付后,几日发货
  34. $ins_data = [];
  35. $ins_data['goods_id'] = $goods_id;
  36. $ins_data['presale_type'] = $presale_type;
  37. $ins_data['presale_ding_money'] = $presale_ding_money;
  38. $ins_data['presale_deduction_money'] = $presale_deduction_money;
  39. $ins_data['presale_ding_time_start'] = $presale_ding_time_start;
  40. $ins_data['presale_ding_time_end'] = $presale_ding_time_end;
  41. $ins_data['presale_limit_balancepaytime'] = $presale_limit_balancepaytime;
  42. $ins_data['presale_balance_paytime'] = $presale_balance_paytime;
  43. $ins_data['presale_sendorder_type'] = $presale_sendorder_type;
  44. $ins_data['presale_sendorder_datetime'] = strtotime( $presale_sendorder_datetime.' 00:00:00' );
  45. $ins_data['presale_sendorder_afterday'] = $presale_sendorder_afterday;
  46. $record = M('lionfish_comshop_goods_presale')->where( ['goods_id' => $goods_id ] )->find();
  47. if( empty($record) )
  48. {
  49. //添加记录
  50. $ins_data['addtime'] = time();
  51. M('lionfish_comshop_goods_presale')->add( $ins_data );
  52. }else{
  53. //修改记录
  54. M('lionfish_comshop_goods_presale')->where(['id' => $record['id']])->save( $ins_data );
  55. }
  56. }
  57. }
  58. ?>