Pmgdiscount.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. * DSMall多用户商城
  7. * ============================================================================
  8. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  9. * 网站地址: http://www.csdeshang.com
  10. * ----------------------------------------------------------------------------
  11. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  12. * 不允许对程序代码以任何形式任何目的的再发布。
  13. * ============================================================================
  14. * 数据层模型
  15. */
  16. class Pmgdiscount extends BaseModel {
  17. public function getPmgdiscountInfoByGoodsInfo($goods_info) {
  18. //判断店铺是否开启会员折扣
  19. $store = Db::name('store')->where('store_id',$goods_info['store_id'])->find();
  20. if($store['store_mgdiscount_state'] != 1){
  21. return ;
  22. }
  23. //判断套餐时间
  24. $mgdiscountquota_model = model('pmgdiscountquota');
  25. if($store['is_platform_store']!=1 && intval(config('ds_config.mgdiscount_price'))!=0){//非自营店且促销套餐价格非零就需要检查是否购买了套餐
  26. $current_mgdiscount_quota = $mgdiscountquota_model->getMgdiscountquotaCurrent($goods_info['store_id']);
  27. if(empty($current_mgdiscount_quota) || $current_mgdiscount_quota['mgdiscountquota_endtime']<TIMESTAMP){
  28. return ;
  29. }
  30. }
  31. //查看此商品是否单独设置了折扣
  32. if($goods_info['goods_mgdiscount'] != ''){
  33. return unserialize($goods_info['goods_mgdiscount']);
  34. }
  35. //当店铺设置了店铺会员等级折扣
  36. if($store['store_mgdiscount'] != ''){
  37. return unserialize($store['store_mgdiscount']);
  38. }
  39. return;
  40. }
  41. }