作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

接口

@@ -94,19 +94,10 @@ class SignController extends RestBaseController @@ -94,19 +94,10 @@ class SignController extends RestBaseController
94 $data['start_time']=$data['sleep_sign_time']; 94 $data['start_time']=$data['sleep_sign_time'];
95 $data['end_time']=$data['sleep_sign_end_time']; 95 $data['end_time']=$data['sleep_sign_end_time'];
96 } 96 }
97 -  
98 $data['sign']=0; 97 $data['sign']=0;
99 } 98 }
100 99
101 - //判断是否需要进行周打卡  
102 - if (!Db::name('user_week_sign')->where(['user_id'=>$this->getUserId()])->find()){  
103 - $is_week=1;  
104 - }  
105 - else if (Db::name('user_week_sign')->where(['user_id'=>$this->getUserId(),'create_time'=>[ '<', $beginToday-(7*24*60*60)]])->find()){  
106 - $is_week=1;  
107 - }else{  
108 - $is_week=0;  
109 - } 100 +
110 // $is_week=1; 101 // $is_week=1;
111 102
112 $this->success('首页信息',array( 103 $this->success('首页信息',array(
@@ -114,7 +105,6 @@ class SignController extends RestBaseController @@ -114,7 +105,6 @@ class SignController extends RestBaseController
114 'slogan'=>$re['slogan'], 105 'slogan'=>$re['slogan'],
115 'start_time'=>$data['start_time'], 106 'start_time'=>$data['start_time'],
116 'end_time'=>$data['end_time'], 107 'end_time'=>$data['end_time'],
117 - 'is_week'=>$is_week  
118 )); 108 ));
119 } 109 }
120 110
@@ -134,6 +124,16 @@ class SignController extends RestBaseController @@ -134,6 +124,16 @@ class SignController extends RestBaseController
134 * @return sleep:睡前打卡记录(null为未进行睡前打卡) 124 * @return sleep:睡前打卡记录(null为未进行睡前打卡)
135 */ 125 */
136 public function daySign(){ 126 public function daySign(){
  127 + $beginToday=mktime(0,0,0,date('m'),date('d'),date('Y'));
  128 + //判断是否需要进行周打卡
  129 + if (!Db::name('user_week_sign')->where(['user_id'=>$this->getUserId()])->find()){
  130 + $is_week=1;
  131 + }
  132 + else if (Db::name('user_week_sign')->where(['user_id'=>$this->getUserId(),'create_time'=>[ '<', $beginToday-(7*24*60*60)]])->find()){
  133 + $is_week=1;
  134 + }else{
  135 + $is_week=0;
  136 + }
137 // $param=$this->request->param(); 137 // $param=$this->request->param();
138 // if ($param['status']==1){ 138 // if ($param['status']==1){
139 // $type='morning'; 139 // $type='morning';
@@ -156,6 +156,7 @@ class SignController extends RestBaseController @@ -156,6 +156,7 @@ class SignController extends RestBaseController
156 $daySign['sleep']=empty($daySign['sleep'])?null:date('Y/m/d H:i:s',$daySign['sleep']); 156 $daySign['sleep']=empty($daySign['sleep'])?null:date('Y/m/d H:i:s',$daySign['sleep']);
157 //返回 157 //返回
158 $this->success('日打卡信息',array( 158 $this->success('日打卡信息',array(
  159 + 'is_week'=>$is_week,
159 'all'=>$user['all_sign_day'], 160 'all'=>$user['all_sign_day'],
160 'last'=>$user['stay_sign_day'], 161 'last'=>$user['stay_sign_day'],
161 'longest'=>$user['longest_sign_day'], 162 'longest'=>$user['longest_sign_day'],
@@ -137,7 +137,7 @@ class PublicController extends RestBaseController @@ -137,7 +137,7 @@ class PublicController extends RestBaseController
137 if (empty($re['mobile'])){ 137 if (empty($re['mobile'])){
138 $this->success(['msg'=>'请先手机号注册!','code'=>'40001'], ['token' => $token]); 138 $this->success(['msg'=>'请先手机号注册!','code'=>'40001'], ['token' => $token]);
139 } 139 }
140 - if ($re['user_status']!=1){ 140 + if ($re['user_status']!=1||$re['user_status']!=2){
141 $this->success(['msg'=>'请先填写用户信息!','code'=>'40002'], ['token' => $token]); 141 $this->success(['msg'=>'请先填写用户信息!','code'=>'40002'], ['token' => $token]);
142 } 142 }
143 $this->success("登录成功!", ['token' => $token]); 143 $this->success("登录成功!", ['token' => $token]);