插件v1恢复
This commit is contained in:
parent
662d82326c
commit
fc6f3533ab
|
@ -9,6 +9,7 @@ import (
|
|||
"gitea.cdlsxd.cn/sdk/plugin/utils"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"net/http"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
@ -65,9 +66,17 @@ func (c *Config) orderReq(in *proto.OrderRequest) (*direct.Order, error) {
|
|||
accountType := int8(0)
|
||||
if utils.IsPhoneNumber(in.Order.Account) {
|
||||
accountType = 1
|
||||
} else if utils.IsValidQQ(in.Order.Account) {
|
||||
} else {
|
||||
qqPattern := `^[1-9][0-9]{4,11}$`
|
||||
qqRegex, err := regexp.Compile(qqPattern)
|
||||
if err != nil {
|
||||
return nil, proto.ErrorParamFail(fmt.Sprintf("正则表达式编译失败: %v", err))
|
||||
}
|
||||
if qqRegex.MatchString(in.Order.Account) {
|
||||
accountType = 2
|
||||
}
|
||||
}
|
||||
|
||||
d := &direct.Order{
|
||||
Number: in.Order.Quantity,
|
||||
MerchantId: c.MerchantId,
|
||||
|
|
Loading…
Reference in New Issue