java
2023-06-27 0d17b6a250e455af9abd0b61b6de0004a296e98d
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package com.dsh.account.controller;
 
import com.dsh.account.model.AddAppUserVo;
import com.dsh.account.model.LoginSMSCodeVo;
import com.dsh.account.model.LoginWeChatVo;
import com.dsh.account.service.TAppUserService;
import com.dsh.account.util.ResultUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
/**
 * @author zhibing.pu
 * @date 2023/6/14 15:30
 */
@RestController
@RequestMapping("")
public class AppUserController {
 
    @Autowired
    private TAppUserService appUserService;
 
 
 
 
    @ResponseBody
    @PostMapping("/base/appUser/getSMSCode")
    @ApiOperation(value = "获取短信验证码", tags = {"APP-登录注册"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "类型(1:登录,2:注册,3:修改密码,4:忘记密码)", name = "type", dataType = "int", required = true),
            @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true)
    })
    public ResultUtil getSMSCode(@RequestBody Integer type, @RequestBody String phone){
        try {
            ResultUtil smsCode = appUserService.getSMSCode(type, phone);
            return smsCode;
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    @ResponseBody
    @PostMapping("/base/appUser/addAppUser")
    @ApiOperation(value = "注册用户", tags = {"APP-登录注册"})
    @ApiImplicitParams({
    })
    public ResultUtil addAppUser(@RequestBody AddAppUserVo addAppUserVo){
        try {
            return appUserService.addAppUser(addAppUserVo);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    @ResponseBody
    @PostMapping("/base/appUser/loginPassword")
    @ApiOperation(value = "账号密码登录", tags = {"APP-登录注册"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true),
            @ApiImplicitParam(value = "登录密码", name = "password", dataType = "string", required = true)
    })
    public ResultUtil<String> loginPassword(@RequestBody String phone, @RequestBody String password){
        try {
            return appUserService.loginPassword(phone, password);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
 
    @ResponseBody
    @PostMapping("/base/appUser/loginSMSCode")
    @ApiOperation(value = "短信验证码登录", tags = {"APP-登录注册"})
    @ApiImplicitParams({
    })
    public ResultUtil<String> loginSMSCode(@RequestBody LoginSMSCodeVo loginSMSCodeVo){
        try {
            return appUserService.loginSMSCode(loginSMSCodeVo);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    @ResponseBody
    @PostMapping("/base/appUser/loginWeChat")
    @ApiOperation(value = "微信登录", tags = {"APP-登录注册"})
    @ApiImplicitParams({
    })
    public ResultUtil<String> loginWeChat(@RequestBody LoginWeChatVo loginWeChatVo){
        try {
            return appUserService.loginWechat(loginWeChatVo);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
 
    @ResponseBody
    @PostMapping("/base/appUser/updatePassword")
    @ApiOperation(value = "修改密码", tags = {"APP-登录注册"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true),
            @ApiImplicitParam(value = "短信验证码", name = "code", dataType = "string", required = true),
            @ApiImplicitParam(value = "新密码", name = "password", dataType = "string", required = true)
    })
    public ResultUtil updatePassword(@RequestBody String phone, @RequestBody String code, @RequestBody String password){
        try {
            return appUserService.updatePassword(phone, code, password);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
    @ResponseBody
    @PostMapping("/base/appUser/forgetPassword")
    @ApiOperation(value = "忘记密码", tags = {"APP-登录注册"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true),
            @ApiImplicitParam(value = "短信验证码", name = "code", dataType = "string", required = true),
            @ApiImplicitParam(value = "新密码", name = "password", dataType = "string", required = true)
    })
    public ResultUtil forgetPassword(@RequestBody String phone, @RequestBody String code, @RequestBody String password){
        try {
            return appUserService.updatePassword(phone, code, password);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
 
 
}