Kaynağa Gözat

用户下单解锁

lizhen_gitee 2 yıl önce
ebeveyn
işleme
40c915aae1

+ 11 - 0
application/api/controller/Unlockorder.php

@@ -98,8 +98,19 @@ class Unlockorder extends Api
             'createtime' => time(),
             'endtime' => time() + 604800,
             'price' => $price,
+            'type' => 1,
         ];
 
+        //年费vip干预
+        $wallet = model('wallet')->getwallet($this->auth->id);
+        if($wallet['vip_endtime'] > time() && $wallet['vip_level'] == 30){
+            $data['price'] = 0;
+            $data['type'] = 2;
+            $data['endtime'] = time(); //立即过期,就看一下
+            $price = 0;
+        }
+
+        //log
         Db::startTrans();
         $order_id = Db::name('order_secretvideo')->insertGetId($data);
         if(!$order_id){

+ 21 - 1
application/api/controller/Usercenter.php

@@ -106,8 +106,28 @@ class Usercenter extends Api
         $match_audio  = Db::name('user_match_audio_log')->where($match_map_str)->sum('price');  //语音
         $match_video  = Db::name('user_match_video_log')->where($match_map_str)->sum('price');  //视频
 
-        $new_data['qinmi_sum'] = $gift_user_typing + $gift_user_party + $gift_user_livebc + $match_typing + $match_audio + $match_video;
+        $new_data['qinmi_sum'] = $qinmi_sum = $gift_user_typing + $gift_user_party + $gift_user_livebc + $match_typing + $match_audio + $match_video;
 
+        //解锁开关
+        $new_data['isshow_unlock_wechataccount'] = $qinmi_sum >= 15 ? 1 : 0;  //满足15亲密值才展示
+        if(config('site.open_unlock_wechataccount') == 0){
+            $new_data['isshow_unlock_wechataccount'] = 0; //总开关,强制隐藏
+        }
+        $new_data['isshow_unlock_secretvideo'] = $qinmi_sum >= 15 ? 1 : 0;    //满足15亲密值才展示
+
+        //上次解锁过期日期
+        $check_map = [
+            'user_id' => $this->auth->id,
+            'to_user_id' => $uid,
+        ];
+        $order_secretvideo = Db::name('order_secretvideo')->where($check_map)->order('id desc')->value('endtime');
+        $order_wechataccount = Db::name('order_wechataccount')->where($check_map)->order('id desc')->value('endtime');
+        $new_data['unlock_secretvideo_endtime'] = !empty($order_secretvideo) ? $order_secretvideo : 0;
+        $new_data['unlock_secretvideo_status'] = $new_data['unlock_secretvideo_endtime'] > time() ? 1 : 0;
+        $new_data['unlock_wechataccount_endtime'] = !empty($order_wechataccount) ? $order_wechataccount : 0;
+        $new_data['unlock_wechataccount_status'] = $new_data['unlock_wechataccount_endtime'] > time() ? 1 : 0;
+
+        //合并
         $userinfo = array_merge($userinfo,$new_data);
         //枚举
         $userinfo['education'] = Db::name('enum_education')->where('id',$userinfo['education_id'])->value('name');