package com.stylefeng.guns.modular.api; import com.stylefeng.guns.modular.system.service.IFeedbackService; import com.stylefeng.guns.modular.system.service.IUserInfoService; import com.stylefeng.guns.modular.system.util.ResultUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; /** * 反馈控制器 */ @Api @RestController @RequestMapping("/api/feedback") public class FeedbackController { @Autowired private IFeedbackService feedbackService; @Autowired private IUserInfoService userInfoService; /** * 提交反馈意见 * @param content * @param request * @return */ @ResponseBody @PostMapping("/feedback") @ApiOperation(value = "提交反馈意见", tags = {"用户端-个人中心"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "反馈内容", name = "content", required = true, dataType = "string"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil feedback(String content, HttpServletRequest request){ try { Integer uid = userInfoService.getUserIdFormRedis(request); if(uid == null){ return ResultUtil.tokenErr(); } return feedbackService.feedback(content, uid); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } }