package com.moral.api.controller;
|
|
|
import cn.hutool.core.util.StrUtil;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.Map;
|
|
import com.moral.api.service.UserService;
|
import com.moral.constant.ResponseCodeEnum;
|
import com.moral.constant.ResultMessage;
|
|
@Slf4j
|
@Api(tags = {"小程序用户管理"})
|
@RestController
|
@RequestMapping("/UserSmallRoutine")
|
public class UserSmallRoutineController {
|
|
@Autowired
|
private UserService userService;
|
|
@ApiOperation(value = "登陆信息", notes = "登陆信息")
|
@PostMapping("login")
|
public ResultMessage login(@RequestBody Map<String, Object> parameters) {
|
if (!(parameters.containsKey("account") && parameters.containsKey("password"))) {
|
return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
|
ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
|
}
|
Map<String, Object> result = userService.loginSmallRoutine(parameters);
|
if (!result.containsKey("token")) {
|
return ResultMessage.fail((int) result.get("code"), (String) result.get("msg"));
|
}
|
return ResultMessage.ok(result);
|
}
|
|
|
}
|