1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| import javax.ws.rs.*; import javax.ws.rs.core.MediaType;
/** */ @Path("/v1/mini_app") public class MiniAppResource {
@Autowired MiniAppService miniAppService;
@Path("add.json") @POST @Produces(MediaType.APPLICATION_JSON) @BaseInfo( idx = 1, desc = "往小程序购物车中添加一种商品", protocol = BaseInfo.Protocol.HTTPS, authPolicy = BaseInfo.AuthPolicy.PUBLIC, apiStatus = BaseInfo.ApiStatus.PUBLIC ) public ApiCartProduct add( @FormParam("sub_product_id") long subProductId, @FormParam("count") int count, @FormParam("device_token") String deviceToken, @HeaderParam("from_user_id") Long fromUserId ) { return miniAppService.add(subProductId, count, fromUserId, deviceToken); }
@Path("delete.json") @POST @Produces(MediaType.APPLICATION_JSON) @BaseInfo( idx = 2, desc = "批量删除购物车中商品", protocol = BaseInfo.Protocol.HTTPS, authPolicy = BaseInfo.AuthPolicy.PUBLIC, apiStatus = BaseInfo.ApiStatus.PUBLIC, resultDemo = CommonResult.class) public CommonResult delete( @FormParam("sub_product_id") String subProductIdStr, @FormParam("device_token") String deviceToken, @HeaderParam("from_user_id") Long fromUserId ) { return CommonResult.booleanCommonResult( miniAppService.remove(fromUserId, deviceToken, subProductIdStr)); }
@Path("update.json") @POST @Produces(MediaType.APPLICATION_JSON) @BaseInfo( idx = 3, desc = "更新购物车", protocol = BaseInfo.Protocol.HTTPS, authPolicy = BaseInfo.AuthPolicy.PUBLIC, apiStatus = BaseInfo.ApiStatus.PUBLIC, resultDemo = CommonResult.class) public CommonResult update( @FormParam("meta") String metaStr, @FormParam("device_token") String deviceToken, @HeaderParam("from_user_id") Long fromUserId ) { return CommonResult.booleanCommonResult( miniAppService.update(fromUserId, deviceToken, metaStr)); }
}
|