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

接口

@@ -16,6 +16,7 @@ class SignController extends RestBaseController @@ -16,6 +16,7 @@ class SignController extends RestBaseController
16 * @url /portal/Sign/index 16 * @url /portal/Sign/index
17 * @method POST 17 * @method POST
18 * @header name:XX-Token require:1 default: desc:token 18 * @header name:XX-Token require:1 default: desc:token
  19 + * @return is_week:是否应该周打卡(优先判断),0:不需要周打卡,1:需要周打卡
19 * @return sign:1是早打卡,2是午打卡,3是晚打卡,4是睡前打卡,0不能打卡 20 * @return sign:1是早打卡,2是午打卡,3是晚打卡,4是睡前打卡,0不能打卡
20 * @return slogan:口号 21 * @return slogan:口号
21 * @return start_time:显示时间(开始) 22 * @return start_time:显示时间(开始)
@@ -87,11 +88,20 @@ class SignController extends RestBaseController @@ -87,11 +88,20 @@ class SignController extends RestBaseController
87 } 88 }
88 $data['sign']=0; 89 $data['sign']=0;
89 } 90 }
  91 +
  92 + //判断是否需要进行周打卡
  93 + if (Db::name('user_week_sign')->where(['user_id'=>$this->getUserId(),'create_time'=>[ '<', $beginToday-(7*24*60*60)]])->find()){
  94 + $is_week=1;
  95 + }else{
  96 + $is_week=0;
  97 + }
  98 +
90 $this->success('首页信息',array( 99 $this->success('首页信息',array(
91 'sign'=>$data['sign'], 100 'sign'=>$data['sign'],
92 'slogan'=>$re['slogan'], 101 'slogan'=>$re['slogan'],
93 'start_time'=>$data['start_time'], 102 'start_time'=>$data['start_time'],
94 'end_time'=>$data['end_time'], 103 'end_time'=>$data['end_time'],
  104 + 'is_week'=>$is_week
95 )); 105 ));
96 } 106 }
97 107
@@ -205,12 +215,7 @@ class SignController extends RestBaseController @@ -205,12 +215,7 @@ class SignController extends RestBaseController
205 Db::name('user')->where('id',$user['id'])->setInc('score',$score); 215 Db::name('user')->where('id',$user['id'])->setInc('score',$score);
206 Db::name('user_score_log')->insert(['score'=>$score,'create_time'=>time(),'action'=>'打卡','user_id'=>$user['id'],'now_score'=>$user['score']+$score]); 216 Db::name('user_score_log')->insert(['score'=>$score,'create_time'=>time(),'action'=>'打卡','user_id'=>$user['id'],'now_score'=>$user['score']+$score]);
207 217
208 - //判断是否需要进行周打卡  
209 - if (Db::name('user_week_sign')->where(['user_id'=>$this->getUserId(),'create_time'=>[ '<', $beginToday-(7*24*60*60)]])->find()){  
210 - $is_week=1;  
211 - }else{  
212 - $is_week=0;  
213 - } 218 +
214 219
215 //返回 220 //返回
216 $this->success('日打卡提交结果',array( 221 $this->success('日打卡提交结果',array(
@@ -224,6 +229,9 @@ class SignController extends RestBaseController @@ -224,6 +229,9 @@ class SignController extends RestBaseController
224 229
225 230
226 231
  232 +
  233 +
  234 +
227 /** 235 /**
228 * @title 分享接口 236 * @title 分享接口
229 * @description 分享接口结果返回 237 * @description 分享接口结果返回