Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
9ccc2c6ff0
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      app/customer/hdl/hdl_login.go

+ 11
- 0
app/customer/hdl/hdl_login.go View File

@@ -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,


Loading…
Cancel
Save