12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- class Pmgdiscount extends BaseModel
- {
- public function getPmgdiscountInfoByGoodsInfo($goods_info)
- {
-
- $store = Db::name('store')->where('store_id', $goods_info['store_id'])->find();
- if ($store['store_mgdiscount_state'] != 1) {
- return;
- }
-
- $mgdiscountquota_model = model('pmgdiscountquota');
- if ($store['is_platform_store'] != 1 && intval(config('ds_config.mgdiscount_price')) != 0) {
- $current_mgdiscount_quota = $mgdiscountquota_model->getMgdiscountquotaCurrent($goods_info['store_id']);
- if (empty($current_mgdiscount_quota) || $current_mgdiscount_quota['mgdiscountquota_endtime'] < TIMESTAMP) {
- return;
- }
- }
-
- if ($goods_info['goods_mgdiscount'] != '') {
- return unserialize($goods_info['goods_mgdiscount']);
- }
-
- if ($store['store_mgdiscount'] != '') {
- return unserialize($store['store_mgdiscount']);
- }
- return;
- }
- }
|