You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.4 KiB
41 lines
1.4 KiB
package hl.controller; |
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
import hl.config.WxConfig; |
|
import hl.forest.clients.MiniWeChatClients; |
|
import hl.service.WxService; |
|
import org.springframework.beans.factory.annotation.Autowired; |
|
import org.springframework.web.bind.annotation.PathVariable; |
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
@RestController |
|
@RequestMapping("/wx") |
|
public class WxController { |
|
|
|
@Autowired |
|
private MiniWeChatClients weChatClients; |
|
|
|
@Autowired |
|
private WxService wxService; |
|
|
|
@Autowired |
|
private WxConfig wxConfig; |
|
|
|
|
|
@RequestMapping("/getAuth/{id}") |
|
public AjaxResult open(@PathVariable String id) { |
|
return AjaxResult.success(String.format(wxConfig.getAuthUrl(), wxConfig.getPublicAppid(), wxConfig.getRedirectUrl(), id)); |
|
} |
|
|
|
/*@RequestMapping("/code2videourl/{code}/{id}") |
|
public AjaxResult code2videourl(@PathVariable String id,@PathVariable String code){ |
|
String openid="a"; |
|
WxPublicCode2UserInfoRes wxPublicCode2UserInfoRes=weChatClients.code2userinfo(wxConfig.getPublicAppid(),wxConfig.getPublicSecret(),code); |
|
if (wxPublicCode2UserInfoRes.getErrcode()!=0){ |
|
return AjaxResult.error("获取openid错误"); |
|
} |
|
openid=wxPublicCode2UserInfoRes.getOpenid(); |
|
return wxService.getOwnVideo(id,openid); |
|
}*/ |
|
}
|
|
|