GoodsPresaleModel.class.php 2.6 KB

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