MiniProgramController.java
1.73 KB
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
44
45
46
package com.infoloop.tianting.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.infoloop.tianting.model.dto.WxUserDto.WxUserOpenIdDto;
import com.infoloop.tianting.model.dto.WxUserDto.WxUserPhoneResponseDto;
import com.infoloop.tianting.service.WxMiniProgramService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "小程序个人信息")
@ApiSupport(order = -1)
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class MiniProgramController {
private final WxMiniProgramService wxMiniProgramService;
@SaIgnore
@ApiOperation(value = "小程序:根据code获取openId")
@GetMapping("/wx/miniprogram/customers/openid/{code}")
@ResponseStatus(HttpStatus.OK)
public WxUserOpenIdDto getOpenIdByCode(@PathVariable String code) {
return wxMiniProgramService.getWxUserOpenIdByCode(code);
}
@SaIgnore
@ApiOperation(value = "小程序:根据code获取手机号")
@GetMapping("/wx/miniprogram/customers/phone/{code}")
@ResponseStatus(HttpStatus.OK)
public WxUserPhoneResponseDto getPhoneByCode(@PathVariable String code) {
return wxMiniProgramService.getUserPhoneInfoByCode(code);
}
}