You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
871 B
35 lines
871 B
<?php
|
|
namespace app\appapi\controller\v1;
|
|
|
|
use app\appapi\ApiController;
|
|
use think\facade\Db;
|
|
|
|
|
|
class Bonus extends ApiController
|
|
{
|
|
public function check(){
|
|
$bonus_sn = input('bonus_sn');
|
|
|
|
$result = Db::name('bonus')
|
|
->alias('b')
|
|
->leftjoin('bonus_type bt','b.bonus_type_id=bt.type_id')
|
|
->where('bonus_sn',$bonus_sn)
|
|
->find();
|
|
|
|
if(!$result){
|
|
return $this->Error('優惠券不存在');
|
|
}
|
|
if($result['remain_number']==0){
|
|
return $this->Error('優惠券已用完');
|
|
}
|
|
|
|
$rtn = [
|
|
'type_money' => $result['type_money'],
|
|
'type_name' => $result['type_name'],
|
|
'bonus_number' => $result['bonus_number'],
|
|
'remain_number' => $result['remain_number'],
|
|
];
|
|
return $this->Success($rtn);
|
|
|
|
}
|
|
} |