refactor: adjust project structure

This commit is contained in:
2024-11-14 01:15:55 +08:00
parent c219d81b89
commit 70d7229dd8
20 changed files with 320 additions and 132 deletions

View File

@ -0,0 +1,24 @@
package sms
import (
"fmt"
"health-go/config"
"health-go/model"
)
func PreValidate(userTel string) string {
var result model.User
// 计数查询是否存在对应的手机号
query := config.DB.Table("user").Where("tel = ?", userTel).First(&result)
if query.Error != nil {
return fmt.Sprint(query.Error)
}
if query.RowsAffected == 0 {
return "notExist"
}
if result.SMSTry > 10 {
return "reachLimit"
}
return "ok"
}