| package com.matrix.system.shopXcx.api.action; | 
|   | 
| import com.matrix.core.pojo.AjaxResult; | 
| import com.matrix.biz.bean.BizUser; | 
|   | 
| import com.matrix.component.redis.RedisUserLoginUtils; | 
| 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 RedisUserLoginUtils redisUserLoginUtils; | 
|   | 
|     /** | 
|      * 查询搜索记录 | 
|      * @return | 
|      */ | 
|     @RequestMapping(value = "/getSearchRecordList") | 
|     @ResponseBody | 
|     public AjaxResult getSearchRecordList(){ | 
|         BizUser bigUser = redisUserLoginUtils.getLoginUser(BizUser.class); | 
|         if(bigUser == null){ | 
|             return new AjaxResult(AjaxResult.STATUS_FAIL,"用户未授权"); | 
|         } | 
|         List<String> list = shopSearchRecordDao.selectByUserId(bigUser.getOpenId()); | 
|         return new AjaxResult(AjaxResult.STATUS_SUCCESS,list); | 
|     } | 
|   | 
|     /** | 
|      * 删除搜索记录 | 
|      * @return | 
|      */ | 
|     @RequestMapping(value = "/deleteSearchRecord") | 
|     @ResponseBody | 
|     public AjaxResult deleteSearchRecord(){ | 
|         BizUser bigUser = redisUserLoginUtils.getLoginUser(BizUser.class); | 
|         shopSearchRecordDao.deleteByUserId(bigUser.getOpenId()); | 
|         return new AjaxResult(AjaxResult.STATUS_SUCCESS,"删除成功"); | 
|     } | 
|   | 
| } |