|
|
@@ -146,11 +146,7 @@ public class OrderController extends MyController {
|
|
|
renderJson(MyRet.fail("id(order_id) 有问题"));
|
|
|
return;
|
|
|
}
|
|
|
- User user = userService.findUserByMobileNumber(this.<String>getSessionAttr("mobile_number"));
|
|
|
- if (user == null) {
|
|
|
- renderJson(MyRet.fail("获取用户信息失败,请重新登录"));
|
|
|
- return;
|
|
|
- }
|
|
|
+ User user = userService.findUserByMobileNumber(getSessionAttr("mobile_number"));
|
|
|
|
|
|
// 判断订单归属权
|
|
|
if (service.isOrderBelongToUser(user.getId(), orderId)) {
|
|
|
@@ -169,6 +165,28 @@ public class OrderController extends MyController {
|
|
|
|
|
|
renderJson(service.cancelByUser(user.getId(), orderId));
|
|
|
}
|
|
|
+
|
|
|
+ @Before(LoginInterceptor.class)
|
|
|
+ public void findOrderById() {
|
|
|
+ // --- 从 JSON 请求体中获取参数 ---
|
|
|
+ JSONObject requestBodyJson = MyController.getJsonModelByRequestAndType(getRequest(), JSONObject.class);
|
|
|
+ Integer orderId;
|
|
|
+ // orderId
|
|
|
+ try {
|
|
|
+ orderId = requestBodyJson.getInteger("order_id");
|
|
|
+ } catch (Exception e) {
|
|
|
+ renderJson(MyRet.fail("你输入的 order_id 有些问题:" + e.getMessage()).setData(requestBodyJson));
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (orderId == null) {
|
|
|
+ renderJson(MyRet.fail("id(order_id) 有问题"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ User user = userService.findUserByMobileNumber(getSessionAttr("mobile_number"));
|
|
|
+
|
|
|
+ renderJson(service.findOrderById(orderId, user.getId()));
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 用户调用的订单列表
|