...
|
...
|
@@ -156,8 +156,6 @@ class SignController extends RestBaseController |
|
|
public function daySignPost(){
|
|
|
$param=$this->request->param();
|
|
|
$user=Db::name('user')->where('id',$this->getUserId())->find();
|
|
|
$config=[];
|
|
|
$music=[];
|
|
|
//是否需要进入每日一签页面
|
|
|
$day_sign=0;
|
|
|
//根据签到种类判断增加积分数
|
...
|
...
|
@@ -217,7 +215,6 @@ class SignController extends RestBaseController |
|
|
Db::name('user_score_log')->insert(['score'=>$score,'create_time'=>time(),'action'=>'打卡','user_id'=>$user['id'],'now_score'=>$user['score']+$score]);
|
|
|
|
|
|
|
|
|
|
|
|
//返回
|
|
|
$this->success('日打卡提交结果',array(
|
|
|
'day_sign'=>$day_sign,
|
...
|
...
|
@@ -253,7 +250,6 @@ class SignController extends RestBaseController |
|
|
$score=$score['sleep_sign_score'];
|
|
|
}
|
|
|
|
|
|
|
|
|
$date=date("w",time()); //这个可以获取数字星期比如123,注意0是星期日
|
|
|
$config=Db::name('sign_image')->where('date',$date)->find();
|
|
|
$music=json_decode($config['music'],true);
|
...
|
...
|
@@ -279,10 +275,16 @@ class SignController extends RestBaseController |
|
|
public function share()
|
|
|
{
|
|
|
//用户信息
|
|
|
$config = Db::name('config')->where('id', 1)->find();
|
|
|
Db::name('user')->where('id',$this->getUserId())->setInc('score',$config['share_score']);
|
|
|
$user= Db::name('user')->where('id',$this->getUserId())->find();
|
|
|
Db::name('user_score_log')->insert(['user_id'=>$this->getUserId(),'score'=>$config['share_score'],'now_score'=>$user['score']]);
|
|
|
$config = Db::name('config')->where('id', 1)->find();
|
|
|
$beginToday=mktime(0,0,0,date('m'),date('d'),date('Y'));
|
|
|
$endToday=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;
|
|
|
$re=Db::name('user_score_log')->where(['user_id'=>$user['id'],'action'=>'分享','create_time'=>[ 'between time', [$beginToday,$endToday]]])->find();
|
|
|
if ($re){
|
|
|
$this->error('您今天已经分享过了');
|
|
|
}
|
|
|
Db::name('user')->where('id',$user['id'])->setInc('score',$config['share_score']);
|
|
|
Db::name('user_score_log')->insert(['user_id'=>$user['id'],'score'=>$config['share_score'],'now_score'=>($user['score']+$config['share_score'])]);
|
|
|
$this->success('分享成功');
|
|
|
}
|
|
|
|
...
|
...
|
|