|
|
@@ -15,6 +15,7 @@ import ( |
|
|
|
"fmt" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"github.com/medivhzhan/weapp/v2" |
|
|
|
"regexp" |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
@@ -183,6 +184,16 @@ func Register(c *gin.Context) { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, err) |
|
|
|
return |
|
|
|
} |
|
|
|
// 编译正则表达式 |
|
|
|
pattern := `^1[3456789]d{9}$` |
|
|
|
reg := regexp.MustCompile(pattern) |
|
|
|
|
|
|
|
// 验证手机号码 |
|
|
|
if !reg.MatchString(req.Phone) { |
|
|
|
e.OutErr(c, e.ERR, "非法手机号") |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if user == nil { |
|
|
|
user = &model.User{ |
|
|
|
UserId: req.UserId, |
|
|
|