3
13693261870
2022-09-16 63ba114e70e380442fcbed4a5157ee52c9491216
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
//package com.landtool.lanbase.modules.api.controller;
//
//import org.apache.shiro.crypto.hash.Sha256Hash;
//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.RestController;
//import org.springframework.web.servlet.ModelAndView;
//
//import com.landtool.lanbase.common.utils.CoderUtils;
//import com.landtool.lanbase.common.utils.Result;
//import com.landtool.lanbase.modules.api.annotation.Login;
//import com.landtool.lanbase.modules.api.utils.JwtUtils;
//import com.landtool.lanbase.modules.org.entity.OrgUser;
//import com.landtool.lanbase.modules.org.service.OrgUserService;
//
//import springfox.documentation.annotations.ApiIgnore;
//
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * @author lanbase
// * @Description: TODO()
// * @date 2017-9-27 14:49
// */
//@RestController
//@RequestMapping("/api")
//@ApiIgnore()
//public class TestController {
//
//    @Autowired
//    private JwtUtils jwtUtils;
//
//    @Autowired
//    private OrgUserService orgUserService;
//
//    @GetMapping("/login")
//    public Result login(String username, String password){
//        //用户信息
//        OrgUser user = orgUserService.queryByUserName(username);
//
//        //账号不存在
//        if(user == null) {
//            return Result.error("账号不存在");
//        }
//
//        //密码错误
////        if(!user.getPassword().equals(new Sha256Hash(password, user.getSalt()).toHex())) {
////            return Result.error("密码不正确");
////        }
//        try {
//            if(!user.getPassword().equals(CoderUtils.lantuEncryptMD5(password))) {
//                return Result.error("密码不正确");
//            }
//        } catch (Exception e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//        }
//
//        //生成token
//        String token = jwtUtils.generateToken(user.getUserid());
//
//        Map<String, Object> map = new HashMap<>();
//        map.put("userId", user.getUserid());
//        map.put("token", token);
//        map.put("expire", jwtUtils.getExpire());
//
//        Result r=Result.ok().put(map);
//        return r;
//    }
//
//    @Login
//    @GetMapping("/test")
//    public Result test(){
//        return Result.ok();
//    }
//
//}