wesmiler hai 4 días
pai
achega
068ec8120b
Modificáronse 2 ficheiros con 5 adicións e 0 borrados
  1. 1 0
      app/Models/MemberModel.php
  2. 4 0
      app/Services/Api/MemberService.php

+ 1 - 0
app/Models/MemberModel.php

@@ -50,6 +50,7 @@ class MemberModel extends BaseModel
         return ($this->vip_expired >= date('Y-m-d H:i:s') || !$this->vip_expired || $this->vip_expired=='0000-00-00 00:00:00') && $value>0? $value: 0;
     }
 
+
     public function getVipExpiredAttribute($value)
     {
         if($value >= date('Y-m-d H:i:s')){

+ 4 - 0
app/Services/Api/MemberService.php

@@ -369,9 +369,13 @@ class MemberService extends BaseService
 
                 // 成长值
                 $levelGrowth = ConfigService::make()->getConfigByCode('vip_growth_'.$info['member_level']+1);
+                $vipDiscount = ConfigService::make()->getConfigByCode('vip_level'.$info['member_level'].'_discount');
+                $vipDiscount = $vipDiscount>0 && $vipDiscount<10?$vipDiscount:0;
+                $info['vip_discount'] = intval($vipDiscount * 10);
                 $info['vip_growth_diff'] = $levelGrowth>0?ceil(max(0,$levelGrowth-$info['vip_growth'])) : 0;
                 $info['vip_growth_1'] = ConfigService::make()->getConfigByCode('vip_growth_1');
                 $info['vip_growth_2'] = ConfigService::make()->getConfigByCode('vip_growth_2');
+                $info['vip_growth_progress'] = $info['vip_growth_2']?round($info['vip_growth']/$info['vip_growth_2'] * 100,2):0;
             }
 
             RedisService::set($cacheKey, $info, rand(10, 20));