Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
ad339bf60c
4 changed files with 24 additions and 2 deletions
  1. +8
    -1
      app/customer/hdl/hdl_alipay.go
  2. +9
    -0
      app/customer/hdl/hdl_login.go
  3. +6
    -0
      app/customer/md/alipay.go
  4. +1
    -1
      app/router/customer_router.go

+ 8
- 1
app/customer/hdl/hdl_alipay.go View File

@@ -7,6 +7,8 @@ import (
"applet/app/db"
"applet/app/e"
"applet/app/enum"
"applet/app/utils"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
)
@@ -31,7 +33,12 @@ func AesDecrypt(c *gin.Context) {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, result, nil)

resByre, _ := json.Marshal(result)
var aesStruct md.AesStruct
json.Unmarshal(resByre, &aesStruct)
aesStruct.Mobile = utils.Base64StdEncode(aesStruct.Mobile)
e.OutSuc(c, aesStruct, nil)
return
}



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

@@ -129,6 +129,8 @@ func WxDecryptMobile(c *gin.Context) {
return
}

res.PhoneNumber = utils.Base64StdEncode(res.PhoneNumber)

e.OutSuc(c, res, nil)
return
}
@@ -184,6 +186,13 @@ func Register(c *gin.Context) {
e.OutErr(c, e.ERR_DB_ORM, err)
return
}
//TODO::解密
phone := utils.Base64StdDecode(req.Phone)
if phone == "" {
e.OutErr(c, e.ERR, "非法/恶意 参数!!!")
return
}
req.Phone = phone
// 编译正则表达式
pattern := `^1[3456789]\d{9}$`
r := regexp.MustCompile(pattern)


+ 6
- 0
app/customer/md/alipay.go View File

@@ -33,3 +33,9 @@ type AliPayCallback struct {
Version string `json:"version"`
PayMethod string `json:"pay_method"`
}

type AesStruct struct {
Code string `json:"code"`
Msg string `json:"msg"`
Mobile string `json:"mobile"`
}

+ 1
- 1
app/router/customer_router.go View File

@@ -33,7 +33,7 @@ func CustomerInit(r *gin.RouterGroup) {
r.POST("/wxPay", hdl.WxPay)

r.POST("/register", hdl.Register)
r.POST("/aesDecrypt", hdl.AesDecrypt)
r.POST("/aesDecrypt", hdl.AesDecrypt) //TODO::专门给解密支付宝手机号
r.POST("/systemOauthToken", hdl.SystemOauthToken)
r.GET("/getSysCfg", hdl.GetSysCfg) //获取基础配置
r.Use(mw.Auth) //检测登录状态


Loading…
Cancel
Save