GarbageUserController.java
1.36 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
47
48
49
50
51
52
53
package com.trash.garbage.controller;
import com.aliyuncs.exceptions.ClientException;
import com.trash.garbage.global.Result;
import com.trash.garbage.pojo.vo.LoginVo;
import com.trash.garbage.service.GarUserService;
import com.trash.garbage.utils.SMSUtils;
import com.trash.garbage.utils.ValidateCodeUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Random;
/**
* @author 20412
*/
@RestController
@RequestMapping("user")
@Api(tags = "建筑垃圾-用户接口")
public class GarbageUserController {
@Autowired
private GarUserService garUserService;
/**
* 用户登录
*
* @param user
* @return
*/
@ApiOperation("用户接口-用户登录")
@PostMapping("/login")
public Result<String> login(@RequestBody LoginVo user) {
return Result.OK(garUserService.login(user));
}
@ApiOperation("用户接口-发送验证码")
@GetMapping("/send/verify")
public Result<?> sendVerify(@RequestParam("tel") String tel) {
try {
garUserService.sendVerify(tel);
return Result.OK();
} catch (Exception e) {
e.printStackTrace();
return Result.ERROR();
}
}
}