作者 王智

xiugai

... ... @@ -157,6 +157,8 @@ class Update extends Api
* @ApiMethod (POST)
* @ApiRoute (/api/Update/ThinkUserTick)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="status", type="int", required=true, description="0=可用优惠券,2=不可用优惠券")
* @ApiParams (name="total", type="int", required=true, description="总价")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
... ... @@ -165,4 +167,27 @@ class Update extends Api
}
})
*/
public function ThinkUserTick()
{
$UserId = $this->is_token($this->request->header());
$Status = input('status');
$Total = input('total');
$TickInfo = Db::name('tick')->find();
if (($Status == 0 && $Total < $TickInfo['door']) || ($Status == 2 && $Total > $TickInfo['door'])) {
$this->success('成功', []);
} else {
$TickArray = Db::name('user_tick')->where('user_id', $UserId)->where('status', 0)->select();
}
$List = [];
if (!empty($TickArray)) {
foreach ($TickArray as $k => $v) {
$List[$k]['id'] = $v['id'];
$List[$k]['title'] = $TickInfo['title'];
$List[$k]['door'] = $TickInfo['door'];
$List[$k]['del_price'] = $TickInfo['del_price'];
$List[$k]['exp_time'] = date('Y-m-d H:i:s', $v['exp_time']);
}
}
$this->success('成功', $List);
}
}
\ No newline at end of file
... ...