| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 | 
							- <?php
 
- namespace app\api\controller;
 
- use app\common\controller\Api;
 
- use think\Db;
 
- //use app\common\model\wallet;
 
- /**
 
-  * 用户钱包
 
-  */
 
- class Userwallet extends Api
 
- {
 
-     protected $noNeedLogin = [];
 
-     protected $noNeedRight = ['*'];
 
-     //我的钱包余额
 
-     public function my_wallet(){
 
-         $wallet = model('wallet')->getwallet($this->auth->id);
 
-         $this->success('success',$wallet);
 
-     }
 
-     //充值记录
 
-     public function gold_recharge_log(){
 
-         $map = [
 
-             'user_id' => $this->auth->id,
 
-             'log_type'=> 10,
 
-         ];
 
-         $list = Db::name('user_gold_log')->field('id,change_value,remain,createtime')->where($map)->order('id desc')->autopage()->select();
 
-         $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);
 
-         $map = [
 
-            'user_id' => $this->auth->id,
 
-         ];
 
-         if($type){
 
-             $map['log_type'] = $type;
 
-         }
 
-         $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_gold_log(){
 
-         $type = input_post('type',0);
 
-         $map = [
 
-             'user_id' => $this->auth->id,
 
-         ];
 
-         if($type){
 
-             $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 = $this->list_appen_logtext($list);
 
-         $this->success('success',$list);
 
-     }
 
- }
 
 
  |