|
@@ -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;
|
|
|
+ }
|
|
|
|
|
|
}
|