正在显示
3 个修改的文件
包含
15 行增加
和
5 行删除
@@ -39,6 +39,8 @@ var SUPLUS_SALE_APP = "http://suplus-sale-app-gateway-test.fjmaimaimai.com" | @@ -39,6 +39,8 @@ var SUPLUS_SALE_APP = "http://suplus-sale-app-gateway-test.fjmaimaimai.com" | ||
39 | // TODO:特殊短信验证码,不验证,正式环境注入空 | 39 | // TODO:特殊短信验证码,不验证,正式环境注入空 |
40 | var SMSCODE_ALL_POWER = "999512" | 40 | var SMSCODE_ALL_POWER = "999512" |
41 | 41 | ||
42 | +var EnableBlockChain = true | ||
43 | + | ||
42 | func init() { | 44 | func init() { |
43 | if os.Getenv("LOG_LEVEL") != "" { | 45 | if os.Getenv("LOG_LEVEL") != "" { |
44 | LOG_LEVEL = os.Getenv("LOG_LEVEL") | 46 | LOG_LEVEL = os.Getenv("LOG_LEVEL") |
@@ -4,6 +4,7 @@ import ( | @@ -4,6 +4,7 @@ import ( | ||
4 | "fmt" | 4 | "fmt" |
5 | "github.com/linmadan/egglib-go/utils/json" | 5 | "github.com/linmadan/egglib-go/utils/json" |
6 | "github.com/tal-tech/go-queue/kq" | 6 | "github.com/tal-tech/go-queue/kq" |
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" | ||
7 | "strings" | 8 | "strings" |
8 | ) | 9 | ) |
9 | 10 | ||
@@ -23,8 +24,9 @@ func RegisterDefaultPusherClient(host, topic string) { | @@ -23,8 +24,9 @@ func RegisterDefaultPusherClient(host, topic string) { | ||
23 | 24 | ||
24 | // 异步推送到队列 | 25 | // 异步推送到队列 |
25 | func Push(topic string, o interface{}) error { | 26 | func Push(topic string, o interface{}) error { |
26 | - // TODO:功能未开启 | ||
27 | - return nil | 27 | + if !constant.EnableBlockChain { |
28 | + return nil | ||
29 | + } | ||
28 | var pusher *kq.Pusher | 30 | var pusher *kq.Pusher |
29 | var ok bool | 31 | var ok bool |
30 | if pusher, ok = defaultClientMap[topic]; !ok { | 32 | if pusher, ok = defaultClientMap[topic]; !ok { |
@@ -35,10 +37,14 @@ func Push(topic string, o interface{}) error { | @@ -35,10 +37,14 @@ func Push(topic string, o interface{}) error { | ||
35 | 37 | ||
36 | // 新建一个推送对象 | 38 | // 新建一个推送对象 |
37 | func NewPushObject(source, primaryId, issueId string, obj interface{}) interface{} { | 39 | func NewPushObject(source, primaryId, issueId string, obj interface{}) interface{} { |
38 | - return map[string]interface{}{ | 40 | + data := map[string]interface{}{ |
39 | "source": source, | 41 | "source": source, |
40 | "primaryId": primaryId, | 42 | "primaryId": primaryId, |
41 | "issueId": issueId, | 43 | "issueId": issueId, |
42 | "data": json.MarshalToString(obj), | 44 | "data": json.MarshalToString(obj), |
43 | } | 45 | } |
46 | + return map[string]interface{}{ | ||
47 | + "topic": "up_block_chain", | ||
48 | + "data": data, | ||
49 | + } | ||
44 | } | 50 | } |
@@ -3,13 +3,15 @@ package allied_creation_user | @@ -3,13 +3,15 @@ package allied_creation_user | ||
3 | import ( | 3 | import ( |
4 | "encoding/json" | 4 | "encoding/json" |
5 | "fmt" | 5 | "fmt" |
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" | ||
6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" |
7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" |
8 | ) | 9 | ) |
9 | 10 | ||
10 | func (gateway HttplibAlliedCreationUser) ListBlockChains(param ReqListBlockChain) (DataListBlockChain, error) { | 11 | func (gateway HttplibAlliedCreationUser) ListBlockChains(param ReqListBlockChain) (DataListBlockChain, error) { |
11 | - // TODO:功能未开启 | ||
12 | - return []DataListBlockChainItem{}, nil | 12 | + if !constant.EnableBlockChain { |
13 | + return []DataListBlockChainItem{}, nil | ||
14 | + } | ||
13 | url := gateway.baseUrL + "/block-chains/" | 15 | url := gateway.baseUrL + "/block-chains/" |
14 | method := "post" | 16 | method := "post" |
15 | req := gateway.CreateRequest(url, method) | 17 | req := gateway.CreateRequest(url, method) |
-
请 注册 或 登录 后发表评论