Pmgdiscount.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 数据层模型
  14. */
  15. class Pmgdiscount extends BaseModel {
  16. public function getPmgdiscountInfoByGoodsInfo($goods_info) {
  17. //判断店铺是否开启会员折扣
  18. $store = Db::name('store')->where('store_id',$goods_info['store_id'])->find();
  19. if($store['store_mgdiscount_state'] != 1){
  20. return ;
  21. }
  22. //判断套餐时间
  23. $mgdiscountquota_model = model('pmgdiscountquota');
  24. if($store['is_platform_store']!=1 && intval(config('ds_config.mgdiscount_price'))!=0){//非自营店且促销套餐价格非零就需要检查是否购买了套餐
  25. $current_mgdiscount_quota = $mgdiscountquota_model->getMgdiscountquotaCurrent($goods_info['store_id']);
  26. if(empty($current_mgdiscount_quota) || $current_mgdiscount_quota['mgdiscountquota_endtime']<TIMESTAMP){
  27. return ;
  28. }
  29. }
  30. //查看此商品是否单独设置了折扣
  31. if($goods_info['goods_mgdiscount'] != ''){
  32. return unserialize($goods_info['goods_mgdiscount']);
  33. }
  34. //当店铺设置了店铺会员等级折扣
  35. if($store['store_mgdiscount'] != ''){
  36. return unserialize($store['store_mgdiscount']);
  37. }
  38. return;
  39. }
  40. }