lizhen_gitee 3 mesi fa
parent
commit
ca2343e961
1 ha cambiato i file con 11 aggiunte e 5 eliminazioni
  1. 11 5
      application/api/controller/Pay.php

+ 11 - 5
application/api/controller/Pay.php

@@ -16,12 +16,14 @@ class Pay extends Api
 
     //vip用的
     public function vip_config(){
-        $level = input('level',10);
-        if(!in_array($level,[10,20])){
-            $level = 10;
+        $level = input('level',0,'intval');
+
+        $where = [];
+        if($level){
+            $where['vip_level'] = $level;
         }
 
-        $list = Db::name('payvip_config')->where('is_show',1)->where('vip_level',$level)->order('weight asc,id asc')->select();
+        $list = Db::name('payvip_config')->where('is_show',1)->where($where)->order('weight asc,id asc')->select();
         foreach ($list as &$v) {
             $diff_price = '';
             if($v['info'] > $v['money']){
@@ -31,7 +33,11 @@ class Pay extends Api
         }
 
         $data['vipconfig'] = $list;
-        $data['vip_endtime'] = model('wallet')->getWallet($this->auth->id,'vip_endtime');
+
+        $user_wallet = model('wallet')->getWallet($this->auth->id);
+        $data['vip_endtime'] = $user_wallet['vip_endtime'];
+        $data['vip_level']   = $user_wallet['vip_level'];
+        $data['is_vip']      = $this->is_vip($user_wallet['vip_endtime'],$user_wallet['vip_level']);
         $this->success('success',$data);
     }