package org.dromara.mp.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.log.enums.OperatorType;
import org.dromara.common.web.core.BaseController;
import org.dromara.mp.domain.vo.SysUnitDomainVo;
import org.dromara.mp.service.ISysUnitDomainService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 单位域名配置
 * 前端访问路由地址为:/mp/unitDomain
 *
 * @author LionLi
 * @date 2024-04-07
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/unitDomain")
public class SysUnitDomainController extends BaseController {

    private final ISysUnitDomainService sysUnitDomainService;

    /**
     * 查询单位域名配置列表
     */
    @GetMapping("/selSiteInfo")
    @SaIgnore
    @Log(title = "查询单位域名配置列表", businessType = BusinessType.SELECT,operatorType= OperatorType.MOBILE)
    public R<SysUnitDomainVo> list(String mpDomain) {
        return R.ok(sysUnitDomainService.queryByMpDomain(mpDomain));
    }



    @GetMapping("/sendSms")
    @SaIgnore
    @Log(title = "发送短信验证码", businessType = BusinessType.SELECT,operatorType= OperatorType.MOBILE)
    public R<Boolean> sendSms(String phone,String domainCode){
        return R.ok(this.sysUnitDomainService.sendSms(phone,domainCode));
    }



}
