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

个人中心接口

@@ -56,7 +56,7 @@ class GoodsController extends RestBaseController @@ -56,7 +56,7 @@ class GoodsController extends RestBaseController
56 * @title 立即兑换 56 * @title 立即兑换
57 * @description 立即兑换接口 57 * @description 立即兑换接口
58 * @author panhaowen 58 * @author panhaowen
59 - * @url /portal/Goods/goodsOrder 59 + * @url /portal/Goods/orderPost
60 * @method POST 60 * @method POST
61 * @header name:XX-Token require:1 default: desc:token 61 * @header name:XX-Token require:1 default: desc:token
62 * @param name:goods_id type:int require:1 other: desc:商品id 62 * @param name:goods_id type:int require:1 other: desc:商品id
@@ -90,89 +90,4 @@ class GoodsController extends RestBaseController @@ -90,89 +90,4 @@ class GoodsController extends RestBaseController
90 } 90 }
91 } 91 }
92 92
93 -  
94 - /**  
95 - * @title 日打卡提交  
96 - * @description 麦夫子日打卡提交接口  
97 - * @author panhaowen  
98 - * @url /portal/Sign/daySignPost  
99 - * @method POST  
100 - * @header name:XX-Token require:1 default: desc:token  
101 - * @param name:sign type:int require:1 other: desc:日打卡种类  
102 - * @return slogan:口号  
103 - */  
104 - public function daySignPost(){  
105 - $param=$this->request->param();  
106 - //根据星期判断music,image  
107 - $date=date("w",time()); //这个可以获取数字星期比如123,注意0是星期日  
108 - $config=Db::name('sign_image')->where('date',$date)->find();  
109 - $music=json_decode($config['music'],true);  
110 - $music=$music[rand(0,count($music,0)-1)];  
111 - //根据签到种类判断增加积分数  
112 - $score=Db::name('config')->where('id',1)->find();  
113 - if ($param['status']==1){  
114 - $score=$score['morning_sign_score'];  
115 - $type='morning';  
116 - }elseif ($param['status']==2){  
117 - $score=$score['noon_sign_score'];  
118 - $type='noon';  
119 - }elseif ($param['status']==3){  
120 - $score=$score['night_sign_score'];  
121 - $type='night';  
122 - }elseif ($param['status']==4){  
123 - $score=$score['sleep_sign_score'];  
124 - $type='sleep';  
125 - }  
126 - //将签到写入记录  
127 - $beginToday=mktime(0,0,0,date('m'),date('d'),date('Y'));  
128 - $endToday=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;  
129 - $yesterday = strtotime(date("Y-m-d",strtotime("-1 day")));  
130 - //已有记录  
131 - $re=Db::name('user_sign')->where(['user_id'=>$this->getUserId(),'create_time'=>[ 'between time', [$beginToday,$endToday]]])->find();  
132 - if ($re){  
133 - //更新打卡  
134 - Db::name('user_sign')->where('id',$re['id'])->update(["$type"=>time()]);  
135 - //判断是否打满了4次  
136 - if (!empty($re['morning'])&&!empty($re['noon'])&&!empty($re['night'])&&!empty($re['sleep'])){  
137 - Db::name('user_sign')->where('id',$re['id'])->update(['status'=>1]);  
138 - Db::name('user')->where('id',$this->getUserId())->setInc('all_sign_day',1);  
139 - //判断是否为连续打卡  
140 - $last=Db::name('user_sign')->where(['user_id'=>$this->getUserId(),'status'=>1,'create_time'=>[ 'between time', [$yesterday,$beginToday]]])->find();  
141 - $user=Db::name('user')->where('id',$this->getUserId())->find();  
142 - if ($user['stay_sign_day']==0 ||$last)  
143 - {  
144 - Db::name('user')->where('id',$this->getUserId())->setInc('all_sign_day',1);  
145 - //判断最大连续打卡天数  
146 - if ($user['stay_sign_day']>$user['longest_sign_day']){  
147 - Db::name('user')->where('id',$this->getUserId())->update(['longest_sign_day'=>$user['stay_sign_day']]);  
148 - }  
149 - }  
150 - }  
151 - }  
152 - //无记录  
153 - else{  
154 - Db::name('user_sign')->insert(['user_id'=>$this->getUserId(),'create_time'=>time(),"$type"=>time()]);  
155 - }  
156 - //获取打卡积分  
157 - Db::name('user')->where('id',$this->getUserId())->setInc('score',$score);  
158 -  
159 - //判断是否需要进行周打卡  
160 - if (!Db::name('user_week_sign')->where('user_id',$this->getUserId())->find()){  
161 - $is_week=1;  
162 - }elseif (Db::name('user_week_sign')->where(['user_id'=>$this->getUserId(),'create_time'=>[ '<', $beginToday-($score['week_sign']*24*60*60)]])->find()){  
163 - $is_week=1;  
164 - }else{  
165 - $is_week=0;  
166 - }  
167 -  
168 - //返回  
169 - $this->success('日打卡提交结果',array(  
170 - 'background'=>cmf_get_image_preview_url($config['image']),  
171 - 'music'=>cmf_get_file_download_url($music['url']),  
172 - 'music_name'=>$music['name'],  
173 - 'score'=>$score,  
174 - 'week'=>$is_week  
175 - ));  
176 - }  
177 -  
178 } 93 }
@@ -9,7 +9,9 @@ class Doc @@ -9,7 +9,9 @@ class Doc
9 'copyright'=>'银河百荣科技', 9 'copyright'=>'银河百荣科技',
10 'controller' => [ 10 'controller' => [
11 'api\\home\\controller\\IndexController', 11 'api\\home\\controller\\IndexController',
12 - 'api\\portal\\controller\\GoodsController' 12 + 'api\\portal\\controller\\GoodsController',
  13 + 'api\\portal\\controller\\SignController'
  14 +
13 ], 15 ],
14 'password'=>'', 16 'password'=>'',
15 'static_path'=>'', 17 'static_path'=>'',