作者 tangxvhui

Merge branch 'dev-pushdata' into test

... ... @@ -116,6 +116,12 @@ spec:
value: "https://suplus-business-admin-prd.fjmaimaimai.com"
- name: MMM_OPEN_API_SERVICE_HOST
value: "https://public-interface.fjmaimaimai.com/openapi"
- name: PUSH_DATA_HOST
value: "https://character-library-metadata-bastion.sumifcc.com"
- name: PUSH_DATA_APPKEY
value: "7q9Kd8ktoB"
- name: PUSH_DATA_APPSECRET
value: "pQSoBj44Wk"
volumes:
- name: accesslogs
emptyDir: {}
... ...
package constant
import "os"
//推送数据到字库
var PUSH_DATA_HOST string = "http://character-library-metadata-bastion-test.fjmaimaimai.com"
var PUSH_DATA_APPKEY string = "GnAmG4jybB"
var PUSH_DATA_APPSECRET string = "3Oo4dG64X0"
func init() {
if os.Getenv("PUSH_DATA_HOST") != "" {
PUSH_DATA_HOST = os.Getenv("PUSH_DATA_HOST")
}
if os.Getenv("PUSH_DATA_APPKEY") != "" {
PUSH_DATA_APPKEY = os.Getenv("PUSH_DATA_APPKEY")
}
if os.Getenv("PUSH_DATA_APPSECRET") != "" {
PUSH_DATA_APPSECRET = os.Getenv("PUSH_DATA_APPSECRET")
}
}
... ...
... ... @@ -8,6 +8,7 @@ import (
"time"
"github.com/dgrijalva/jwt-go"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/constant"
)
type FieldName struct {
... ... @@ -31,9 +32,9 @@ type Client struct {
func NewClient() *Client {
return &Client{
Host: "http://character-library-metadata-bastion-test.fjmaimaimai.com",
AppSecret: "3Oo4dG64X0",
AppKey: "GnAmG4jybB",
Host: constant.PUSH_DATA_HOST,
AppSecret: constant.PUSH_DATA_APPSECRET,
AppKey: constant.PUSH_DATA_APPKEY,
}
}
... ... @@ -94,6 +95,7 @@ type ReqSearchTable struct {
// SearchTable 查询应用数据表
func (c *Client) SearchTable(name string) {
apiUrl := `/api/app-table-file/list`
//TODO
_ = apiUrl
}
... ... @@ -106,5 +108,6 @@ type ReqCreateTable struct {
// CreateTable 创建应用表
func (c *Client) CreateTable() {
apiUrl := `/api/app-table-file/create`
//TODO
_ = apiUrl
}
... ...
... ... @@ -23,8 +23,17 @@ func TestField(t *testing.T) {
func TestPushData(t *testing.T) {
nowTime := time.Unix(1688572800, 0)
err := SendDataStaffAssess(nowTime)
c := NewClient()
c.Host = "https://character-library-metadata-bastion.sumifcc.com"
c.AppKey = "7q9Kd8ktoB"
c.AppSecret = "pQSoBj44Wk"
entry := StaffAssessItem{}
data, err := entry.DataForAppend(nowTime)
if err != nil {
t.Logf("获取每日评估的数据 %s", err)
}
err = c.AppendData(data)
if err != nil {
t.Error(err)
t.Logf("获取每日评估的数据 %s", err)
}
}
... ...
... ... @@ -7,9 +7,10 @@ import (
)
func PushData() {
//每天15:30点运行
nowTime := time.Now()
y, m, d := nowTime.Date()
t1 := time.Date(y, m, d, 10, 0, 0, 0, time.Local) //今天的10点
t1 := time.Date(y, m, d, 16, 50, 0, 0, time.Local) //今天的15:30
interval := t1.Sub(nowTime)
if interval < 0 {
interval = (24 * time.Hour) + interval
... ... @@ -20,7 +21,7 @@ func PushData() {
nowTime = time.Now()
err := SendDataStaffAssess(nowTime)
if err != nil {
log.Logger.Error("发送每日评估任务")
log.Logger.Error("发送每日评估任务" + err.Error())
}
timer.Reset(24 * time.Hour)
... ...