Commit b8395d51 authored by Junling Bu's avatar Junling Bu
Browse files

fix[litemall-wx-api, litemall-wx]: 轻微调整。

parent c98bdc6f
...@@ -93,15 +93,15 @@ public class WxAddressController { ...@@ -93,15 +93,15 @@ public class WxAddressController {
@GetMapping("detail") @GetMapping("detail")
public Object detail(@LoginUser Integer userId, Integer id) { public Object detail(@LoginUser Integer userId, Integer id) {
if(userId == null){ if(userId == null){
return ResponseUtil.fail401(); return ResponseUtil.unlogin();
} }
if(id == null){ if(id == null){
return ResponseUtil.fail402(); return ResponseUtil.badArgument();
} }
LitemallAddress address = addressService.findById(id); LitemallAddress address = addressService.findById(id);
if(address == null){ if(address == null){
return ResponseUtil.fail403(); return ResponseUtil.badArgumentValue();
} }
Map<Object, Object> data = new HashMap<Object, Object>(); Map<Object, Object> data = new HashMap<Object, Object>();
...@@ -134,10 +134,10 @@ public class WxAddressController { ...@@ -134,10 +134,10 @@ public class WxAddressController {
@PostMapping("save") @PostMapping("save")
public Object save(@LoginUser Integer userId, @RequestBody LitemallAddress address) { public Object save(@LoginUser Integer userId, @RequestBody LitemallAddress address) {
if(userId == null){ if(userId == null){
return ResponseUtil.fail401(); return ResponseUtil.unlogin();
} }
if(address == null){ if(address == null){
return ResponseUtil.fail402(); return ResponseUtil.badArgument();
} }
if(address.getIsDefault()){ if(address.getIsDefault()){
...@@ -168,10 +168,10 @@ public class WxAddressController { ...@@ -168,10 +168,10 @@ public class WxAddressController {
@PostMapping("delete") @PostMapping("delete")
public Object delete(@LoginUser Integer userId, @RequestBody LitemallAddress address) { public Object delete(@LoginUser Integer userId, @RequestBody LitemallAddress address) {
if(userId == null){ if(userId == null){
return ResponseUtil.fail401(); return ResponseUtil.unlogin();
} }
if(address == null){ if(address == null){
return ResponseUtil.fail402(); return ResponseUtil.badArgument();
} }
addressService.delete(address.getId()); addressService.delete(address.getId());
......
...@@ -196,13 +196,13 @@ public class WxOrderController { ...@@ -196,13 +196,13 @@ public class WxOrderController {
orderGoodsVo.put("goodsName", orderGoods.getGoodsName()); orderGoodsVo.put("goodsName", orderGoods.getGoodsName());
orderGoodsVo.put("number", orderGoods.getNumber()); orderGoodsVo.put("number", orderGoods.getNumber());
orderGoodsVo.put("picUrl", orderGoods.getPicUrl()); orderGoodsVo.put("picUrl", orderGoods.getPicUrl());
orderGoodsVo.put("goodsSpecifitionValues", orderGoods.getGoodsSpecificationValues()); orderGoodsVo.put("goodsSpecificationValues", orderGoods.getGoodsSpecificationValues());
orderGoodsVoList.add(orderGoodsVo); orderGoodsVoList.add(orderGoodsVo);
} }
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("orderInfo", orderVo); result.put("orderInfo", orderVo);
result.put("orderGoods", orderGoodsList); result.put("orderGoods", orderGoodsVoList);
return ResponseUtil.ok(result); return ResponseUtil.ok(result);
} }
...@@ -217,7 +217,7 @@ public class WxOrderController { ...@@ -217,7 +217,7 @@ public class WxOrderController {
* @param userId 用户ID * @param userId 用户ID
* @param body 订单信息,{ cartId:xxx, addressId: xxx, couponId: xxx } * @param body 订单信息,{ cartId:xxx, addressId: xxx, couponId: xxx }
* @return 订单操作结果 * @return 订单操作结果
* 成功则 { errno: 0, errmsg: '成功', data: { orderInfo: xxx } } * 成功则 { errno: 0, errmsg: '成功', data: { orderId: xxx } }
* 失败则 { errno: XXX, errmsg: XXX } * 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("submit") @PostMapping("submit")
...@@ -262,7 +262,7 @@ public class WxOrderController { ...@@ -262,7 +262,7 @@ public class WxOrderController {
// 根据订单商品总价计算运费,满88则免运费,否则8元; // 根据订单商品总价计算运费,满88则免运费,否则8元;
BigDecimal freightPrice = new BigDecimal(0.00); BigDecimal freightPrice = new BigDecimal(0.00);
if(checkedGoodsPrice.compareTo(new BigDecimal(88.00)) == -1){ if(checkedGoodsPrice.compareTo(new BigDecimal(88.00)) < 0){
freightPrice = new BigDecimal(8.00); freightPrice = new BigDecimal(8.00);
} }
...@@ -313,7 +313,6 @@ public class WxOrderController { ...@@ -313,7 +313,6 @@ public class WxOrderController {
// 商品货品数量减少 // 商品货品数量减少
for (LitemallCart checkGoods : checkedGoodsList) { for (LitemallCart checkGoods : checkedGoodsList) {
checkedGoodsPrice = checkedGoodsPrice.add(checkGoods.getRetailPrice().multiply(new BigDecimal(checkGoods.getNumber())));
Integer productId= checkGoods.getProductId(); Integer productId= checkGoods.getProductId();
LitemallProduct product = productService.findById(productId); LitemallProduct product = productService.findById(productId);
if(product == null){ if(product == null){
...@@ -329,7 +328,7 @@ public class WxOrderController { ...@@ -329,7 +328,7 @@ public class WxOrderController {
} }
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("orderInfo", order); data.put("orderId", order.getId());
return ResponseUtil.ok(data); return ResponseUtil.ok(data);
} }
......
...@@ -104,7 +104,7 @@ Page({ ...@@ -104,7 +104,7 @@ Page({
} }
util.request(api.OrderSubmit, { cartId: 0, addressId: this.data.addressId, couponId: this.data.couponId }, 'POST').then(res => { util.request(api.OrderSubmit, { cartId: 0, addressId: this.data.addressId, couponId: this.data.couponId }, 'POST').then(res => {
if (res.errno === 0) { if (res.errno === 0) {
const orderId = res.data.orderInfo.id; const orderId = res.data.orderId;
// 目前不能支持微信支付,这里仅仅是模拟支付成功,同理,后台也仅仅是返回一个成功的消息而已 // 目前不能支持微信支付,这里仅仅是模拟支付成功,同理,后台也仅仅是返回一个成功的消息而已
wx.showModal({ wx.showModal({
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment