Merge branch 'wp' into dev
This commit is contained in:
commit
93065cb890
44
internal/filter/domain.go
Normal file
44
internal/filter/domain.go
Normal file
@ -0,0 +1,44 @@
|
||||
package filter
|
||||
|
||||
import (
|
||||
"context"
|
||||
appconfig "github.com/exhibition-main/internal/config"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
import (
|
||||
"dubbo.apache.org/dubbo-go/v3/common/extension"
|
||||
"dubbo.apache.org/dubbo-go/v3/filter"
|
||||
"dubbo.apache.org/dubbo-go/v3/protocol"
|
||||
)
|
||||
|
||||
func init() {
|
||||
extension.SetFilter("fonDomainFilter", NewDomainFonFilter)
|
||||
}
|
||||
|
||||
func NewDomainFonFilter() filter.Filter {
|
||||
return &DomainFonFilter{}
|
||||
}
|
||||
|
||||
type DomainFonFilter struct {
|
||||
}
|
||||
|
||||
func (f *DomainFonFilter) Invoke(ctx context.Context, invoker protocol.Invoker, invocation protocol.Invocation) protocol.Result {
|
||||
if len(invocation.Arguments()) > 0 {
|
||||
req := invocation.Arguments()[0]
|
||||
pp := reflect.ValueOf(req)
|
||||
field := pp.Elem().FieldByName("Domain")
|
||||
|
||||
if field.IsValid() {
|
||||
if field.IsZero() {
|
||||
field.SetString(appconfig.Data.System.Domain)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return invoker.Invoke(ctx, invocation)
|
||||
}
|
||||
|
||||
func (f *DomainFonFilter) OnResponse(ctx context.Context, result protocol.Result, invoker protocol.Invoker, protocol protocol.Invocation) protocol.Result {
|
||||
return result
|
||||
}
|
@ -2,6 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"github.com/exhibition-main/api/account"
|
||||
appconfig "github.com/exhibition-main/internal/config"
|
||||
"github.com/exhibition-main/internal/msg"
|
||||
"github.com/exhibition-main/internal/response"
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -17,10 +18,10 @@ func OnlySend(c *gin.Context) {
|
||||
response.ResponseQuickMsg(c, msg.Fail, msg.INVALID_PARAMS, nil)
|
||||
return
|
||||
}
|
||||
//req.Domain = appconfig.Data.System.Domain
|
||||
//req.Scope = "exhibition"
|
||||
req.Domain = appconfig.Data.System.Domain
|
||||
req.Scope = "exhibition"
|
||||
|
||||
res, err := AccountProvider.SendMsg(c, &req)
|
||||
res, err := AccountProvider.OnlySendMsg(c, &req)
|
||||
if err != nil {
|
||||
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
|
||||
return
|
||||
@ -39,9 +40,9 @@ func OnlyCheck(c *gin.Context) {
|
||||
response.ResponseQuickMsg(c, msg.Fail, msg.INVALID_PARAMS, nil)
|
||||
return
|
||||
}
|
||||
//
|
||||
//req.Domain = appconfig.Data.System.Domain
|
||||
//req.Scope = "exhibition"
|
||||
|
||||
req.Domain = appconfig.Data.System.Domain
|
||||
req.Scope = "exhibition"
|
||||
|
||||
res, err := AccountProvider.OnlyCheckMsg(c, &req)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user