package com.starry.admin.modules.system.controller;

import com.starry.admin.modules.platform.entity.SysTenantEntity;
import com.starry.admin.modules.platform.service.ISysTenantService;
import com.starry.admin.utils.SmsUtils;
import com.starry.common.result.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 动态接口
 *
 * @author admin
 * @since 2024/5/20 下午11:19
 **/
@Slf4j
@RestController
@RequestMapping("/system/sms")
public class SysSmsController {
    @Resource
    private SmsUtils smsUtils;
    @Resource
    private ISysTenantService tenantService;

    @GetMapping("/send")
    public R sendSms(@RequestParam("phone") String phone) {
        smsUtils.sendSmsApi(phone);
        return R.ok();
    }

    @GetMapping("/test")
    public R test() {
        SysTenantEntity sysTenantEntity = tenantService.selectSysTenantByTenantId("y5PNjqco");
        tenantService.initRole(sysTenantEntity);
        return R.ok(true);
    }


}
