浏览代码

邀请页

lizhen_gitee 1 年之前
父节点
当前提交
7496d999a8
共有 3 个文件被更改,包括 22 次插入138 次删除
  1. 0 14
      application/api/controller/User.php
  2. 18 124
      application/api/controller/Userintro.php
  3. 4 0
      application/extra/site.php

+ 0 - 14
application/api/controller/User.php

@@ -300,23 +300,9 @@ class User extends Api
         $this->success(__('success'),$info);
     }
 
-    //用户邀请信息
-    public function userintroinfo(){
-        $intro_num = Db::name('user')->where('intro_uid',$this->auth->id)->count();
-        $money_sum = Db::name('user_money_log')->where(['user_id'=>$this->auth->id,'log_type'=>63])->sum('change_value');
 
-        $user_list = Db::name('user')->field('id,avatar,nickname,createtime')->where('intro_uid',$this->auth->id)->autopage()->select();
 
-        $rs = [
-            'intro_num' => $intro_num,
-            'money_sum' => $money_sum,
-            'user_list' => $user_list,
-        ];
-
-        $this->success('success',$rs);
-    }
 
-   
 
     //申请真人认证
     public function apply_real_confirm(){

+ 18 - 124
application/api/controller/Userintro.php

@@ -109,144 +109,38 @@ class Userintro extends Api
         $this->success('', $imgurl);
     }
 
-    //我的收益
-    public function myprofit(){
-        //今日
-        $start = strtotime(date('Y-m-d'));
-        $end   = $start + 86399;
-
-        //收益type
-        $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);
-        }
-        //dump($rs);
         $this->success('success',$rs);
     }
 
-    //收益数据
-    private function profit($userinfo){
-        $uid = $userinfo['id'];
-        //今日
-        $start = strtotime(date('Y-m-d'));
-        $end   = $start + 86399;
-
-        //收益type
-        $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;
-    }
 }

+ 4 - 0
application/extra/site.php

@@ -52,4 +52,8 @@ return array (
   'apkurl' => 'https://www.pgyer.com/5Y0t',
   'comment_for_gold_switch' => '1',
   'comment_for_gold_price' => '10',
+  'introsite_introrule' => '1、邀请新用户加入TKEN,即可获得奖励。/n
+2、奖励金可等额兑换“”吉傲“T币或会员,也可申请提取现金。/n
+3、邀请新用户每达到100人,奖励额外增加20%。/n
+4、禁止通过任何非常规或其他被TKEN认定为恶意的手段完成邀请。/n',
 );