修改企业微信
This commit is contained in:
@@ -2,12 +2,9 @@ package enterprise_wechat
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// 回调参数
|
||||
// 回调参数(推送SuiteTicket)
|
||||
type SuiteTicketInfo struct {
|
||||
SuiteId string `xml:"SuiteId"` // 第三方应用的SuiteId
|
||||
InfoType string `xml:"InfoType"` // suite_ticket
|
||||
@@ -15,18 +12,28 @@ type SuiteTicketInfo struct {
|
||||
SuiteTicket string `xml:"SuiteTicket"` // Ticket内容,最长为512字节
|
||||
}
|
||||
|
||||
func (a *API) GetEnterpriseMsg(request *http.Request) (*SuiteTicketInfo, error) {
|
||||
data, err := ioutil.ReadAll(request.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
globals.SugarLogger.Debug("data============enterprise", data)
|
||||
globals.SugarLogger.Debug("data============enterprise", string(data))
|
||||
|
||||
suite := &SuiteTicketInfo{}
|
||||
if err := xml.Unmarshal(data, suite); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return suite, err
|
||||
// 回调参数(解密推送消息Encrypt =》 SuiteTicketInfo 转化为上面的推送信息)
|
||||
type SuiteEncrypt struct {
|
||||
ToUserName string `xml:"ToUserName"` // 企业微信的CorpID,当为第三方套件回调事件时,CorpID的内容为suiteid
|
||||
AgentID string `xml:"AgentID"` // 接收的应用id,可在应用的设置页面获取
|
||||
Encrypt string `xml:"Encrypt"` // 消息结构体加密后的字符串
|
||||
}
|
||||
|
||||
// 解密加密推送信息
|
||||
func (a *API) GetEnterpriseSend(request []byte) (*SuiteEncrypt, error) {
|
||||
encrypt := &SuiteEncrypt{}
|
||||
if err := xml.Unmarshal(request, encrypt); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return encrypt, nil
|
||||
}
|
||||
|
||||
func (a *API) GetEnterpriseMsg(param []byte) (*SuiteTicketInfo, error) {
|
||||
suite := &SuiteTicketInfo{}
|
||||
if err := xml.Unmarshal(param, suite); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return suite, nil
|
||||
}
|
||||
|
||||
@@ -469,6 +469,34 @@ func (a *API) OrderJDZBDelivery(orderId string, userName string) (detail string,
|
||||
return "", err
|
||||
}
|
||||
|
||||
// 订单拣货完成且商家自送
|
||||
// https://openapi.jddj.com/djapi/bm/open/api/order/OrderSerllerDelivery
|
||||
func (a *API) OrderJDZBStoreDelivery(orderId string, userName string) (detail string, err error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"orderId": orderId,
|
||||
"operator": utils.GetAPIOperator(userName),
|
||||
}
|
||||
result, err := a.AccessAPINoPage("bm/open/api/order/OrderSerllerDelivery", jdParams, nil, nil, orderOperationResultParser)
|
||||
if err == nil {
|
||||
return utils.Interface2String(result), nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
// 订单拣货完成且顾客自提
|
||||
// https://openapi.jddj.com/djapi/bm/open/api/order/OrderSelfMention
|
||||
func (a *API) OrderJDZBSelfDelivery(orderId string, userName string) (detail string, err error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"orderId": orderId,
|
||||
"operator": utils.GetAPIOperator(userName),
|
||||
}
|
||||
result, err := a.AccessAPINoPage("bm/open/api/order/OrderSelfMention", jdParams, nil, nil, orderOperationResultParser)
|
||||
if err == nil {
|
||||
return utils.Interface2String(result), nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
// 订单达达配送转商家自送接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=169&apiid=e7b4950164754eecac7ea87278c2b071
|
||||
func (a *API) ModifySellerDelivery(orderId string, userName string) (detail string, err error) {
|
||||
|
||||
Reference in New Issue
Block a user