Browse Source

删除废弃方法

lizhen_gitee 9 months ago
parent
commit
6c5a4dcef2
1 changed files with 0 additions and 108 deletions
  1. 0 108
      application/api/controller/Usercenter.php

+ 0 - 108
application/api/controller/Usercenter.php

@@ -1434,114 +1434,6 @@ $resArray['money'] = $money;  //返回给前端的计算结果
 
     //男性非会员解锁聊天
     public function unlockchat() {
-        exit;//app端确认不用了
-        // 接口防并发
-        if (!$this->apiLimit(1, 1)) {
-            $this->error(__('Operation frequently'));
-        }
-        //男性非会员是否已开通聊天
-        if ($this->auth->gender == 0) {
-            $this->error('不需要解锁');
-        }
-        $vip_endtime = Db::name('user_wallet')->where('user_id',$this->auth->id)->value('vip_endtime');
-        if ($vip_endtime > time()) {
-            $this->error('不需要解锁');
-        }
-
-        $user_id = input('user_id', 0, 'intval');//对方id
-        if (!$user_id) {
-            $this->error();
-        }
-        // 不可以守护给自己
-        if($this->auth->id == $user_id) {
-            $this->error("不可以解锁自己");
-        }
-        //查询是否解锁过
-        $user_chat_unlock = Db::name('user_chat_unlock')->where(['user_id' => $this->auth->id, 'user_to_id' => $user_id])->count('id');
-        if ($user_chat_unlock) {
-            $this->error('已经解锁过了');
-        }
 
-        $giftvalue = config('site.unlock_chat_gold');
-        if ($giftvalue <= 0) {
-            $this->error('解锁金额异常~');
-        }
-
-        //被解锁人信息
-        $touserinfo = Db::name('user')->where('id',$user_id)->find();
-        if (!$touserinfo) {
-            $this->error("不存在的用户");
-        }
-        // 判断当前用户余额
-        $user_gold = model('wallet')->getWallet($this->auth->id,'gold');
-        if($user_gold < $giftvalue) {
-            $this->error("您的金币余额不足");
-        }
-
-        Db::startTrans();
-        //添加解锁记录表
-        $data = [
-            'user_id' => $this->auth->id,
-            'user_to_id' => $user_id,
-            'price' => $giftvalue,
-            'createtime' => time(),
-        ];
-        $log_id = Db::name('user_chat_unlock')->insertGetId($data);
-        if(!$log_id){
-            Db::rollback();
-            $this->error('解锁失败');
-        }
-
-        if($giftvalue > 0){
-            // 扣除当前用户余额
-            $wallet_rs = model('wallet')->lockChangeAccountRemain($this->auth->id,$user_id,'gold',-$giftvalue,81,'开通守护','user_chat_unlock',$log_id);
-            if($wallet_rs['status'] === false){
-                Db::rollback();
-                $this->error($wallet_rs['msg']);
-            }
-
-            // 添加守护用户余额
-            $money_to_gold = config('site.money_to_gold');
-            $gift_plat_scale = config('site.gift_plat_scale');
-
-            $giftmoney = bcdiv($giftvalue,$money_to_gold,2);
-
-            $money = bcdiv(bcmul($giftmoney,100 - $gift_plat_scale,2),100,2);
-            $wallet_rs = model('wallet')->lockChangeAccountRemain($user_id,$this->auth->id,'money',$money,82,'被守护收益','user_chat_unlock',$log_id,2);
-            if($wallet_rs['status'] === false){
-                Db::rollback();
-                $this->error($wallet_rs['msg']);
-            }
-
-            //增加赠送用户上级余额
-            if ($touserinfo['intro_uid']) {
-                //获取返利比率
-                $is_agent = Db::name('user')->where(['id' => $touserinfo['intro_uid']])->value('is_agent');
-                $intro_income_rebate_rate = $is_agent ? (int)config('site.h_intro_income_rebate_rate') : (int)config('site.intro_income_rebate_rate'); //邀请人收礼物返利比率
-                if ($intro_income_rebate_rate > 0 && $intro_income_rebate_rate <= 100) {
-                    //上级获得金额
-                    $intro_uid_money = number_format($money * $intro_income_rebate_rate / 100, 2, '.', '');
-                    if ($intro_uid_money > 0) {
-                        $intro_result = model('Wallet')->lockChangeAccountRemain($touserinfo['intro_uid'],$user_id,'money',$intro_uid_money,68, '邀请人解锁聊天获赠奖励','gift_user_typing',$log_id);
-                        if($intro_result['status']===false)
-                        {
-                            Db::rollback();
-                            $this->error($intro_result['msg']);
-                        }
-                    }
-                }
-            }
-        }
-
-        //tag任务守护金币
-        //搭讪奖励
-//        $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,15);
-//        if($task_rs === false){
-//            Db::rollback();
-//            $this->error('完成任务守护奖励失败');
-//        }
-
-        Db::commit();
-        $this->success('解锁成功');
     }
 }