IntegralModel.class.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Home\Model;
  3. use Think\Model;
  4. /**
  5. * 拼团模型模型
  6. * @author fish
  7. *
  8. */
  9. class IntegralModel {
  10. /**
  11. 检测会员积分是否足够支付订单
  12. **/
  13. public function check_user_score_can_pay($member_id, $sku_str ='', $goods_id)
  14. {
  15. $member_info = M('lionfish_comshop_member')->field('score')->where( array('member_id' => $member_id ) )->find();
  16. if( !empty($sku_str) )
  17. {
  18. $mult_value_info = $goods_option_mult_value = M('lionfish_comshop_goods_option_item_value')->where( array('goods_id' =>$goods_id,'option_item_ids' => $sku_str ) )->find();
  19. //marketprice
  20. if($mult_value_info['marketprice'] > $member_info['score'])
  21. {
  22. return array('code' => 1,'cur_score' => $member_info['score'],'pay_score' => $mult_value_info['marketprice']);
  23. }else{
  24. return array('code' => 0);
  25. }
  26. }else{
  27. //price
  28. $intgral_goods_info = M('lionfish_comshop_goods')->field('price')->where( array('id' => $goods_id ) )->find();
  29. if($intgral_goods_info['price'] > $member_info['score'])
  30. {
  31. return array('code' => 1,'cur_score' => $member_info['score'],'pay_score' => $intgral_goods_info['price']);
  32. }else{
  33. return array('code' => 0);
  34. }
  35. }
  36. }
  37. }