调整查询平安券返回值
This commit is contained in:
@@ -34,6 +34,7 @@ class UserController extends Controller
|
||||
|
||||
/**
|
||||
* Notes: 发券
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/6/29 13:57
|
||||
*/
|
||||
@@ -75,6 +76,7 @@ class UserController extends Controller
|
||||
|
||||
/**
|
||||
* Notes: 查询
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date : 2020/7/22 11:23
|
||||
* @param \Illuminate\Http\Request $request
|
||||
@@ -106,13 +108,43 @@ class UserController extends Controller
|
||||
$redemptionCode = $res['redemptionCode'];
|
||||
$outletId = $res['outletId'];
|
||||
|
||||
try {
|
||||
$res = Coupon::Query($redemptionCode, $outletId);
|
||||
|
||||
if (is_string($res)) {
|
||||
return $this->error($res, $log);
|
||||
}
|
||||
|
||||
if (isset($res['productItemList'])) {
|
||||
$ticket = explode('-', $res['productItemList'][0]['thirdPartyGoodsId']);
|
||||
|
||||
$full = $ticket[1]; //full100
|
||||
$price = $ticket[2];
|
||||
preg_match('/\d+/', $full, $result);
|
||||
$status = [
|
||||
0 => 1,
|
||||
1 => 2,
|
||||
2 => 2,
|
||||
3 => 3,
|
||||
4 => 3,
|
||||
][$res['status']];
|
||||
$res = [
|
||||
'name' => $res['couponName'],
|
||||
'code' => $res['redemptionCode'],
|
||||
'full' => $result[0],
|
||||
'price' => $price,
|
||||
'status' => $status,
|
||||
'used_at' => $res['issueDate'],
|
||||
'startTime' => $res['startTime'],
|
||||
'endTime' => $res['endTime'],
|
||||
];
|
||||
}
|
||||
|
||||
return $this->success($res, $log);
|
||||
} catch (\Exception $exception) {
|
||||
return $this->error($exception->getMessage(), $log);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//作废
|
||||
|
||||
Reference in New Issue
Block a user