diff --git a/plugins/zltx_v1/internal/transform.go b/plugins/zltx_v1/internal/transform.go index 4bc754b..393f018 100644 --- a/plugins/zltx_v1/internal/transform.go +++ b/plugins/zltx_v1/internal/transform.go @@ -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) { - accountType = 2 + } 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,