浏览代码

钱包修改

lizhen_gitee 1 年之前
父节点
当前提交
7aa3acafa1

+ 3 - 1
application/api/controller/Pay.php

@@ -92,7 +92,9 @@ class Pay extends Api
     public function gold_config(){
         $list = Db::name('paygold_webcon')->order('weigh asc,id asc')->select();
         $data['goldconfig'] = $list;
-        $data['gold'] = model('wallet')->getWallet($this->auth->id,'gold');
+
+        $wallet = model('wallet')->getWallet($this->auth->id);
+        $data['wallet'] = $wallet;
         $data['money_to_gold'] = config('site.money_to_gold');
         $this->success('success',$data);
     }

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

@@ -227,128 +227,6 @@ class Usercenter extends Api
 
 
 
-
-    //打字聊天每句话调用一次
-    public function typing_once(){
-        //检测用户
-        $to_user_id = input_post('to_user_id');
-        $to_user_info = Db::name('user')->field('id,real_status,gender,free_video,free_audio,free_typing')->where('id',$to_user_id)->find();
-        if(!$to_user_info){
-            $this->error('不存在的用户');
-        }
-
-        //正常价格
-        $price = config('site.typing_min_price');  //扣费金币
-        $bili  = config('site.money_to_gold');    //兑换比例
-        $gift_plat_scale = config('site.gift_plat_scale');  //抽成比例
-        $money = bcdiv($price,$bili,2);           //对应人民币
-        $money = bcdiv(bcmul($money,100 - $gift_plat_scale,2),100,2); //抽成后收益
-
-        //发起用户的分数,被发起用户的分数。按性别给分
-        $auth_level = 0;
-        $tous_level = 0;
-
-        //打分
-        if($this->auth->gender == 0 && $this->auth->real_status == 1){
-            $auth_level = 30;//实名女最高
-        }
-        if($this->auth->gender == 0 && $this->auth->real_status != 1){
-            $auth_level = 20;//未实名女次之
-        }
-        if($this->auth->gender == 1){
-            $auth_level = 10;//男性最低
-        }
-        if($to_user_info['gender'] == 0 && $to_user_info['real_status'] == 1){
-            $tous_level = 30;
-        }
-        if($to_user_info['gender'] == 0 && $to_user_info['real_status'] != 1){
-            $tous_level = 20;
-        }
-        if($to_user_info['gender'] == 1){
-            $tous_level = 10;
-        }
-
-        //同性不收钱
-        //都是男的,不扣钱
-        //都是实名认证的女性,不扣钱
-        //都是未实名认证的女性,不扣钱
-        if($auth_level == $tous_level){
-            $price = 0;$money = 0;
-        }
-        //性别优势的人发起,免费
-        if($auth_level > $tous_level){
-            $price = 0;$money = 0;
-        }
-
-        Db::startTrans();
-        //记录日志
-        $data = [
-            'user_id' => $this->auth->id,
-            'price'   => $price,
-            'createtime' => time(),
-            'to_user_id' => $to_user_id,
-            'money' => $money,
-        ];
-
-        $log_id = Db::name('user_match_typing_log')->insertGetId($data);
-        if(!$log_id){
-            Db::rollback();
-            $this->error('扣费失败');
-        }
-
-        //同性别,提前结束
-        if($auth_level == $tous_level){
-            Db::commit();
-            $this->success('success');
-        }
-        //零消费,零收益消费,提前结束,其实这条没必要,下面金钱操作还会过滤一次
-        if($price == 0 && $money == 0){
-            Db::commit();
-            $this->success('success');
-        }
-
-        //扣钱uid,收钱uid,收钱free_video
-        //分数少扣钱,分数多收益
-        if($auth_level < $tous_level){
-            $kou_user = $this->auth->id;
-            $get_user = $to_user_info['id'];
-            $get_user_free = $to_user_info['free_typing'];
-        }else{
-            //这种已经没有了
-            $kou_user = $to_user_info['id'];
-            $get_user = $this->auth->id;
-            $get_user_free = $this->auth->free_typing;
-        }
-
-        //有性别差,扣费
-        if($price > 0){
-            $rs = model('wallet')->lockChangeAccountRemain($kou_user,'gold',-$price,13,'','user_match_typing_log',$log_id);
-            if($rs['status'] === false){
-                Db::rollback();
-                $this->error($rs['msg']);
-            }
-        }
-        //另一方加钱,0收费
-        if($money > 0 && $get_user_free == 0){
-            $rs = model('wallet')->lockChangeAccountRemain($get_user,'money',$money,23,'','user_match_typing_log',$log_id);
-            if($rs['status'] === false){
-                Db::rollback();
-                $this->error($rs['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('success');
-    }
-
     //语音匹配
     public function getaudiouser(){
 

+ 0 - 25
application/api/controller/Userlike.php

@@ -26,31 +26,6 @@ class Userlike extends Api
         $this->success('success',$list);
     }
 
-    //解锁喜欢我的人
-    public function unlock_like_me(){
-        $gold = intval(config('site.unlock_like_me'));
-        if($gold > 0){
-
-            Db::startTrans();
-            $rs = model('wallet')->lockChangeAccountRemain($this->auth->id,'gold',-$gold,62,'');
-            if($rs['status'] === false){
-                Db::rollback();
-                $this->error($rs['msg']);
-            }
-
-            //tag任务赠送金币
-            //消费解锁喜欢我的人
-            $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,17);
-            if($task_rs === false){
-                Db::rollback();
-                $this->error('完成任务赠送奖励失败');
-            }
-
-            Db::commit();
-            $this->success('操作成功');
-        }
-        $this->success('操作成功');
-    }
 
     //我喜欢的人列表
     public function my_like_list(){

+ 15 - 81
application/api/controller/Userwallet.php

@@ -16,6 +16,7 @@ class Userwallet extends Api
     //我的钱包余额
     public function my_wallet(){
         $wallet = model('wallet')->getwallet($this->auth->id);
+        $wallet['is_vip'] = $wallet['vip_endtime'] > time() ? 1 : 0;
         $this->success('success',$wallet);
     }
 
@@ -32,84 +33,6 @@ class Userwallet extends Api
         $this->success('success',$list);
     }
 
-    //我的收益,三个数据
-    public function my_income_count(){
-        //累计收益,不计来源
-        $map = [
-            'user_id' => $this->auth->id,
-            //'log_type'=> ['IN',[21,22,23]],
-        ];
-        $income_sum = Db::name('user_money_log')->where($map)->sum('change_value');
-
-        //可提现总收益
-        $money_remain = model('wallet')->getwallet($this->auth->id,'money');
-
-        //今日收益
-        $start = strtotime(date('Y-m-d'));
-        $end = $start + 86399;
-        $map['createtime'] = ['between',[$start,$end]];
-        $today_income_sum = Db::name('user_money_log')->where($map)->sum('change_value');
-
-        $result = [
-            'income_sum' => $income_sum,
-            'money_remain' => $money_remain,
-            'today_income_sum' => $today_income_sum,
-        ];
-
-        $this->success('success',$result);
-    }
-
-    //追加log_text
-    private function list_appen_logtext($list){
-        if(!empty($list)){
-            $conf = config('wallet.logtype');
-            foreach($list as $key => $val){
-                $list[$key]['log_text'] = isset($conf[$val['log_type']]) ? $conf[$val['log_type']] : '';
-            }
-        }
-        return $list;
-    }
-
-    //互动收益,打视频,语音,文字聊天,聊天送礼物
-    public function hudong_money(){
-        $map = [
-            'user_id' => $this->auth->id,
-            'log_type'=> ['IN',[21,22,23,54]],
-        ];
-        $list = Db::name('user_money_log')
-            ->field('id,log_type,change_value,remain,remark,createtime')
-            ->where($map)->order('id desc')->autopage()->select();
-
-        $list = $this->list_appen_logtext($list);
-        $this->success('success',$list);
-    }
-    //音聊收益,语聊间礼物
-    public function party_money(){
-        $map = [
-            'user_id' => $this->auth->id,
-            'log_type'=> 52,
-        ];
-        $list = Db::name('user_money_log')
-            ->field('id,log_type,change_value,remain,remark,createtime')
-            ->where($map)->order('id desc')->autopage()->select();
-
-        $list = $this->list_appen_logtext($list);
-        $this->success('success',$list);
-    }
-    //直播收益,直播间礼物
-    public function livebc_money(){
-        $map = [
-            'user_id' => $this->auth->id,
-            'log_type'=> 56,
-        ];
-        $list = Db::name('user_money_log')
-            ->field('id,log_type,change_value,remain,remark,createtime')
-            ->where($map)->order('id desc')->autopage()->select();
-
-        $list = $this->list_appen_logtext($list);
-        $this->success('success',$list);
-    }
-
     //我的余额日志
     public function my_money_log(){
         $type = input_post('type',0);
@@ -122,7 +45,7 @@ class Userwallet extends Api
         }
 
         $list = Db::name('user_money_log')
-            ->field('id,log_type,change_value,remain,remark,createtime')
+            ->field('id,log_type,before,change_value,remain,remark,createtime')
             ->where($map)->order('id desc')->autopage()->select();
         $list = $this->list_appen_logtext($list);
 
@@ -140,12 +63,23 @@ class Userwallet extends Api
             $map['log_type'] = $type;
         }
 
-        $list = Db::name('user_gold_log')->field('id,log_type,change_value,remain,createtime')->where($map)->order('id desc')->autopage()->select();
+        $list = Db::name('user_gold_log')
+            ->field('id,log_type,before,change_value,remain,remark,createtime')
+            ->where($map)->order('id desc')->autopage()->select();
         $list = $this->list_appen_logtext($list);
 
         $this->success('success',$list);
     }
 
-
+    //追加log_text
+    private function list_appen_logtext($list){
+        if(!empty($list)){
+            $conf = config('wallet.logtype');
+            foreach($list as $key => $val){
+                $list[$key]['log_text'] = isset($conf[$val['log_type']]) ? $conf[$val['log_type']] : '';
+            }
+        }
+        return $list;
+    }
 
 }

+ 1 - 14
application/extra/wallet.php

@@ -8,34 +8,21 @@ return [
 
 
         10 => '金币充值',//gold +
-//        11 => '视频通话消费',
-//        12 => '语音通话消费',
-//        13 => '文字聊天消费',
         14 => '金币首充赠送',
         15 => '提现',      //money
 
-//        21 => '视频通话收益',//money
-//        22 => '语音通话收益',//money
-//        23 => '文字聊天收益',//money
 
         31 => '购买装扮消费',
         41 => '签到赠送金币',
 
-//        51 => '语聊间赠送礼物',
-//        52 => '语聊间获得礼物',//money
 
         53 => '聊天赠送礼物',//gold -
-        54 => '聊天获得礼物',//money
+        54 => '聊天获得礼物',//money +
 
-//        55 => '直播赠送礼物',
-//        56 => '直播获得礼物',//money
 
         61 => '完成个人任务',
-//        62 => '解锁喜欢我的人',
         63 => '邀请注册奖励',//money
 
-//        71 => '解锁微信',
-//        72 => '解锁视频',
     ],
     'moneyname' => [
         'money'    => '余额',