正在显示
1 个修改的文件
包含
14 行增加
和
12 行删除
@@ -35,6 +35,18 @@ class SignController extends RestBaseController | @@ -35,6 +35,18 @@ class SignController extends RestBaseController | ||
35 | $user_id=$this->getUserId(); | 35 | $user_id=$this->getUserId(); |
36 | $re=Db::name('config')->where('id',1)->find(); | 36 | $re=Db::name('config')->where('id',1)->find(); |
37 | 37 | ||
38 | + $beginToday=mktime(0,0,0,date('m'),date('d'),date('Y')); | ||
39 | + //判断是否需要进行周打卡 | ||
40 | + $res=Db::name('user_week_sign')->where(['user_id'=>$this->getUserId()])->order('create_time','desc')->find(); | ||
41 | + if (!$res){ | ||
42 | + $is_week=1; | ||
43 | + } | ||
44 | + else if ($res['create_time']<$beginToday-(7*24*60*60)){ | ||
45 | + $is_week=1; | ||
46 | + }else{ | ||
47 | + $is_week=0; | ||
48 | + } | ||
49 | + | ||
38 | $data['morning_sign_time']=date('H:i',$re['morning_sign_time']); | 50 | $data['morning_sign_time']=date('H:i',$re['morning_sign_time']); |
39 | $data['morning_sign_end_time']=date('H:i',$re['morning_sign_end_time']); | 51 | $data['morning_sign_end_time']=date('H:i',$re['morning_sign_end_time']); |
40 | $data['noon_sign_time']=date('H:i',$re['noon_sign_time']); | 52 | $data['noon_sign_time']=date('H:i',$re['noon_sign_time']); |
@@ -101,6 +113,7 @@ class SignController extends RestBaseController | @@ -101,6 +113,7 @@ class SignController extends RestBaseController | ||
101 | // $is_week=1; | 113 | // $is_week=1; |
102 | 114 | ||
103 | $this->success('首页信息',array( | 115 | $this->success('首页信息',array( |
116 | + 'is_week'=>$is_week, | ||
104 | 'sign'=>$data['sign'], | 117 | 'sign'=>$data['sign'], |
105 | 'slogan'=>$re['slogan'], | 118 | 'slogan'=>$re['slogan'], |
106 | 'start_time'=>$data['start_time'], | 119 | 'start_time'=>$data['start_time'], |
@@ -124,17 +137,7 @@ class SignController extends RestBaseController | @@ -124,17 +137,7 @@ class SignController extends RestBaseController | ||
124 | * @return sleep:睡前打卡记录(null为未进行睡前打卡) | 137 | * @return sleep:睡前打卡记录(null为未进行睡前打卡) |
125 | */ | 138 | */ |
126 | public function daySign(){ | 139 | public function daySign(){ |
127 | - $beginToday=mktime(0,0,0,date('m'),date('d'),date('Y')); | ||
128 | - //判断是否需要进行周打卡 | ||
129 | - $re=Db::name('user_week_sign')->where(['user_id'=>$this->getUserId()])->order('create_time','desc')->find(); | ||
130 | - if (!$re){ | ||
131 | - $is_week=1; | ||
132 | - } | ||
133 | - else if ($re['create_time']<$beginToday-(7*24*60*60)){ | ||
134 | - $is_week=1; | ||
135 | - }else{ | ||
136 | - $is_week=0; | ||
137 | - } | 140 | + |
138 | // $param=$this->request->param(); | 141 | // $param=$this->request->param(); |
139 | // if ($param['status']==1){ | 142 | // if ($param['status']==1){ |
140 | // $type='morning'; | 143 | // $type='morning'; |
@@ -157,7 +160,6 @@ class SignController extends RestBaseController | @@ -157,7 +160,6 @@ class SignController extends RestBaseController | ||
157 | $daySign['sleep']=empty($daySign['sleep'])?null:date('Y/m/d H:i:s',$daySign['sleep']); | 160 | $daySign['sleep']=empty($daySign['sleep'])?null:date('Y/m/d H:i:s',$daySign['sleep']); |
158 | //返回 | 161 | //返回 |
159 | $this->success('日打卡信息',array( | 162 | $this->success('日打卡信息',array( |
160 | - 'is_week'=>$is_week, | ||
161 | 'all'=>$user['all_sign_day'], | 163 | 'all'=>$user['all_sign_day'], |
162 | 'last'=>$user['stay_sign_day'], | 164 | 'last'=>$user['stay_sign_day'], |
163 | 'longest'=>$user['longest_sign_day'], | 165 | 'longest'=>$user['longest_sign_day'], |
-
请 注册 或 登录 后发表评论