作者 王智

xiugai

@@ -157,6 +157,8 @@ class Update extends Api @@ -157,6 +157,8 @@ class Update extends Api
157 * @ApiMethod (POST) 157 * @ApiMethod (POST)
158 * @ApiRoute (/api/Update/ThinkUserTick) 158 * @ApiRoute (/api/Update/ThinkUserTick)
159 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") 159 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  160 + * @ApiParams (name="status", type="int", required=true, description="0=可用优惠券,2=不可用优惠券")
  161 + * @ApiParams (name="total", type="int", required=true, description="总价")
160 * @ApiReturnParams (name="code", type="integer", required=true, sample="0") 162 * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
161 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") 163 * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
162 * @ApiReturn ({ 164 * @ApiReturn ({
@@ -165,4 +167,27 @@ class Update extends Api @@ -165,4 +167,27 @@ class Update extends Api
165 } 167 }
166 }) 168 })
167 */ 169 */
  170 + public function ThinkUserTick()
  171 + {
  172 + $UserId = $this->is_token($this->request->header());
  173 + $Status = input('status');
  174 + $Total = input('total');
  175 + $TickInfo = Db::name('tick')->find();
  176 + if (($Status == 0 && $Total < $TickInfo['door']) || ($Status == 2 && $Total > $TickInfo['door'])) {
  177 + $this->success('成功', []);
  178 + } else {
  179 + $TickArray = Db::name('user_tick')->where('user_id', $UserId)->where('status', 0)->select();
  180 + }
  181 + $List = [];
  182 + if (!empty($TickArray)) {
  183 + foreach ($TickArray as $k => $v) {
  184 + $List[$k]['id'] = $v['id'];
  185 + $List[$k]['title'] = $TickInfo['title'];
  186 + $List[$k]['door'] = $TickInfo['door'];
  187 + $List[$k]['del_price'] = $TickInfo['del_price'];
  188 + $List[$k]['exp_time'] = date('Y-m-d H:i:s', $v['exp_time']);
  189 + }
  190 + }
  191 + $this->success('成功', $List);
  192 + }
168 } 193 }