收藏功能實現

1. 需求分析java

收藏店鋪,或者關注店鋪,或者是其餘app當中的follow微信

收藏的動做能夠得到積分,禮券,小樣,正品等app

收藏能夠是被取消的,可是未必本身就能捕獲的到,好比微信中,會員對於公衆號的取關操做;淘寶中,會員取消關注店鋪等ide

會員取消收藏以後,再次收藏,再也不給與獎勵,收藏的時間,進行更新設計

 

2.表結構設計code

會員表,積分表,是之前就有的,本次新增收藏店鋪功能,須要新增一下的表:blog

首先要有記錄用戶收藏,暫且定義爲HCollection表或者HFollow接口

 

3. 後臺代碼實現ci

Controllerio

@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);
}

 

收藏的具體實現 

太簡單了,不寫了

相關文章
相關標籤/搜索