package com.hhsx.minigame.controller; import com.hhsx.minigame.entity.vo.NewsVO; import com.hhsx.minigame.service.NewsService; import com.hhsx.minigame.utils.HttpRespMsg; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.io.IOException; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; /** * @author 吴涛涛 * @since 2019-09-17 */ @Controller @RequestMapping("/news") public class NewsController { @Autowired NewsService newsService; @Value("${callbackURL}") private String callbackURL; /** * 添加分享信息 * * 传递的参数: * type: 0 -微信 1 -微博 * type=0时,所需其他参数: message:寄语 openid:用户openid * * type=1时,所需其他参数:message:寄语 uid:微博身份唯一凭证 * @return */ @ApiOperation(value = "添加分享信息", notes = "添加分享信息方法") @RequestMapping("/addNews") @ResponseBody public HttpRespMsg addUserNews(NewsVO newsVO){ HttpRespMsg msg = newsService.addUserNews(newsVO); return msg; } /** * 微博授权登录 * * 传递的参数: * type: 0 -微信 1 -微博 * type=0时,所需其他参数: message:寄语 openid:用户openid * * type=1时,所需其他参数:message:寄语 uid:微博身份唯一凭证 * @return */ @ApiOperation(value = "微博授权登录", notes = "微博授权登录方法") @RequestMapping("/microblogLogin") @ResponseBody public HttpRespMsg microblogLogin(NewsVO newsVO) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException { HttpRespMsg msg = newsService.login(newsVO,callbackURL); return msg; } }