You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
502 B

3 years ago
package copartner
import (
"errors"
"git.oa00.com/go/mysql"
"recook/internal/v2/model"
"time"
)
var CopartnerLogic = &copartnerLogic{}
type copartnerLogic struct {
}
// Very @Title 验证邀请码
func (*copartnerLogic) Very(inviteNo string) error {
topCode := model.TopCode{Code: inviteNo}
if mysql.Db.Where(&topCode).First(&topCode).Error != nil {
return errors.New("邀请码不存在")
}
if topCode.EndTime.Before(time.Now()) {
return errors.New("邀请码过期")
}
return nil
}