...
|
...
|
@@ -35,6 +35,18 @@ class SignController extends RestBaseController |
|
|
$user_id=$this->getUserId();
|
|
|
$re=Db::name('config')->where('id',1)->find();
|
|
|
|
|
|
$beginToday=mktime(0,0,0,date('m'),date('d'),date('Y'));
|
|
|
//判断是否需要进行周打卡
|
|
|
$res=Db::name('user_week_sign')->where(['user_id'=>$this->getUserId()])->order('create_time','desc')->find();
|
|
|
if (!$res){
|
|
|
$is_week=1;
|
|
|
}
|
|
|
else if ($res['create_time']<$beginToday-(7*24*60*60)){
|
|
|
$is_week=1;
|
|
|
}else{
|
|
|
$is_week=0;
|
|
|
}
|
|
|
|
|
|
$data['morning_sign_time']=date('H:i',$re['morning_sign_time']);
|
|
|
$data['morning_sign_end_time']=date('H:i',$re['morning_sign_end_time']);
|
|
|
$data['noon_sign_time']=date('H:i',$re['noon_sign_time']);
|
...
|
...
|
@@ -101,6 +113,7 @@ class SignController extends RestBaseController |
|
|
// $is_week=1;
|
|
|
|
|
|
$this->success('首页信息',array(
|
|
|
'is_week'=>$is_week,
|
|
|
'sign'=>$data['sign'],
|
|
|
'slogan'=>$re['slogan'],
|
|
|
'start_time'=>$data['start_time'],
|
...
|
...
|
@@ -124,17 +137,7 @@ class SignController extends RestBaseController |
|
|
* @return sleep:睡前打卡记录(null为未进行睡前打卡)
|
|
|
*/
|
|
|
public function daySign(){
|
|
|
$beginToday=mktime(0,0,0,date('m'),date('d'),date('Y'));
|
|
|
//判断是否需要进行周打卡
|
|
|
$re=Db::name('user_week_sign')->where(['user_id'=>$this->getUserId()])->order('create_time','desc')->find();
|
|
|
if (!$re){
|
|
|
$is_week=1;
|
|
|
}
|
|
|
else if ($re['create_time']<$beginToday-(7*24*60*60)){
|
|
|
$is_week=1;
|
|
|
}else{
|
|
|
$is_week=0;
|
|
|
}
|
|
|
|
|
|
// $param=$this->request->param();
|
|
|
// if ($param['status']==1){
|
|
|
// $type='morning';
|
...
|
...
|
@@ -157,7 +160,6 @@ class SignController extends RestBaseController |
|
|
$daySign['sleep']=empty($daySign['sleep'])?null:date('Y/m/d H:i:s',$daySign['sleep']);
|
|
|
//返回
|
|
|
$this->success('日打卡信息',array(
|
|
|
'is_week'=>$is_week,
|
|
|
'all'=>$user['all_sign_day'],
|
|
|
'last'=>$user['stay_sign_day'],
|
|
|
'longest'=>$user['longest_sign_day'],
|
...
|
...
|
|