doum
2025-09-15 82735e4d46ac7b9969facef2acc8f8e793b68f71
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.doumee.api.web;
 
import com.doumee.config.jwt.JwtTokenUtil;
import com.doumee.core.annotation.LoginRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.dto.WxPhoneRequest;
import com.doumee.dao.vo.AccountResponse;
import com.doumee.service.business.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2025/7/10 9:29
 */
@Api(tags = "1、登录业务")
@Trace(exclude = true)
@RestController
@RequestMapping("/web/account")
@Slf4j
public class AccountApi extends  ApiController{
 
 
    @Autowired
    private MemberService memberService;
 
 
    @Trace
    @ApiOperation(value = "微信授权", notes = "小程序端")
    @GetMapping("/wxLogin")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "微信code", required = true)
    })
    public ApiResponse<AccountResponse> wxLogin(@RequestParam String code) {
        return  ApiResponse.success("操作成功",memberService.wxLogin(code));
    }
 
 
    @ApiOperation(value = "授权手机号", notes = "小程序端")
    @PostMapping("/wxAuthPhone")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "微信code", required = true)
    })
    public ApiResponse<AccountResponse> wxAuthPhone(@RequestBody WxPhoneRequest wxPhoneRequest) {
        return  ApiResponse.success("操作成功",memberService.wxAuthPhone(wxPhoneRequest));
    }
 
    @LoginRequired
    @ApiOperation(value = "退出登录", notes = "小程序端")
    @GetMapping("/logOff")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
    })
    public ApiResponse logOff() {
        String token = this.getRequest().getHeader(JwtTokenUtil.HEADER_KEY);
        memberService.logOff(token,getMemberId());
        return  ApiResponse.success("操作成功");
    }
 
}