Commit 5905fdd7 authored by Junling Bu's avatar Junling Bu
Browse files

chore[litemall-wx-api]: 代码注释清理。

parent d2089428
...@@ -19,6 +19,9 @@ import java.util.HashMap; ...@@ -19,6 +19,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 用户收货地址服务
*/
@RestController @RestController
@RequestMapping("/wx/address") @RequestMapping("/wx/address")
@Validated @Validated
...@@ -35,13 +38,6 @@ public class WxAddressController { ...@@ -35,13 +38,6 @@ public class WxAddressController {
* *
* @param userId 用户ID * @param userId 用户ID
* @return 收货地址列表 * @return 收货地址列表
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("list") @GetMapping("list")
public Object list(@LoginUser Integer userId) { public Object list(@LoginUser Integer userId) {
...@@ -72,29 +68,8 @@ public class WxAddressController { ...@@ -72,29 +68,8 @@ public class WxAddressController {
* 收货地址详情 * 收货地址详情
* *
* @param userId 用户ID * @param userId 用户ID
* @param id 收地址ID * @param id 收地址ID
* @return 收货地址详情 * @return 收货地址详情
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* id: xxx,
* name: xxx,
* provinceId: xxx,
* cityId: xxx,
* areaId: xxx,
* mobile: xxx,
* address: xxx,
* isDefault: xxx,
* version: xxx
* provinceName: xxx,
* cityName: xxx,
* areaName: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("detail") @GetMapping("detail")
public Object detail(@LoginUser Integer userId, @NotNull Integer id) { public Object detail(@LoginUser Integer userId, @NotNull Integer id) {
...@@ -182,8 +157,6 @@ public class WxAddressController { ...@@ -182,8 +157,6 @@ public class WxAddressController {
* @param userId 用户ID * @param userId 用户ID
* @param address 用户收货地址 * @param address 用户收货地址
* @return 添加或更新操作结果 * @return 添加或更新操作结果
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("save") @PostMapping("save")
public Object save(@LoginUser Integer userId, @RequestBody LitemallAddress address) { public Object save(@LoginUser Integer userId, @RequestBody LitemallAddress address) {
...@@ -217,10 +190,8 @@ public class WxAddressController { ...@@ -217,10 +190,8 @@ public class WxAddressController {
* 删除收货地址 * 删除收货地址
* *
* @param userId 用户ID * @param userId 用户ID
* @param address 用户收货地址 * @param address 用户收货地址,{ id: xxx }
* @return 删除结果 * @return 删除操作结果
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("delete") @PostMapping("delete")
public Object delete(@LoginUser Integer userId, @RequestBody LitemallAddress address) { public Object delete(@LoginUser Integer userId, @RequestBody LitemallAddress address) {
......
...@@ -35,6 +35,9 @@ import java.util.HashMap; ...@@ -35,6 +35,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 鉴权服务
*/
@RestController @RestController
@RequestMapping("/wx/auth") @RequestMapping("/wx/auth")
@Validated @Validated
...@@ -56,18 +59,6 @@ public class WxAuthController { ...@@ -56,18 +59,6 @@ public class WxAuthController {
* @param body 请求内容,{ username: xxx, password: xxx } * @param body 请求内容,{ username: xxx, password: xxx }
* @param request 请求对象 * @param request 请求对象
* @return 登录结果 * @return 登录结果
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* token: xxx,
* tokenExpire: xxx,
* userInfo: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("login") @PostMapping("login")
public Object login(@RequestBody String body, HttpServletRequest request) { public Object login(@RequestBody String body, HttpServletRequest request) {
...@@ -113,18 +104,6 @@ public class WxAuthController { ...@@ -113,18 +104,6 @@ public class WxAuthController {
* @param wxLoginInfo 请求内容,{ code: xxx, userInfo: xxx } * @param wxLoginInfo 请求内容,{ code: xxx, userInfo: xxx }
* @param request 请求对象 * @param request 请求对象
* @return 登录结果 * @return 登录结果
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* token: xxx,
* tokenExpire: xxx,
* userInfo: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("login_by_weixin") @PostMapping("login_by_weixin")
public Object loginByWeixin(@RequestBody WxLoginInfo wxLoginInfo, HttpServletRequest request) { public Object loginByWeixin(@RequestBody WxLoginInfo wxLoginInfo, HttpServletRequest request) {
......
...@@ -17,6 +17,9 @@ import java.util.HashMap; ...@@ -17,6 +17,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 专题服务
*/
@RestController @RestController
@RequestMapping("/wx/brand") @RequestMapping("/wx/brand")
@Validated @Validated
...@@ -32,17 +35,6 @@ public class WxBrandController { ...@@ -32,17 +35,6 @@ public class WxBrandController {
* @param page 分页页数 * @param page 分页页数
* @param size 分页大小 * @param size 分页大小
* @return 品牌列表 * @return 品牌列表
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* brandList: xxx,
* totalPages: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("list") @GetMapping("list")
public Object list(@RequestParam(defaultValue = "1") Integer page, public Object list(@RequestParam(defaultValue = "1") Integer page,
...@@ -63,16 +55,6 @@ public class WxBrandController { ...@@ -63,16 +55,6 @@ public class WxBrandController {
* *
* @param id 品牌ID * @param id 品牌ID
* @return 品牌详情 * @return 品牌详情
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* brand: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("detail") @GetMapping("detail")
public Object detail(@NotNull Integer id) { public Object detail(@NotNull Integer id) {
......
...@@ -19,6 +19,9 @@ import java.util.HashMap; ...@@ -19,6 +19,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 用户购物车服务
*/
@RestController @RestController
@RequestMapping("/wx/cart") @RequestMapping("/wx/cart")
@Validated @Validated
...@@ -37,21 +40,10 @@ public class WxCartController { ...@@ -37,21 +40,10 @@ public class WxCartController {
private LitemallGrouponRulesService grouponRulesService; private LitemallGrouponRulesService grouponRulesService;
/** /**
* 购物车 * 用户购物车信息
* *
* @param userId 用户ID * @param userId 用户ID
* @return 购物车 * @return 用户购物车信息
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* cartList: xxx,
* cartTotal: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("index") @GetMapping("index")
public Object index(@LoginUser Integer userId) { public Object index(@LoginUser Integer userId) {
...@@ -86,20 +78,14 @@ public class WxCartController { ...@@ -86,20 +78,14 @@ public class WxCartController {
} }
/** /**
* 添加商品加入购物车 * 加入商品到购物车
* 如果已经存在购物车货品,则添加数量; * <p>
* 如果已经存在购物车货品,则增加数量;
* 否则添加新的购物车货品项。 * 否则添加新的购物车货品项。
* *
* @param userId 用户ID * @param userId 用户ID
* @param cart 购物车商品信息, { goodsId: xxx, productId: xxx, number: xxx } * @param cart 购物车商品信息, { goodsId: xxx, productId: xxx, number: xxx }
* @return 加入购物车操作结果 * @return 加入购物车操作结果
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("add") @PostMapping("add")
public Object add(@LoginUser Integer userId, @RequestBody LitemallCart cart) { public Object add(@LoginUser Integer userId, @RequestBody LitemallCart cart) {
...@@ -157,22 +143,15 @@ public class WxCartController { ...@@ -157,22 +143,15 @@ public class WxCartController {
} }
/** /**
* 立即购买商品 * 立即购买
* <p> * <p>
* 和 前面一个方法add的区别在于 * 和add方法的区别在于
* 1. 如果购物车内已经存在购物车货品,前者的逻辑是数量添加,这里的逻辑是数量覆盖 * 1. 如果购物车内已经存在购物车货品,前者的逻辑是数量添加,这里的逻辑是数量覆盖
* 2. 添加成功以后,前者的逻辑是返回当前购物车商品数量,这里的逻辑是返回对应购物车项的ID * 2. 添加成功以后,前者的逻辑是返回当前购物车商品数量,这里的逻辑是返回对应购物车项的ID
* *
* @param userId 用户ID * @param userId 用户ID
* @param cart 购物车商品信息, { goodsId: xxx, productId: xxx, number: xxx } * @param cart 购物车商品信息, { goodsId: xxx, productId: xxx, number: xxx }
* @return 即购买操作结果 * @return 立即购买操作结果
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("fastadd") @PostMapping("fastadd")
public Object fastadd(@LoginUser Integer userId, @RequestBody LitemallCart cart) { public Object fastadd(@LoginUser Integer userId, @RequestBody LitemallCart cart) {
...@@ -230,14 +209,11 @@ public class WxCartController { ...@@ -230,14 +209,11 @@ public class WxCartController {
} }
/** /**
* 更新指定的购物车信息 * 修改购物车商品货品数量
* 目前只支持修改商品的数量
* *
* @param userId 用户ID * @param userId 用户ID
* @param cart 购物车商品信息, { id: xxx, goodsId: xxx, productId: xxx, number: xxx } * @param cart 购物车商品信息, { id: xxx, goodsId: xxx, productId: xxx, number: xxx }
* @return 更新购物车操作结果 * @return 修改结果
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("update") @PostMapping("update")
public Object update(@LoginUser Integer userId, @RequestBody LitemallCart cart) { public Object update(@LoginUser Integer userId, @RequestBody LitemallCart cart) {
...@@ -290,19 +266,13 @@ public class WxCartController { ...@@ -290,19 +266,13 @@ public class WxCartController {
} }
/** /**
* 购物车商品勾选 * 购物车商品货品勾选状态
* <p>
* 如果原来没有勾选,则设置勾选状态;如果商品已经勾选,则设置非勾选状态。 * 如果原来没有勾选,则设置勾选状态;如果商品已经勾选,则设置非勾选状态。
* *
* @param userId 用户ID * @param userId 用户ID
* @param body 购物车商品信息, { productIds: xxx, isChecked: 1/0 } * @param body 购物车商品信息, { productIds: xxx, isChecked: 1/0 }
* @return 购物车信息 * @return 购物车信息
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("checked") @PostMapping("checked")
public Object checked(@LoginUser Integer userId, @RequestBody String body) { public Object checked(@LoginUser Integer userId, @RequestBody String body) {
...@@ -362,18 +332,12 @@ public class WxCartController { ...@@ -362,18 +332,12 @@ public class WxCartController {
} }
/** /**
* 购物车商品数量 * 购物车商品货品数量
* <p>
* 如果用户没有登录,则返回空数据。 * 如果用户没有登录,则返回空数据。
* *
* @param userId 用户ID * @param userId 用户ID
* @return 购物车商品数量 * @return 购物车商品货品数量
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("goodscount") @GetMapping("goodscount")
public Object goodscount(@LoginUser Integer userId) { public Object goodscount(@LoginUser Integer userId) {
...@@ -391,36 +355,17 @@ public class WxCartController { ...@@ -391,36 +355,17 @@ public class WxCartController {
} }
/** /**
* 购物车下单信息 * 购物车下单
* *
* @param userId 用户ID * @param userId 用户ID
* @param cartId 购物车商品ID * @param cartId 购物车商品ID
* 如果购物车商品ID是空,则下单当前用户所有购物车商品; * 如果购物车商品ID是空,则下单当前用户所有购物车商品;
* 如果购物车商品ID非空,则只下单当前购物车商品。 * 如果购物车商品ID非空,则只下单当前购物车商品。
* @param addressId 收货地址ID * @param addressId 收货地址ID
* 如果收货地址ID是空,则查询当前用户的默认地址。 * 如果收货地址ID是空,则查询当前用户的默认地址。
* @param couponId 优惠券ID * @param couponId 优惠券ID
* 目前不支持 * 目前不支持
* @return 购物车下单信息 * @return 购物车操作结果
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* addressId: xxx,
* checkedAddress: xxx,
* couponId: xxx,
* checkedCoupon: xxx,
* goodsTotalPrice: xxx,
* freightPrice: xxx,
* couponPrice: xxx,
* orderTotalPrice: xxx,
* actualPrice: xxx,
* checkedGoodsList: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("checkout") @GetMapping("checkout")
public Object checkout(@LoginUser Integer userId, Integer cartId, Integer addressId, Integer couponId, Integer grouponRulesId) { public Object checkout(@LoginUser Integer userId, Integer cartId, Integer addressId, Integer couponId, Integer grouponRulesId) {
...@@ -512,26 +457,4 @@ public class WxCartController { ...@@ -512,26 +457,4 @@ public class WxCartController {
data.put("checkedGoodsList", checkedGoodsList); data.put("checkedGoodsList", checkedGoodsList);
return ResponseUtil.ok(data); return ResponseUtil.ok(data);
} }
/**
* 商品优惠券列表
* 目前不支持
*
* @param userId 用户ID
* @return 商品优惠券信息
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/
@GetMapping("checkedCouponList")
public Object checkedCouponList(@LoginUser Integer userId) {
if (userId == null) {
return ResponseUtil.unlogin();
}
return ResponseUtil.unsupport();
}
} }
\ No newline at end of file
...@@ -18,6 +18,9 @@ import java.util.HashMap; ...@@ -18,6 +18,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 类目服务
*/
@RestController @RestController
@RequestMapping("/wx/catalog") @RequestMapping("/wx/catalog")
@Validated @Validated
...@@ -28,26 +31,14 @@ public class WxCatalogController { ...@@ -28,26 +31,14 @@ public class WxCatalogController {
private LitemallCategoryService categoryService; private LitemallCategoryService categoryService;
/** /**
* 分类栏目 * 分类详情
* *
* @param id 分类类目ID * @param id 分类类目ID
* 如果分类类目ID是空,则选择第一个分类类目。 * 如果分类类目ID是空,则选择第一个分类类目。
* 需要注意,这里分类类目是一级类目 * 需要注意,这里分类类目是一级类目
* @param page 分页页数 * @param page 分页页数
* @param size 分页大小 * @param size 分页大小
* @return 分类栏目 * @return 分类详情
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* categoryList: xxx,
* currentCategory: xxx,
* currentSubCategory: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("index") @GetMapping("index")
public Object index(Integer id, public Object index(Integer id,
...@@ -79,9 +70,9 @@ public class WxCatalogController { ...@@ -79,9 +70,9 @@ public class WxCatalogController {
} }
/** /**
* 一次性获取全部分类数据 * 所有分类数据
* *
* @return * @return 所有分类数据
*/ */
@GetMapping("all") @GetMapping("all")
public Object queryAll() { public Object queryAll() {
...@@ -127,17 +118,6 @@ public class WxCatalogController { ...@@ -127,17 +118,6 @@ public class WxCatalogController {
* *
* @param id 分类类目ID * @param id 分类类目ID
* @return 当前分类栏目 * @return 当前分类栏目
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* currentCategory: xxx,
* currentSubCategory: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("current") @GetMapping("current")
public Object current(@NotNull Integer id) { public Object current(@NotNull Integer id) {
......
...@@ -20,6 +20,9 @@ import java.util.HashMap; ...@@ -20,6 +20,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 用户收藏服务
*/
@RestController @RestController
@RequestMapping("/wx/collect") @RequestMapping("/wx/collect")
@Validated @Validated
...@@ -36,21 +39,9 @@ public class WxCollectController { ...@@ -36,21 +39,9 @@ public class WxCollectController {
* *
* @param userId 用户ID * @param userId 用户ID
* @param type 类型,如果是0则是商品收藏,如果是1则是专题收藏 * @param type 类型,如果是0则是商品收藏,如果是1则是专题收藏
* 目前没有使用
* @param page 分页页数 * @param page 分页页数
* @param size 分页大小 * @param size 分页大小
* @return 用户收藏列表 * @return 用户收藏列表
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* collectList: xxx,
* totalPages: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("list") @GetMapping("list")
public Object list(@LoginUser Integer userId, public Object list(@LoginUser Integer userId,
...@@ -89,29 +80,18 @@ public class WxCollectController { ...@@ -89,29 +80,18 @@ public class WxCollectController {
/** /**
* 用户收藏添加或删除 * 用户收藏添加或删除
* <p>
* 如果商品没有收藏,则添加收藏;如果商品已经收藏,则删除收藏状态。
* *
* @param userId 用户ID * @param userId 用户ID
* @param body 请求内容 * @param body 请求内容,{ type: xxx, valueId: xxx }
* @return 操作结果 * @return 操作结果
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* type: xxx,
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("addordelete") @PostMapping("addordelete")
public Object addordelete(@LoginUser Integer userId, @RequestBody String body) { public Object addordelete(@LoginUser Integer userId, @RequestBody String body) {
if (userId == null) { if (userId == null) {
return ResponseUtil.unlogin(); return ResponseUtil.unlogin();
} }
if (body == null) {
return ResponseUtil.badArgument();
}
Byte type = JacksonUtil.parseByte(body, "type"); Byte type = JacksonUtil.parseByte(body, "type");
Integer valueId = JacksonUtil.parseInteger(body, "valueId"); Integer valueId = JacksonUtil.parseInteger(body, "valueId");
......
...@@ -22,6 +22,9 @@ import java.util.HashMap; ...@@ -22,6 +22,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 用户评论服务
*/
@RestController @RestController
@RequestMapping("/wx/comment") @RequestMapping("/wx/comment")
@Validated @Validated
...@@ -82,13 +85,6 @@ public class WxCommentController { ...@@ -82,13 +85,6 @@ public class WxCommentController {
* @param userId 用户ID * @param userId 用户ID
* @param comment 评论内容 * @param comment 评论内容
* @return 发表评论操作结果 * @return 发表评论操作结果
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("post") @PostMapping("post")
public Object post(@LoginUser Integer userId, @RequestBody LitemallComment comment) { public Object post(@LoginUser Integer userId, @RequestBody LitemallComment comment) {
...@@ -111,17 +107,6 @@ public class WxCommentController { ...@@ -111,17 +107,6 @@ public class WxCommentController {
* @param type 类型ID。 如果是0,则查询商品评论;如果是1,则查询专题评论。 * @param type 类型ID。 如果是0,则查询商品评论;如果是1,则查询专题评论。
* @param valueId 商品或专题ID。如果type是0,则是商品ID;如果type是1,则是专题ID。 * @param valueId 商品或专题ID。如果type是0,则是商品ID;如果type是1,则是专题ID。
* @return 评论数量 * @return 评论数量
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* allCount: xxx,
* hasPicCount: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("count") @GetMapping("count")
public Object count(@NotNull Byte type, @NotNull Integer valueId) { public Object count(@NotNull Byte type, @NotNull Integer valueId) {
...@@ -142,18 +127,6 @@ public class WxCommentController { ...@@ -142,18 +127,6 @@ public class WxCommentController {
* @param page 分页页数 * @param page 分页页数
* @param size 分页大小 * @param size 分页大小
* @return 评论列表 * @return 评论列表
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* data: xxx,
* count: xxx,
* currentPage: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("list") @GetMapping("list")
public Object list(@NotNull Byte type, public Object list(@NotNull Byte type,
......
...@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
* 意见反馈服务
*
* @author Yogeek * @author Yogeek
* @date 2018/8/25 14:10 * @date 2018/8/25 14:10
*/ */
...@@ -60,7 +62,11 @@ public class WxFeedbackController { ...@@ -60,7 +62,11 @@ public class WxFeedbackController {
} }
/** /**
* 意见反馈 * 添加意见反馈
*
* @param userId 用户ID
* @param feedback 意见反馈
* @return 操作结果
*/ */
@PostMapping("submit") @PostMapping("submit")
public Object submit(@LoginUser Integer userId, @RequestBody LitemallFeedback feedback) { public Object submit(@LoginUser Integer userId, @RequestBody LitemallFeedback feedback) {
......
...@@ -23,6 +23,9 @@ import java.util.HashMap; ...@@ -23,6 +23,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 商品服务
*/
@RestController @RestController
@RequestMapping("/wx/goods") @RequestMapping("/wx/goods")
@Validated @Validated
...@@ -66,23 +69,6 @@ public class WxGoodsController { ...@@ -66,23 +69,6 @@ public class WxGoodsController {
* @param userId 用户ID * @param userId 用户ID
* @param id 商品ID * @param id 商品ID
* @return 商品详情 * @return 商品详情
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* info: xxx,
* userHasCollect: xxx,
* issue: xxx,
* comment: xxx,
* specificationList: xxx,
* productList: xxx,
* attribute: xxx,
* brand: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("detail") @GetMapping("detail")
public Object detail(@LoginUser Integer userId, @NotNull Integer id) { public Object detail(@LoginUser Integer userId, @NotNull Integer id) {
...@@ -165,23 +151,9 @@ public class WxGoodsController { ...@@ -165,23 +151,9 @@ public class WxGoodsController {
/** /**
* 商品分类类目 * 商品分类类目
* <p>
* TODO 可能应该合并到WxCatalogController中
* *
* @param id 分类类目ID * @param id 分类类目ID
* @return 商品分类类目 * @return 商品分类类目
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* currentCategory: xxx,
* parentCategory: xxx,
* brotherCategory: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("category") @GetMapping("category")
public Object category(@NotNull Integer id) { public Object category(@NotNull Integer id) {
...@@ -210,29 +182,17 @@ public class WxGoodsController { ...@@ -210,29 +182,17 @@ public class WxGoodsController {
* 1. 这里的前五个参数都是可选的,甚至都是空 * 1. 这里的前五个参数都是可选的,甚至都是空
* 2. 用户是可选登录,如果登录,则记录用户的搜索关键字 * 2. 用户是可选登录,如果登录,则记录用户的搜索关键字
* *
* @param categoryId 分类类目ID * @param categoryId 分类类目ID,可选
* @param brandId 品牌商ID * @param brandId 品牌商ID,可选
* @param keyword 关键字 * @param keyword 关键字,可选
* @param isNew 是否新品 * @param isNew 是否新品,可选
* @param isHot 是否热买 * @param isHot 是否热买,可选
* @param userId 用户ID * @param userId 用户ID
* @param page 分页页数 * @param page 分页页数
* @param size 分页大小 * @param size 分页大小
* @param sort 排序方式 * @param sort 排序方式,支持"add_time", "retail_price"或"name"
* @param order 排序类型,顺序或者降序 * @param order 排序类型,顺序或者降序
* @return 根据条件搜素的商品详情 * @return 根据条件搜素的商品详情
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* goodsList: xxx,
* filterCategoryList: xxx,
* count: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("list") @GetMapping("list")
public Object list(Integer categoryId, Integer brandId, String keyword, Boolean isNew, Boolean isHot, public Object list(Integer categoryId, Integer brandId, String keyword, Boolean isNew, Boolean isHot,
...@@ -272,21 +232,9 @@ public class WxGoodsController { ...@@ -272,21 +232,9 @@ public class WxGoodsController {
} }
/** /**
* 新品首发页面的横幅数据 * 新品首发页面的横幅
* <p>
* TODO 其实可以删除
* *
* @return 新品首发页面的栏目数据 * @return 新品首发页面的横幅
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* bannerInfo: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("new") @GetMapping("new")
public Object newGoods() { public Object newGoods() {
...@@ -301,21 +249,9 @@ public class WxGoodsController { ...@@ -301,21 +249,9 @@ public class WxGoodsController {
} }
/** /**
* 人气推荐页面的横幅数据 * 人气推荐页面的横幅
* <p>
* TODO 其实可以删除
* *
* @return 人气推荐页面的栏目数据 * @return 人气推荐页面的横幅
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* bannerInfo: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("hot") @GetMapping("hot")
public Object hotGoods() { public Object hotGoods() {
...@@ -329,19 +265,10 @@ public class WxGoodsController { ...@@ -329,19 +265,10 @@ public class WxGoodsController {
} }
/** /**
* 商品页面推荐商品 * 商品详情页面“大家都在看”推荐商品
* *
* @return 商品页面推荐商品 * @param id, 商品ID
* 成功则 * @return 商品详情页面推荐商品
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* goodsList: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("related") @GetMapping("related")
public Object related(@NotNull Integer id) { public Object related(@NotNull Integer id) {
...@@ -365,16 +292,6 @@ public class WxGoodsController { ...@@ -365,16 +292,6 @@ public class WxGoodsController {
* 在售的商品总数 * 在售的商品总数
* *
* @return 在售的商品总数 * @return 在售的商品总数
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* goodsCount: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("count") @GetMapping("count")
public Object count() { public Object count() {
......
...@@ -24,6 +24,11 @@ import java.util.HashMap; ...@@ -24,6 +24,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 团购服务
* <p>
* 需要注意这里团购规则和团购活动的关系和区别。
*/
@RestController @RestController
@RequestMapping("/wx/groupon") @RequestMapping("/wx/groupon")
@Validated @Validated
...@@ -47,24 +52,12 @@ public class WxGrouponController { ...@@ -47,24 +52,12 @@ public class WxGrouponController {
@Autowired @Autowired
private LitemallGrouponRulesService grouponRulesService; private LitemallGrouponRulesService grouponRulesService;
/** /**
* 专题列表 * 团购规则列表
* *
* @param page 分页页数 * @param page 分页页数
* @param size 分页大小 * @param size 分页大小
* @return 专题列表 * @return 团购规则列表
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* data: xxx,
* count: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("list") @GetMapping("list")
public Object list(@RequestParam(defaultValue = "1") Integer page, public Object list(@RequestParam(defaultValue = "1") Integer page,
...@@ -79,6 +72,13 @@ public class WxGrouponController { ...@@ -79,6 +72,13 @@ public class WxGrouponController {
return ResponseUtil.ok(data); return ResponseUtil.ok(data);
} }
/**
* 团购活动详情
*
* @param userId 用户ID
* @param grouponId 团购活动ID
* @return 团购活动详情
*/
@GetMapping("detail") @GetMapping("detail")
public Object detail(@LoginUser Integer userId, @NotNull Integer grouponId) { public Object detail(@LoginUser Integer userId, @NotNull Integer grouponId) {
if (userId == null) { if (userId == null) {
...@@ -171,6 +171,12 @@ public class WxGrouponController { ...@@ -171,6 +171,12 @@ public class WxGrouponController {
return ResponseUtil.ok(result); return ResponseUtil.ok(result);
} }
/**
* 参加团购
*
* @param grouponId 团购活动ID
* @return 操作结果
*/
@GetMapping("join") @GetMapping("join")
public Object join(@NotNull Integer grouponId) { public Object join(@NotNull Integer grouponId) {
LitemallGroupon groupon = grouponService.queryById(grouponId); LitemallGroupon groupon = grouponService.queryById(grouponId);
...@@ -195,6 +201,13 @@ public class WxGrouponController { ...@@ -195,6 +201,13 @@ public class WxGrouponController {
return ResponseUtil.ok(result); return ResponseUtil.ok(result);
} }
/**
* 用户开团或入团情况
*
* @param userId 用户ID
* @param showType 显示类型,如果是0,则是当前用户开的团购;否则,则是当前用户参加的团购
* @return 用户开团或入团情况
*/
@GetMapping("my") @GetMapping("my")
public Object my(@LoginUser Integer userId, @RequestParam(defaultValue = "0") Integer showType) { public Object my(@LoginUser Integer userId, @RequestParam(defaultValue = "0") Integer showType) {
if (userId == null) { if (userId == null) {
...@@ -265,6 +278,12 @@ public class WxGrouponController { ...@@ -265,6 +278,12 @@ public class WxGrouponController {
return ResponseUtil.ok(result); return ResponseUtil.ok(result);
} }
/**
* 商品所对应的团购规则
*
* @param goodsId 商品ID
* @return 团购规则详情
*/
@GetMapping("query") @GetMapping("query")
public Object query(@NotNull Integer goodsId) { public Object query(@NotNull Integer goodsId) {
LitemallGoods goods = goodsService.findById(goodsId); LitemallGoods goods = goodsService.findById(goodsId);
......
...@@ -19,6 +19,9 @@ import java.util.HashMap; ...@@ -19,6 +19,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 首页服务
*/
@RestController @RestController
@RequestMapping("/wx/home") @RequestMapping("/wx/home")
@Validated @Validated
...@@ -51,25 +54,9 @@ public class WxHomeController { ...@@ -51,25 +54,9 @@ public class WxHomeController {
} }
/** /**
* app首页 * 首页数据
* *
* @return app首页相关信息 * @return 首页数据
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* banner: xxx,
* channel: xxx,
* newGoodsList: xxx,
* hotGoodsList: xxx,
* topicList: xxx,
* grouponList: xxx,
* floorGoodsList: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("/index") @GetMapping("/index")
public Object index() { public Object index() {
......
...@@ -6,11 +6,19 @@ import org.linlinjava.litemall.core.util.ResponseUtil; ...@@ -6,11 +6,19 @@ import org.linlinjava.litemall.core.util.ResponseUtil;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/**
* 测试服务
*/
@RestController @RestController
@RequestMapping("/wx/index") @RequestMapping("/wx/index")
public class WxIndexController { public class WxIndexController {
private final Log logger = LogFactory.getLog(WxIndexController.class); private final Log logger = LogFactory.getLog(WxIndexController.class);
/**
* 测试数据
*
* @return 测试数据
*/
@RequestMapping("/index") @RequestMapping("/index")
public Object index() { public Object index() {
return ResponseUtil.ok("hello world, this is wx service"); return ResponseUtil.ok("hello world, this is wx service");
......
...@@ -45,22 +45,26 @@ import java.util.HashMap; ...@@ -45,22 +45,26 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/* /**
* 订单设计 * 订单服务
* *
* <p>
* 订单状态: * 订单状态:
* 101 订单生成,未支付;102,下单后未支付用户取消;103,下单后未支付超时系统自动取消 * 101 订单生成,未支付;102,下单后未支付用户取消;103,下单后未支付超时系统自动取消
* 201 支付完成,商家未发货;202,订单生产,已付款未发货,但是退款取消; * 201 支付完成,商家未发货;202,订单生产,已付款未发货,但是退款取消;
* 301 商家发货,用户未确认; * 301 商家发货,用户未确认;
* 401 用户确认收货; 402 用户没有确认收货超过一定时间,系统自动确认收货; * 401 用户确认收货; 402 用户没有确认收货超过一定时间,系统自动确认收货;
* *
* <p>
* 用户操作:
* 当101用户未付款时,此时用户可以进行的操作是取消订单,或者付款操作 * 当101用户未付款时,此时用户可以进行的操作是取消订单,或者付款操作
* 当201支付完成而商家未发货时,此时用户可以取消订单并申请退款 * 当201支付完成而商家未发货时,此时用户可以取消订单并申请退款
* 当301商家已发货时,此时用户可以有确认收货的操作 * 当301商家已发货时,此时用户可以有确认收货的操作
* 当401用户确认收货以后,此时用户可以进行的操作是删除订单,评价商品,或者再次购买 * 当401用户确认收货以后,此时用户可以进行的操作是删除订单,评价商品,或者再次购买
* 当402系统自动确认收货以后,此时用户可以删除订单,评价商品,或者再次购买 * 当402系统自动确认收货以后,此时用户可以删除订单,评价商品,或者再次购买
* *
* 目前不支持订单退货和售后服务 * <p>
* 注意:目前不支持订单退货和售后服务
*/ */
@RestController @RestController
@RequestMapping("/wx/order") @RequestMapping("/wx/order")
...@@ -116,26 +120,15 @@ public class WxOrderController { ...@@ -116,26 +120,15 @@ public class WxOrderController {
* 订单列表 * 订单列表
* *
* @param userId 用户ID * @param userId 用户ID
* @param showType 订单信息 * @param showType 订单信息
* 0, 全部订单 * 0,全部订单
* 1,待付款 * 1,待付款
* 2,待发货 * 2,待发货
* 3,待收货 * 3,待收货
* 4,待评价 * 4,待评价
* @param page 分页页数 * @param page 分页页数
* @param size 分页大小 * @param size 分页大小
* @return 订单操作结果 * @return 订单列表
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* data: xxx ,
* count: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("list") @GetMapping("list")
public Object list(@LoginUser Integer userId, public Object list(@LoginUser Integer userId,
...@@ -192,19 +185,8 @@ public class WxOrderController { ...@@ -192,19 +185,8 @@ public class WxOrderController {
* 订单详情 * 订单详情
* *
* @param userId 用户ID * @param userId 用户ID
* @param orderId 订单信息 * @param orderId 订单ID
* @return 订单操作结果 * @return 订单详情
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* orderInfo: xxx ,
* orderGoods: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("detail") @GetMapping("detail")
public Object detail(@LoginUser Integer userId, @NotNull Integer orderId) { public Object detail(@LoginUser Integer userId, @NotNull Integer orderId) {
...@@ -254,16 +236,16 @@ public class WxOrderController { ...@@ -254,16 +236,16 @@ public class WxOrderController {
/** /**
* 提交订单 * 提交订单
* 1. 根据购物车ID、地址ID、优惠券ID,创建订单表项 * <p>
* 2. 购物车清空 * 1. 创建订单表项和订单商品表项;
* 3. TODO 优惠券设置已用 * 2. 购物车清空;
* 4. 商品货品数量减少 * 3. TODO 优惠券设置已用;
* 4. 商品货品库存减少;
* 5. 如果是团购商品,则创建团购活动表项。
* *
* @param userId 用户ID * @param userId 用户ID
* @param body 订单信息,{ cartId:xxx, addressId: xxx, couponId: xxx } * @param body 订单信息,{ cartId:xxx, addressId: xxx, couponId: xxx, message: xxx, grouponRulesId: xxx, grouponLinkId: xxx}
* @return 订单操作结果 * @return 提交订单操作结果
* 成功则 { errno: 0, errmsg: '成功', data: { orderId: xxx } }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("submit") @PostMapping("submit")
public Object submit(@LoginUser Integer userId, @RequestBody String body) { public Object submit(@LoginUser Integer userId, @RequestBody String body) {
...@@ -455,15 +437,16 @@ public class WxOrderController { ...@@ -455,15 +437,16 @@ public class WxOrderController {
/** /**
* 取消订单 * 取消订单
* 1. 检测当前订单是否能够取消 * <p>
* 2. 设置订单取消状态 * 1. 检测当前订单是否能够取消;
* 3. 商品货品数量增加 * 2. 设置订单取消状态;
* 3. 商品货品库存恢复;
* 4. TODO 优惠券;
* 5. TODO 团购活动。
* *
* @param userId 用户ID * @param userId 用户ID
* @param body 订单信息,{ orderId:xxx } * @param body 订单信息,{ orderId:xxx }
* @return 订单操作结果 * @return 取消订单操作结果
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("cancel") @PostMapping("cancel")
public Object cancel(@LoginUser Integer userId, @RequestBody String body) { public Object cancel(@LoginUser Integer userId, @RequestBody String body) {
...@@ -531,9 +514,7 @@ public class WxOrderController { ...@@ -531,9 +514,7 @@ public class WxOrderController {
* *
* @param userId 用户ID * @param userId 用户ID
* @param body 订单信息,{ orderId:xxx } * @param body 订单信息,{ orderId:xxx }
* @return 订单操作结果 * @return 支付订单ID
* 成功则 { errno: 0, errmsg: '模拟付款支付成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("prepay") @PostMapping("prepay")
public Object prepay(@LoginUser Integer userId, @RequestBody String body, HttpServletRequest request) { public Object prepay(@LoginUser Integer userId, @RequestBody String body, HttpServletRequest request) {
...@@ -602,18 +583,17 @@ public class WxOrderController { ...@@ -602,18 +583,17 @@ public class WxOrderController {
} }
/** /**
* 付款成功回调接口 * 微信付款成功或失败回调接口
* 1. 检测当前订单是否是付款状态 * <p>
* 2. 设置订单付款成功状态相关信息 * 1. 检测当前订单是否是付款状态;
* 3. 响应微信支付平台 * 2. 设置订单付款成功状态相关信息;
* * 3. 响应微信支付平台.
* @param request
* @param response
* @return 订单操作结果
* 成功则 WxPayNotifyResponse.success的XML内容
* 失败则 WxPayNotifyResponse.fail的XML内容
* <p> * <p>
* 注意,这里pay-notify是示例地址,开发者应该设立一个隐蔽的回调地址 * 注意,这里pay-notify是示例地址,建议开发者应该设立一个隐蔽的回调地址
*
* @param request 请求内容
* @param response 响应内容
* @return 操作结果
*/ */
@PostMapping("pay-notify") @PostMapping("pay-notify")
public Object payNotify(HttpServletRequest request, HttpServletResponse response) { public Object payNotify(HttpServletRequest request, HttpServletResponse response) {
...@@ -718,14 +698,13 @@ public class WxOrderController { ...@@ -718,14 +698,13 @@ public class WxOrderController {
/** /**
* 订单申请退款 * 订单申请退款
* 1. 检测当前订单是否能够退款 * <p>
* 2. 设置订单申请退款状态 * 1. 检测当前订单是否能够退款;
* 2. 设置订单申请退款状态。
* *
* @param userId 用户ID * @param userId 用户ID
* @param body 订单信息,{ orderId:xxx } * @param body 订单信息,{ orderId:xxx }
* @return 订单操作结果 * @return 订单退款操作结果
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("refund") @PostMapping("refund")
public Object refund(@LoginUser Integer userId, @RequestBody String body) { public Object refund(@LoginUser Integer userId, @RequestBody String body) {
...@@ -765,14 +744,13 @@ public class WxOrderController { ...@@ -765,14 +744,13 @@ public class WxOrderController {
/** /**
* 确认收货 * 确认收货
* 1. 检测当前订单是否能够确认订单 * <p>
* 2. 设置订单确认状态 * 1. 检测当前订单是否能够确认收货;
* 2. 设置订单确认收货状态。
* *
* @param userId 用户ID * @param userId 用户ID
* @param body 订单信息,{ orderId:xxx } * @param body 订单信息,{ orderId:xxx }
* @return 订单操作结果 * @return 订单操作结果
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("confirm") @PostMapping("confirm")
public Object confirm(@LoginUser Integer userId, @RequestBody String body) { public Object confirm(@LoginUser Integer userId, @RequestBody String body) {
...@@ -810,14 +788,13 @@ public class WxOrderController { ...@@ -810,14 +788,13 @@ public class WxOrderController {
/** /**
* 删除订单 * 删除订单
* 1. 检测当前订单是否删除 * <p>
* 2. 设置订单删除状态 * 1. 检测当前订单是否可以删除;
* 2. 删除订单。
* *
* @param userId 用户ID * @param userId 用户ID
* @param body 订单信息,{ orderId:xxx } * @param body 订单信息,{ orderId:xxx }
* @return 订单操作结果 * @return 订单操作结果
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("delete") @PostMapping("delete")
public Object delete(@LoginUser Integer userId, @RequestBody String body) { public Object delete(@LoginUser Integer userId, @RequestBody String body) {
...@@ -850,14 +827,12 @@ public class WxOrderController { ...@@ -850,14 +827,12 @@ public class WxOrderController {
} }
/** /**
* 可以评价订单商品信息 * 评价订单商品信息
* *
* @param userId 用户ID * @param userId 用户ID
* @param orderId 订单ID * @param orderId 订单ID
* @param goodsId 商品ID * @param goodsId 商品ID
* @return 订单操作结果 * @return 待评价订单商品信息
* 成功则 { errno: 0, errmsg: '成功', data: xxx }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("goods") @GetMapping("goods")
public Object goods(@LoginUser Integer userId, public Object goods(@LoginUser Integer userId,
...@@ -882,13 +857,12 @@ public class WxOrderController { ...@@ -882,13 +857,12 @@ public class WxOrderController {
/** /**
* 评价订单商品 * 评价订单商品
* 确认商品收货后7天内可以评价 * <p>
* 确认商品收货或者系统自动确认商品收货后7天内可以评价,过期不能评价。
* *
* @param userId 用户ID * @param userId 用户ID
* @param body 订单信息,{ orderId:xxx } * @param body 订单信息,{ orderId:xxx }
* @return 订单操作结果 * @return 订单操作结果
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("comment") @PostMapping("comment")
public Object comment(@LoginUser Integer userId, @RequestBody String body) { public Object comment(@LoginUser Integer userId, @RequestBody String body) {
......
...@@ -14,6 +14,9 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -14,6 +14,9 @@ import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/**
* 区域服务
*/
@RestController @RestController
@RequestMapping("/wx/region") @RequestMapping("/wx/region")
@Validated @Validated
...@@ -31,13 +34,6 @@ public class WxRegionController { ...@@ -31,13 +34,6 @@ public class WxRegionController {
* *
* @param pid 父区域ID * @param pid 父区域ID
* @return 区域数据 * @return 区域数据
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("list") @GetMapping("list")
public Object list(@NotNull Integer pid) { public Object list(@NotNull Integer pid) {
......
...@@ -18,6 +18,11 @@ import java.util.HashMap; ...@@ -18,6 +18,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 商品搜索服务
* <p>
* 注意:目前搜索功能非常简单,只是基于关键字匹配。
*/
@RestController @RestController
@RequestMapping("/wx/search") @RequestMapping("/wx/search")
@Validated @Validated
...@@ -32,22 +37,11 @@ public class WxSearchController { ...@@ -32,22 +37,11 @@ public class WxSearchController {
/** /**
* 搜索页面信息 * 搜索页面信息
* <p> * <p>
* 如果用户已登录,则给出用户历史搜索记录。 * 如果用户已登录,则给出用户历史搜索记录;
* 如果没有登录,则给出空历史搜索记录。
* *
* @param userId 用户ID * @param userId 用户ID,可选
* @return 搜索页面信息 * @return 搜索页面信息
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* defaultKeyword: xxx,
* historyKeywordList: xxx,
* hotKeywordList: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("index") @GetMapping("index")
public Object index(@LoginUser Integer userId) { public Object index(@LoginUser Integer userId) {
...@@ -78,13 +72,6 @@ public class WxSearchController { ...@@ -78,13 +72,6 @@ public class WxSearchController {
* *
* @param keyword 关键字 * @param keyword 关键字
* @return 合适的关键字 * @return 合适的关键字
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("helper") @GetMapping("helper")
public Object helper(@NotEmpty String keyword, public Object helper(@NotEmpty String keyword,
...@@ -100,14 +87,10 @@ public class WxSearchController { ...@@ -100,14 +87,10 @@ public class WxSearchController {
} }
/** /**
* 关键字清理 * 清除用户搜索历史
* <p>
* 当用户输入关键字一部分时,可以推荐系统中合适的关键字。
* *
* @param userId 用户ID * @param userId 用户ID
* @return 清理是否成功 * @return 清理是否成功
* 成功则 { errno: 0, errmsg: '成功' }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@PostMapping("clearhistory") @PostMapping("clearhistory")
public Object clearhistory(@LoginUser Integer userId) { public Object clearhistory(@LoginUser Integer userId) {
......
...@@ -20,6 +20,9 @@ import java.io.IOException; ...@@ -20,6 +20,9 @@ import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* 对象存储服务
*/
@RestController @RestController
@RequestMapping("/wx/storage") @RequestMapping("/wx/storage")
@Validated @Validated
...@@ -57,6 +60,12 @@ public class WxStorageController { ...@@ -57,6 +60,12 @@ public class WxStorageController {
return ResponseUtil.ok(data); return ResponseUtil.ok(data);
} }
/**
* 访问存储对象
*
* @param key 存储对象key
* @return
*/
@GetMapping("/fetch/{key:.+}") @GetMapping("/fetch/{key:.+}")
public ResponseEntity<Resource> fetch(@PathVariable String key) { public ResponseEntity<Resource> fetch(@PathVariable String key) {
LitemallStorage litemallStorage = litemallStorageService.findByKey(key); LitemallStorage litemallStorage = litemallStorageService.findByKey(key);
...@@ -76,6 +85,12 @@ public class WxStorageController { ...@@ -76,6 +85,12 @@ public class WxStorageController {
return ResponseEntity.ok().contentType(mediaType).body(file); return ResponseEntity.ok().contentType(mediaType).body(file);
} }
/**
* 访问存储对象
*
* @param key 存储对象key
* @return
*/
@GetMapping("/download/{key:.+}") @GetMapping("/download/{key:.+}")
public ResponseEntity<Resource> download(@PathVariable String key) { public ResponseEntity<Resource> download(@PathVariable String key) {
LitemallStorage litemallStorage = litemallStorageService.findByKey(key); LitemallStorage litemallStorage = litemallStorageService.findByKey(key);
......
...@@ -22,6 +22,9 @@ import java.util.HashMap; ...@@ -22,6 +22,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 专题服务
*/
@RestController @RestController
@RequestMapping("/wx/topic") @RequestMapping("/wx/topic")
@Validated @Validated
...@@ -39,17 +42,6 @@ public class WxTopicController { ...@@ -39,17 +42,6 @@ public class WxTopicController {
* @param page 分页页数 * @param page 分页页数
* @param size 分页大小 * @param size 分页大小
* @return 专题列表 * @return 专题列表
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data:
* {
* data: xxx,
* count: xxx
* }
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("list") @GetMapping("list")
public Object list(@RequestParam(defaultValue = "1") Integer page, public Object list(@RequestParam(defaultValue = "1") Integer page,
...@@ -69,13 +61,6 @@ public class WxTopicController { ...@@ -69,13 +61,6 @@ public class WxTopicController {
* *
* @param id 专题ID * @param id 专题ID
* @return 专题详情 * @return 专题详情
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("detail") @GetMapping("detail")
public Object detail(@NotNull Integer id) { public Object detail(@NotNull Integer id) {
...@@ -97,13 +82,6 @@ public class WxTopicController { ...@@ -97,13 +82,6 @@ public class WxTopicController {
* *
* @param id 专题ID * @param id 专题ID
* @return 相关专题 * @return 相关专题
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("related") @GetMapping("related")
public Object related(@NotNull Integer id) { public Object related(@NotNull Integer id) {
......
...@@ -14,6 +14,9 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -14,6 +14,9 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* 用户服务
*/
@RestController @RestController
@RequestMapping("/wx/user") @RequestMapping("/wx/user")
@Validated @Validated
...@@ -24,17 +27,12 @@ public class WxUserController { ...@@ -24,17 +27,12 @@ public class WxUserController {
private LitemallOrderService orderService; private LitemallOrderService orderService;
/** /**
* 用户信息 * 用户个人页面数据
* <p>
* 目前是用户订单统计信息
* *
* @param userId 用户ID * @param userId 用户ID
* @return 用户信息 * @return 用户个人页面数据
* 成功则
* {
* errno: 0,
* errmsg: '成功',
* data: xxx
* }
* 失败则 { errno: XXX, errmsg: XXX }
*/ */
@GetMapping("index") @GetMapping("index")
public Object list(@LoginUser Integer userId) { public Object list(@LoginUser Integer userId) {
......
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