package com.bonus.sharedstation.auth.controller;

import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.sharedstation.auth.entity.AuthAppLoginMobileReq;
import com.bonus.sharedstation.auth.entity.GreenUserInfoDo;
import com.bonus.sharedstation.auth.service.GreenUserService;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
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.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 登录相关
 *
 * @author zhangzheng
 */
@Tag(name = "App - 权限数据")
@RestController
@RequestMapping("/system/app")
@Validated
@Slf4j
public class AppAuthController {
    @Resource
    private GreenUserService greenUserService;

    @PostMapping("/getUserInfoByMobile")
    @ApiOperation("获得用户信息")
    public AjaxResult getUserInfoByMobile(@RequestBody @Valid AuthAppLoginMobileReq reqVO) {
        GreenUserInfoDo userInfoDo = greenUserService.getUserByMobile(reqVO.getMobile());
        return AjaxResult.success(userInfoDo);
    }
}
