k94314517
2024-07-15 83430e4bd60f9a44ec76698fa04ee8d3373a1087
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.doumee.api.web;
 
import com.doumee.config.annotation.UserLoginRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
import com.doumee.dao.business.model.SmsEmail;
import com.doumee.dao.web.response.AccountResponse;
import com.doumee.service.business.MemberService;
import com.doumee.service.business.SmsEmailService;
import com.doumee.service.business.UsersService;
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.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2024/7/10 18:06
 */
@Api(tags = "员工端小程序用户业务")
@Trace(exclude = true)
@RestController
@RequestMapping("/web/personnel")
@Slf4j
public class PersonnelApi extends ApiController{
 
    @Autowired
    public UsersService usersService;
 
    @Autowired
    public SmsEmailService smsEmailService;
 
 
    @ApiOperation(value = "小程序登陆", notes = "员工端小程序")
    @GetMapping("/loginByWx")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "微信code", required = true),
    })
    public ApiResponse<AccountResponse> loginByWx(@RequestParam String code) {
        return  ApiResponse.success(usersService.wxLogin(code));
    }
 
 
    @ApiOperation(value = "发送短信验证码", notes = "员工端小程序")
    @GetMapping("/sendSms")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "phone", value = "手机号", required = true),
    })
    public ApiResponse sendSms(@RequestParam String phone) {
        SmsEmail smsEmail = new SmsEmail();
        smsEmail.setPhone(phone);
        smsEmailService.sendSms(smsEmail);
        return  ApiResponse.success("发送成功");
    }
 
 
 
    @ApiOperation(value = "手机号验证码登陆", notes = "员工端小程序")
    @GetMapping("/loginByPhone")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "phone", value = "手机号", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "短信验证码", required = true),
    })
    public ApiResponse<AccountResponse> loginByPhone(@RequestParam String phone,@RequestParam String code) {
        return  ApiResponse.success(usersService.phoneLogin(phone,code));
    }
 
 
    @UserLoginRequired
    @ApiOperation(value = "绑定openid", notes = "员工端小程序")
    @GetMapping("/bindingOpenid")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "微信code", required = true),
    })
    public ApiResponse bindingOpenid(@RequestParam String code) {
        usersService.bindingOpenid(code,getMemberId());
        return  ApiResponse.success("操作成功");
    }
 
}