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

chore[litemall-wx, litemall-wx-api]: 优惠券API调整及文档

parent c9efb0de
This diff is collapsed.
...@@ -56,12 +56,6 @@ public class LitemallCouponService { ...@@ -56,12 +56,6 @@ public class LitemallCouponService {
return couponMapper.selectByExampleSelective(criteria.example(), result); return couponMapper.selectByExampleSelective(criteria.example(), result);
} }
public int queryTotal() {
LitemallCouponExample example = new LitemallCouponExample();
example.or().andTypeEqualTo(CouponConstant.TYPE_COMMON).andStatusEqualTo(CouponConstant.STATUS_NORMAL).andDeletedEqualTo(false);
return (int) couponMapper.countByExample(example);
}
public List<LitemallCoupon> queryAvailableList(Integer userId, int offset, int limit) { public List<LitemallCoupon> queryAvailableList(Integer userId, int offset, int limit) {
assert userId != null; assert userId != null;
// 过滤掉登录账号已经领取过的coupon // 过滤掉登录账号已经领取过的coupon
......
...@@ -63,11 +63,7 @@ public class WxCouponController { ...@@ -63,11 +63,7 @@ public class WxCouponController {
@Order @RequestParam(defaultValue = "desc") String order) { @Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallCoupon> couponList = couponService.queryList(page, limit, sort, order); List<LitemallCoupon> couponList = couponService.queryList(page, limit, sort, order);
int total = couponService.queryTotal(); return ResponseUtil.okList(couponList);
Map<String, Object> data = new HashMap<String, Object>();
data.put("data", couponList);
data.put("count", total);
return ResponseUtil.ok(data);
} }
/** /**
...@@ -94,11 +90,7 @@ public class WxCouponController { ...@@ -94,11 +90,7 @@ public class WxCouponController {
List<LitemallCouponUser> couponUserList = couponUserService.queryList(userId, null, status, page, limit, sort, order); List<LitemallCouponUser> couponUserList = couponUserService.queryList(userId, null, status, page, limit, sort, order);
List<CouponVo> couponVoList = change(couponUserList); List<CouponVo> couponVoList = change(couponUserList);
int total = couponService.queryTotal(); return ResponseUtil.okList(couponVoList, couponUserList);
Map<String, Object> data = new HashMap<String, Object>();
data.put("data", couponVoList);
data.put("count", total);
return ResponseUtil.ok(data);
} }
private List<CouponVo> change(List<LitemallCouponUser> couponList) { private List<CouponVo> change(List<LitemallCouponUser> couponList) {
...@@ -179,7 +171,7 @@ public class WxCouponController { ...@@ -179,7 +171,7 @@ public class WxCouponController {
List<CouponVo> couponVoList = change(availableCouponUserList); List<CouponVo> couponVoList = change(availableCouponUserList);
return ResponseUtil.ok(couponVoList); return ResponseUtil.okList(couponVoList);
} }
/** /**
......
...@@ -92,9 +92,9 @@ Page({ ...@@ -92,9 +92,9 @@ Page({
that.setData({ that.setData({
scrollTop: 0, scrollTop: 0,
couponList: res.data.data, couponList: res.data.list,
showPage: true, showPage: true,
count: res.data.count count: res.data.total
}); });
} }
wx.hideToast(); wx.hideToast();
......
...@@ -88,9 +88,9 @@ Page({ ...@@ -88,9 +88,9 @@ Page({
that.setData({ that.setData({
scrollTop: 0, scrollTop: 0,
couponList: res.data.data, couponList: res.data.list,
showPage: true, showPage: true,
count: res.data.count count: res.data.total
}); });
} }
}); });
......
...@@ -117,7 +117,7 @@ Page({ ...@@ -117,7 +117,7 @@ Page({
}).then(function (res) { }).then(function (res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
couponList: res.data couponList: res.data.list
}); });
} }
wx.hideToast(); wx.hideToast();
......
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