1. 需求分析
收藏店铺,或者关注店铺,或者是其他app当中的follow
收藏的动作可以获得积分,礼券,小样,正品等
收藏可以是被取消的,但是未必自己就能捕获的到,比如微信中,会员对于公众号的取关操作;淘宝中,会员取消关注店铺等
会员取消收藏之后,再次收藏,不再给与奖励,收藏的时间,进行更新
2.表结构设计
会员表,积分表,是以前就有的,本次新增收藏店铺功能,需要新增一下的表:
首先要有记录用户收藏,暂且定义为HCollection表或者HFollow
3. 后台代码实现
Controller
@RestController @RequestMapping(value = "collect") public class CollectController extends BaseController { @Autowired CollectService collectService; @Autowired SocialProviderService socialProviderService; @ApiOperation(value = "收藏历史记录", notes = "收藏历史记录") @GetMapping(value = "history", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}) private ResponseBean collectHis(@RequestParam("userId") String userId, @RequestParam("social") String social) { ResponseBean responseBean = new ResponseBean(); HTmallCollectRecord tmallCollectRecord = collectService.collectedTmallHis(userId, social); responseBean.setData(tmallCollectRecord); return responseBean; } @ApiOperation(value = "收藏店铺", notes = "收藏店铺") @GetMapping(value = "DoCollect", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}) private ResponseBean DoCollect(@RequestParam("userId") String userId, @RequestParam("social") String social) { ResponseBean responseBean = new ResponseBean(); collectService.collectTmall(userId, social); return responseBean; } }
收藏的接口
public interface CollectService { HTmallCollectRecord collectedTmallHis(String userId, String social); void collectTmall(String userId,String social); }
收藏的具体实现
太简单了,不写了