feiyu02
2024-11-19 752e00503f672ddfe2066afb6c235721a3a912b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package cn.flightfeather.supervision.lightshare.web
 
import cn.flightfeather.supervision.lightshare.service.WxUserService
import cn.flightfeather.supervision.lightshare.vo.AccessTokenPW
import cn.flightfeather.supervision.lightshare.vo.AccessTokenWX
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
 
@Api(tags = ["微信用户信息API接口"])
@RestController
@RequestMapping("/wxuser")
class WxUserController(val wxUserService: WxUserService) {
 
    @ApiOperation(value = "登录")
    @PostMapping("/loginWx")
    fun loginWx(
        @ApiParam("登录信息") @RequestBody accessTokenWX: AccessTokenWX
    ) = wxUserService.loginWx(accessTokenWX)
 
 
    @ApiOperation(value = "登录")
    @PostMapping("/loginPW")
    fun loginPW(
            @ApiParam("登录信息") @RequestBody accessTokenPW: AccessTokenPW
    ) = wxUserService.loginPw(accessTokenPW)
 
    @ApiOperation(value = "微信接入验证")
    @GetMapping("/message/subscribe/result")
    fun subscribeCheck(
        @ApiParam("微信加密签名") @RequestParam signature: String,
        @ApiParam("时间戳") @RequestParam timestamp: String,
        @ApiParam("随机数") @RequestParam nonce: String,
        @ApiParam("随机字符串") @RequestParam echostr: String,
    ) = wxUserService.subscribeCheck(signature, timestamp, nonce, echostr)
 
    @ApiOperation(value = "微信用户订阅消息结果推送", notes = "微信会将用户订阅消息、消息推送情况等信息通过此接口发送过来")
    @PostMapping("/message/subscribe/result")
    fun subscribeResult(
        @ApiParam("消息") @RequestBody msg: String
    ) = wxUserService.subscribeResult(msg)
}