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

import com.starry.admin.utils.SmsUtils;
import com.starry.common.result.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import javax.annotation.Resource;
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;

/**
 * 动态接口
 *
 * @author admin
 * @since 2024/5/20 下午11:19
 **/
@Api(tags = "微信短信接口", description = "微信端短信发送相关接口")
@Slf4j
@RestController
@RequestMapping("/wx/sms")
public class WxSmsController {
    @Resource
    private SmsUtils smsUtils;

    @ApiOperation(value = "发送短信", notes = "向指定手机号发送短信验证码")
    @ApiImplicitParam(name = "phone", value = "手机号码", required = true, dataType = "String", paramType = "query")
    @ApiResponses({@ApiResponse(code = 200, message = "操作成功")})
    @GetMapping("/send")
    public R sendSms(@RequestParam("phone") String phone) {
        smsUtils.sendSmsApi(phone);
        return R.ok();
    }

}
