package com.om.controller.user;


import com.om.entity.dto.AppBaseDTO;
import com.om.entity.dto.AppUserUpdatePwdDTO;
import com.om.entity.dto.UserLoginDTO;
import com.om.service.IAdminService;
import com.om.service.IUserService;
import com.om.utils.AdminContext;
import com.om.utils.Result;
import com.om.utils.UserContext;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 应用用户信息表 前端控制器
 * </p>
 *
 * @author bmmx
 * @since 2024-01-29
 */
@RestController
@Api(tags = "客户端用户模块")
@RequestMapping("/app/user")
public class UserController {
    @Resource
    private IUserService userService;


    @PostMapping("/login")
    @ApiOperation("客户端用户登录")
    public Result login(@RequestBody UserLoginDTO dto){
        return userService.login(dto);
    }

    @PostMapping("/update/password")
    @ApiOperation("修改密码")
    public Result password(@RequestBody AppUserUpdatePwdDTO dto){

        return userService.password(dto);
    }

    @PostMapping("/register")
    @ApiOperation("用户注册")
    public Result register(@RequestBody UserLoginDTO userLoginDTO){

        return userService.register(userLoginDTO);
    }

    @PostMapping("/update/username")
    @ApiOperation("修改用户名")
    public Result update(@RequestBody AppBaseDTO dto){

        return userService.updateUserName(dto);

    }
    @GetMapping("/logout")
    @ApiOperation("退出登录")
    public Result logout(){
        //清楚redis数据
        return userService.logout();
    }

    @PostMapping("update/vci")
    @ApiOperation("修改默认vci")
    public Result updateVci(@RequestBody AppBaseDTO dto){

        return userService.updateVci(dto);
    }









}
