修改京东im

This commit is contained in:
邹宗楠
2025-12-19 13:46:06 +08:00
parent 711d240cad
commit 51eac765f8
3 changed files with 41 additions and 7 deletions

View File

@@ -3,7 +3,6 @@ package jdapi
import (
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"io/ioutil"
"net/http"
"time"
@@ -47,20 +46,17 @@ func (a *API) ImWaiterStatusModify(clientType int, stationId string, presence in
// MessagePushService 给京东用户推送消息 https://scene-control-access-pro.pf.jd.com/#/flow-center(咚咚场景化消息接入平台)
func (a *API) MessagePushService(msg *ContextMsg) error {
parameter := utils.Struct2Map(&msg, "", false)
systemParam := map[string]interface{}{
"aspid": "P0000201", // 可在“咚咚场景化消息接入平台 - 产品线 - 基础信息”中查看
"accessid": utils.GetUUID(), // 访问ID可用于请求去重
"timestamp": time.Now().UnixNano(),
"version": "3.0",
"accessToken": "af1aa6a267849b3f9f4caa19e1ad5564", // 咚咚场景化消息接入平台 - 产品线 - 基础信息
"source": msg.Body.Template.Source,
}
allParameter := utils.MergeMaps(parameter, systemParam)
globals.SugarLogger.Debugf("------allParameter: %s", utils.Format4Output(allParameter, false))
systemParam["jsonMsg"] = string(utils.MustMarshal(msg))
result, err := a.AccessAPINoPage("MessagePushService/push2", allParameter, nil, nil, genNoPageResultParser("code", "msg", "result", "0"))
globals.SugarLogger.Debugf("------result: %s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("------result: %v", err)
_, err := a.AccessAPINoPage("MessagePushService/push2", systemParam, nil, nil, genNoPageResultParser("code", "msg", "data", "230001"))
if err != nil {
return err
}

File diff suppressed because one or more lines are too long

View File

@@ -7,6 +7,7 @@ import (
"encoding/json"
"errors"
"fmt"
"git.rosy.net.cn/jx-callback/globals"
"net/http"
"reflect"
"sort"
@@ -195,6 +196,7 @@ func (a *API) AccessAPI2(apiStr string, jdParams map[string]interface{}, traceIn
userGet = false
}
params["jd_param_json"] = jdParamStr
globals.SugarLogger.Debugf("------paramas := %s", utils.Format4Output(params, false))
err = platformapi.AccessPlatformAPIWithRetry(a.client,
func() *http.Request {
params["timestamp"] = utils.GetCurTimeStr()