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 {
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) {
assert userId != null;
// 过滤掉登录账号已经领取过的coupon
......
......@@ -63,11 +63,7 @@ public class WxCouponController {
@Order @RequestParam(defaultValue = "desc") String order) {
List<LitemallCoupon> couponList = couponService.queryList(page, limit, sort, order);
int total = couponService.queryTotal();
Map<String, Object> data = new HashMap<String, Object>();
data.put("data", couponList);
data.put("count", total);
return ResponseUtil.ok(data);
return ResponseUtil.okList(couponList);
}
/**
......@@ -94,11 +90,7 @@ public class WxCouponController {
List<LitemallCouponUser> couponUserList = couponUserService.queryList(userId, null, status, page, limit, sort, order);
List<CouponVo> couponVoList = change(couponUserList);
int total = couponService.queryTotal();
Map<String, Object> data = new HashMap<String, Object>();
data.put("data", couponVoList);
data.put("count", total);
return ResponseUtil.ok(data);
return ResponseUtil.okList(couponVoList, couponUserList);
}
private List<CouponVo> change(List<LitemallCouponUser> couponList) {
......@@ -179,7 +171,7 @@ public class WxCouponController {
List<CouponVo> couponVoList = change(availableCouponUserList);
return ResponseUtil.ok(couponVoList);
return ResponseUtil.okList(couponVoList);
}
/**
......
......@@ -92,9 +92,9 @@ Page({
that.setData({
scrollTop: 0,
couponList: res.data.data,
couponList: res.data.list,
showPage: true,
count: res.data.count
count: res.data.total
});
}
wx.hideToast();
......
......@@ -88,9 +88,9 @@ Page({
that.setData({
scrollTop: 0,
couponList: res.data.data,
couponList: res.data.list,
showPage: true,
count: res.data.count
count: res.data.total
});
}
});
......
......@@ -117,7 +117,7 @@ Page({
}).then(function (res) {
if (res.errno === 0) {
that.setData({
couponList: res.data
couponList: res.data.list
});
}
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