package com.template.controller;


import com.template.annotation.PassToken;
import com.template.api.SmsCodeControllerAPI;
import com.template.model.pojo.SmsCode;
import com.template.model.result.CommonResult;
import com.template.services.SmsCodeService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ceshi
 * @since 2023-04-20
 */
@RestController
public class SmsCodeController implements SmsCodeControllerAPI {

    @Autowired
    private SmsCodeService smsCodeService;

    @Override
    @PassToken
    public CommonResult InsertSmsCode() {
        SmsCode smsCode = new SmsCode();
        smsCode.setPhoneNumber("123456789");
        smsCode.setCode("123456");
        long time = new Date().getTime() + 60000L;
        smsCode.setExpirationTime(new Date(time));
        smsCode.setIsVerify("0");
        smsCodeService.save(smsCode);
        return null;
    }
}

