package com.matrix.system.shopXcx.api.action; import com.matrix.core.pojo.AjaxResult; import com.matrix.system.hive.bean.SysVipInfo; import com.matrix.system.common.init.UserCacheManager; import com.matrix.system.shopXcx.dao.ShopSearchRecordDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.*; /** * @description 搜索记录 * @author pengliang * @date 2019-06-14 15:00 */ @Controller @RequestMapping(value="/wxapi/shopUserSearchRecord") @CrossOrigin(origins = "*", maxAge = 3600) public class WxUserSearchRecord { @Autowired private ShopSearchRecordDao shopSearchRecordDao; @Autowired private UserCacheManager userCacheManager; /** * 查询搜索记录 * @return */ @RequestMapping(value = "/getSearchRecordList") @ResponseBody public AjaxResult getSearchRecordList(){ SysVipInfo bigUser = userCacheManager.getLoginUser(); if(bigUser == null){ return new AjaxResult(AjaxResult.STATUS_FAIL,"用户未授权"); } List list = shopSearchRecordDao.selectByUserId(bigUser.getOpenId()); return new AjaxResult(AjaxResult.STATUS_SUCCESS,list); } /** * 删除搜索记录 * @return */ @RequestMapping(value = "/deleteSearchRecord") @ResponseBody public AjaxResult deleteSearchRecord(){ SysVipInfo bigUser = userCacheManager.getLoginUser(); shopSearchRecordDao.deleteByUserId(bigUser.getOpenId()); return new AjaxResult(AjaxResult.STATUS_SUCCESS,"删除成功"); } }