|
@@ -109,144 +109,38 @@ class Userintro extends Api
|
|
|
$this->success('', $imgurl);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public function myprofit(){
|
|
|
-
|
|
|
- $start = strtotime(date('Y-m-d'));
|
|
|
- $end = $start + 86399;
|
|
|
-
|
|
|
-
|
|
|
- $profit_type = [21,22,23,52,54,56];
|
|
|
-
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'log_type' => ['IN',$profit_type],
|
|
|
- 'user_id' => $this->auth->id,
|
|
|
- 'createtime' => ['between',[$start,$end]],
|
|
|
- ];
|
|
|
- $today_profit = Db::name('user_money_log')->where($map)->sum('change_value');
|
|
|
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'user_id|to_user_id' => $this->auth->id,
|
|
|
- 'createtime' => ['between',[$start,$end]],
|
|
|
- ];
|
|
|
- $today_video_min = Db::name('user_match_video_log')->where($map)->count();
|
|
|
+
|
|
|
+ public function myintro_list(){
|
|
|
+ $list = Db::name('user')->field('id,mobile,avatar,createtime')->where('intro_uid',$this->auth->id)->autopage()->select();
|
|
|
+ $list = list_domain_image($list,['avatar']);
|
|
|
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'user_id|to_user_id' => $this->auth->id,
|
|
|
- 'createtime' => ['between',[$start,$end]],
|
|
|
- ];
|
|
|
- $today_audio_min = Db::name('user_match_audio_log')->where($map)->count();
|
|
|
+ $this->success('success',$list);
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+ public function introsite_info(){
|
|
|
|
|
|
$week_start = strtotime(date('Y-m-d')) - ((date('w')==0?7:date('w'))-1)*86400;
|
|
|
$week_end = $week_start + 604799;
|
|
|
|
|
|
- $map = [
|
|
|
- 'log_type' => ['IN',$profit_type],
|
|
|
- 'user_id' => $this->auth->id,
|
|
|
- 'createtime' => ['between',[$week_start,$week_end]],
|
|
|
- ];
|
|
|
- $week_profit = Db::name('user_money_log')->where($map)->sum('change_value');
|
|
|
-
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'log_type' => ['IN',$profit_type],
|
|
|
- 'user_id' => $this->auth->id,
|
|
|
- ];
|
|
|
- $all_profit = Db::name('user_money_log')->where($map)->sum('change_value');
|
|
|
-
|
|
|
-
|
|
|
- $my_intro_number = Db::name('user')->where('intro_uid',$this->auth->id)->count('id');
|
|
|
+ $intro_num_thisweek = Db::name('user')->where('intro_uid',$this->auth->id)->count();
|
|
|
+ $intro_num_lastweek = Db::name('user')->where('intro_uid',$this->auth->id)->count();
|
|
|
+ $intro_num_all = Db::name('user')->where('intro_uid',$this->auth->id)->count();
|
|
|
|
|
|
+ $money_sum_thisweek = Db::name('user_money_log')->where(['user_id'=>$this->auth->id,'log_type'=>63])->sum('change_value');
|
|
|
+ $money_sum_lastweek = Db::name('user_money_log')->where(['user_id'=>$this->auth->id,'log_type'=>63])->sum('change_value');
|
|
|
|
|
|
- $result = [
|
|
|
- 'avatar' => $this->auth->avatar,
|
|
|
- 'nickname' => $this->auth->nickname,
|
|
|
- 'username' => $this->auth->username,
|
|
|
+ $user_list = Db::name('user')->field('id,mobile,avatar,createtime')->where('intro_uid',$this->auth->id)->limit(3)->select();
|
|
|
|
|
|
- 'today_profit' => $today_profit,
|
|
|
- 'today_video_min' => $today_video_min,
|
|
|
- 'today_audio_min' => $today_audio_min,
|
|
|
- 'week_profit' => $week_profit,
|
|
|
- 'all_profit' => $all_profit,
|
|
|
- 'my_intro_number' => $my_intro_number,
|
|
|
+ $rs = [
|
|
|
+ 'introsite_introrule' => config('site.introsite_introrule'),
|
|
|
+ 'introcode' => $this->auth->introcode,
|
|
|
+ 'user_list' => $user_list,
|
|
|
];
|
|
|
|
|
|
- $this->success('success',$result);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public function myintro(){
|
|
|
- $map = [
|
|
|
- 'intro_uid' => $this->auth->id,
|
|
|
- ];
|
|
|
-
|
|
|
- $list = Db::name('user')->field('id,nickname,username,avatar')->where($map)->page($this->page,$this->listrow)->select();
|
|
|
-
|
|
|
- $rs = [];
|
|
|
- foreach($list as $key => $user){
|
|
|
- $rs[] = $this->profit($user);
|
|
|
- }
|
|
|
-
|
|
|
$this->success('success',$rs);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- private function profit($userinfo){
|
|
|
- $uid = $userinfo['id'];
|
|
|
-
|
|
|
- $start = strtotime(date('Y-m-d'));
|
|
|
- $end = $start + 86399;
|
|
|
-
|
|
|
-
|
|
|
- $profit_type = [21,22,23,52,54,56];
|
|
|
-
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'log_type' => ['IN',$profit_type],
|
|
|
- 'user_id' => $uid,
|
|
|
- 'createtime' => ['between',[$start,$end]],
|
|
|
- ];
|
|
|
- $today_profit = Db::name('user_money_log')->where($map)->sum('change_value');
|
|
|
-
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'user_id|to_user_id' => $uid,
|
|
|
- 'createtime' => ['between',[$start,$end]],
|
|
|
- ];
|
|
|
- $today_video_min = Db::name('user_match_video_log')->where($map)->count('id');
|
|
|
-
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'user_id|to_user_id' => $uid,
|
|
|
- 'createtime' => ['between',[$start,$end]],
|
|
|
- ];
|
|
|
- $today_audio_min = Db::name('user_match_audio_log')->where($map)->count('id');
|
|
|
|
|
|
-
|
|
|
- $week_start = strtotime(date('Y-m-d')) - ((date('w')==0?7:date('w'))-1)*86400;
|
|
|
- $week_end = $week_start + 604799;
|
|
|
-
|
|
|
- $map = [
|
|
|
- 'log_type' => ['IN',$profit_type],
|
|
|
- 'user_id' => $uid,
|
|
|
- 'createtime' => ['between',[$week_start,$week_end]],
|
|
|
- ];
|
|
|
- $week_profit = Db::name('user_money_log')->where($map)->sum('change_value');
|
|
|
-
|
|
|
- $result = [
|
|
|
- 'today_profit' => $today_profit,
|
|
|
- 'today_video_min' => $today_video_min,
|
|
|
- 'today_audio_min' => $today_audio_min,
|
|
|
- 'week_profit' => $week_profit,
|
|
|
- ];
|
|
|
-
|
|
|
- $result = array_merge($result,$userinfo);
|
|
|
-
|
|
|
- return $result;
|
|
|
- }
|
|
|
}
|