package com.ruoyi.web.app;

import com.ruoyi.bst.realName.domain.RealName;
import com.ruoyi.bst.realName.service.RealNameService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/app/realName")
public class AppRealNameController extends BaseController {

    @Autowired
    private RealNameService realNameService;

    @ApiOperation("用户实名认证")
    @PutMapping("/realName")
    public AjaxResult realName(@RequestBody @Validated RealName realName){
        realName.setUserId(getUserId());
        return success(realNameService.realName(realName));
    }

    @ApiOperation("刷新用户实名认证结果")
    @GetMapping("/refreshRealName")
    public AjaxResult refreshRealName() {
        return AjaxResult.success("操作成功", realNameService.refreshRealName(getUserId()));
    }

}
