|
@@ -120,23 +120,35 @@ class Userintro extends Api
|
|
|
|
|
|
//邀请页多个信息
|
|
|
public function introsite_info(){
|
|
|
- //本周收益
|
|
|
- $week_start = strtotime(date('Y-m-d')) - ((date('w')==0?7:date('w'))-1)*86400;
|
|
|
- $week_end = $week_start + 604799;
|
|
|
-
|
|
|
- $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');
|
|
|
-
|
|
|
+ //本周
|
|
|
+ $thisweek_start = strtotime(date('Y-m-d')) - ((date('w')==0?7:date('w'))-1)*86400;
|
|
|
+ $thisweek_end = $thisweek_start + 604799;
|
|
|
+ //上周
|
|
|
+ $lastweek_start = $thisweek_start - 604800;
|
|
|
+ $lastweek_end = $thisweek_end - 604800;
|
|
|
+
|
|
|
+ //本周邀请人数
|
|
|
+ $intro_num_thisweek = Db::name('user')->where('intro_uid',$this->auth->id)->where('createtime','BETWEEN',[$thisweek_start,$thisweek_end])->count();
|
|
|
+ //上周邀请人数
|
|
|
+ $intro_num_lastweek = Db::name('user')->where('intro_uid',$this->auth->id)->where('createtime','BETWEEN',[$lastweek_start,$lastweek_end])->count();
|
|
|
+ //总邀请人数
|
|
|
+ $intro_num_all = Db::name('user')->where('intro_uid',$this->auth->id)->count();
|
|
|
+ //本周奖励
|
|
|
+ $money_sum_thisweek = Db::name('user_gold_log')->where(['user_id'=>$this->auth->id,'log_type'=>63,'createtime'=>['BETWEEN',[$thisweek_start,$thisweek_end]]])->sum('change_value');
|
|
|
+ //上周奖励
|
|
|
+ $money_sum_lastweek = Db::name('user_gold_log')->where(['user_id'=>$this->auth->id,'log_type'=>63,'createtime'=>['BETWEEN',[$lastweek_start,$lastweek_end]]])->sum('change_value');
|
|
|
+ //我邀请的人
|
|
|
$user_list = Db::name('user')->field('id,mobile,avatar,createtime')->where('intro_uid',$this->auth->id)->limit(3)->select();
|
|
|
|
|
|
$rs = [
|
|
|
'introsite_introrule' => config('site.introsite_introrule'),
|
|
|
'introcode' => $this->auth->introcode,
|
|
|
'user_list' => $user_list,
|
|
|
+ 'money_sum_thisweek' => $money_sum_thisweek,
|
|
|
+ 'money_sum_lastweek' => $money_sum_lastweek,
|
|
|
+ 'intro_num_thisweek' => $intro_num_thisweek,
|
|
|
+ 'intro_num_lastweek' => $intro_num_lastweek,
|
|
|
+ 'intro_num_all' => $intro_num_all,
|
|
|
];
|
|
|
|
|
|
$this->success('success',$rs);
|