Merge branch 'dev-pushdata' into test
正在显示
5 个修改的文件
包含
49 行增加
和
7 行删除
@@ -116,6 +116,12 @@ spec: | @@ -116,6 +116,12 @@ spec: | ||
116 | value: "https://suplus-business-admin-prd.fjmaimaimai.com" | 116 | value: "https://suplus-business-admin-prd.fjmaimaimai.com" |
117 | - name: MMM_OPEN_API_SERVICE_HOST | 117 | - name: MMM_OPEN_API_SERVICE_HOST |
118 | value: "https://public-interface.fjmaimaimai.com/openapi" | 118 | value: "https://public-interface.fjmaimaimai.com/openapi" |
119 | + - name: PUSH_DATA_HOST | ||
120 | + value: "https://character-library-metadata-bastion.sumifcc.com" | ||
121 | + - name: PUSH_DATA_APPKEY | ||
122 | + value: "7q9Kd8ktoB" | ||
123 | + - name: PUSH_DATA_APPSECRET | ||
124 | + value: "pQSoBj44Wk" | ||
119 | volumes: | 125 | volumes: |
120 | - name: accesslogs | 126 | - name: accesslogs |
121 | emptyDir: {} | 127 | emptyDir: {} |
pkg/constant/push_data.go
0 → 100644
1 | +package constant | ||
2 | + | ||
3 | +import "os" | ||
4 | + | ||
5 | +//推送数据到字库 | ||
6 | + | ||
7 | +var PUSH_DATA_HOST string = "http://character-library-metadata-bastion-test.fjmaimaimai.com" | ||
8 | + | ||
9 | +var PUSH_DATA_APPKEY string = "GnAmG4jybB" | ||
10 | + | ||
11 | +var PUSH_DATA_APPSECRET string = "3Oo4dG64X0" | ||
12 | + | ||
13 | +func init() { | ||
14 | + if os.Getenv("PUSH_DATA_HOST") != "" { | ||
15 | + PUSH_DATA_HOST = os.Getenv("PUSH_DATA_HOST") | ||
16 | + } | ||
17 | + if os.Getenv("PUSH_DATA_APPKEY") != "" { | ||
18 | + PUSH_DATA_APPKEY = os.Getenv("PUSH_DATA_APPKEY") | ||
19 | + } | ||
20 | + if os.Getenv("PUSH_DATA_APPSECRET") != "" { | ||
21 | + PUSH_DATA_APPSECRET = os.Getenv("PUSH_DATA_APPSECRET") | ||
22 | + } | ||
23 | +} |
@@ -8,6 +8,7 @@ import ( | @@ -8,6 +8,7 @@ import ( | ||
8 | "time" | 8 | "time" |
9 | 9 | ||
10 | "github.com/dgrijalva/jwt-go" | 10 | "github.com/dgrijalva/jwt-go" |
11 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant" | ||
11 | ) | 12 | ) |
12 | 13 | ||
13 | type FieldName struct { | 14 | type FieldName struct { |
@@ -31,9 +32,9 @@ type Client struct { | @@ -31,9 +32,9 @@ type Client struct { | ||
31 | 32 | ||
32 | func NewClient() *Client { | 33 | func NewClient() *Client { |
33 | return &Client{ | 34 | return &Client{ |
34 | - Host: "http://character-library-metadata-bastion-test.fjmaimaimai.com", | ||
35 | - AppSecret: "3Oo4dG64X0", | ||
36 | - AppKey: "GnAmG4jybB", | 35 | + Host: constant.PUSH_DATA_HOST, |
36 | + AppSecret: constant.PUSH_DATA_APPSECRET, | ||
37 | + AppKey: constant.PUSH_DATA_APPKEY, | ||
37 | } | 38 | } |
38 | } | 39 | } |
39 | 40 | ||
@@ -94,6 +95,7 @@ type ReqSearchTable struct { | @@ -94,6 +95,7 @@ type ReqSearchTable struct { | ||
94 | // SearchTable 查询应用数据表 | 95 | // SearchTable 查询应用数据表 |
95 | func (c *Client) SearchTable(name string) { | 96 | func (c *Client) SearchTable(name string) { |
96 | apiUrl := `/api/app-table-file/list` | 97 | apiUrl := `/api/app-table-file/list` |
98 | + //TODO | ||
97 | _ = apiUrl | 99 | _ = apiUrl |
98 | } | 100 | } |
99 | 101 | ||
@@ -106,5 +108,6 @@ type ReqCreateTable struct { | @@ -106,5 +108,6 @@ type ReqCreateTable struct { | ||
106 | // CreateTable 创建应用表 | 108 | // CreateTable 创建应用表 |
107 | func (c *Client) CreateTable() { | 109 | func (c *Client) CreateTable() { |
108 | apiUrl := `/api/app-table-file/create` | 110 | apiUrl := `/api/app-table-file/create` |
111 | + //TODO | ||
109 | _ = apiUrl | 112 | _ = apiUrl |
110 | } | 113 | } |
@@ -23,8 +23,17 @@ func TestField(t *testing.T) { | @@ -23,8 +23,17 @@ func TestField(t *testing.T) { | ||
23 | 23 | ||
24 | func TestPushData(t *testing.T) { | 24 | func TestPushData(t *testing.T) { |
25 | nowTime := time.Unix(1688572800, 0) | 25 | nowTime := time.Unix(1688572800, 0) |
26 | - err := SendDataStaffAssess(nowTime) | 26 | + c := NewClient() |
27 | + c.Host = "https://character-library-metadata-bastion.sumifcc.com" | ||
28 | + c.AppKey = "7q9Kd8ktoB" | ||
29 | + c.AppSecret = "pQSoBj44Wk" | ||
30 | + entry := StaffAssessItem{} | ||
31 | + data, err := entry.DataForAppend(nowTime) | ||
32 | + if err != nil { | ||
33 | + t.Logf("获取每日评估的数据 %s", err) | ||
34 | + } | ||
35 | + err = c.AppendData(data) | ||
27 | if err != nil { | 36 | if err != nil { |
28 | - t.Error(err) | 37 | + t.Logf("获取每日评估的数据 %s", err) |
29 | } | 38 | } |
30 | } | 39 | } |
@@ -7,9 +7,10 @@ import ( | @@ -7,9 +7,10 @@ import ( | ||
7 | ) | 7 | ) |
8 | 8 | ||
9 | func PushData() { | 9 | func PushData() { |
10 | + //每天15:30点运行 | ||
10 | nowTime := time.Now() | 11 | nowTime := time.Now() |
11 | y, m, d := nowTime.Date() | 12 | y, m, d := nowTime.Date() |
12 | - t1 := time.Date(y, m, d, 10, 0, 0, 0, time.Local) //今天的10点 | 13 | + t1 := time.Date(y, m, d, 16, 50, 0, 0, time.Local) //今天的15:30 |
13 | interval := t1.Sub(nowTime) | 14 | interval := t1.Sub(nowTime) |
14 | if interval < 0 { | 15 | if interval < 0 { |
15 | interval = (24 * time.Hour) + interval | 16 | interval = (24 * time.Hour) + interval |
@@ -20,7 +21,7 @@ func PushData() { | @@ -20,7 +21,7 @@ func PushData() { | ||
20 | nowTime = time.Now() | 21 | nowTime = time.Now() |
21 | err := SendDataStaffAssess(nowTime) | 22 | err := SendDataStaffAssess(nowTime) |
22 | if err != nil { | 23 | if err != nil { |
23 | - log.Logger.Error("发送每日评估任务") | 24 | + log.Logger.Error("发送每日评估任务" + err.Error()) |
24 | } | 25 | } |
25 | 26 | ||
26 | timer.Reset(24 * time.Hour) | 27 | timer.Reset(24 * time.Hour) |
-
请 注册 或 登录 后发表评论