插件v1恢复
This commit is contained in:
parent
662d82326c
commit
fc6f3533ab
|
@ -9,6 +9,7 @@ import (
|
||||||
"gitea.cdlsxd.cn/sdk/plugin/utils"
|
"gitea.cdlsxd.cn/sdk/plugin/utils"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"regexp"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
@ -65,9 +66,17 @@ func (c *Config) orderReq(in *proto.OrderRequest) (*direct.Order, error) {
|
||||||
accountType := int8(0)
|
accountType := int8(0)
|
||||||
if utils.IsPhoneNumber(in.Order.Account) {
|
if utils.IsPhoneNumber(in.Order.Account) {
|
||||||
accountType = 1
|
accountType = 1
|
||||||
} else if utils.IsValidQQ(in.Order.Account) {
|
} else {
|
||||||
accountType = 2
|
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{
|
d := &direct.Order{
|
||||||
Number: in.Order.Quantity,
|
Number: in.Order.Quantity,
|
||||||
MerchantId: c.MerchantId,
|
MerchantId: c.MerchantId,
|
||||||
|
|
Loading…
Reference in New Issue