Compare commits

...

7 Commits
v1.0.0 ... v1

7 changed files with 298 additions and 227 deletions

194
config.go
View File

@ -2,84 +2,77 @@ package l_msg_api
// 业务系统和模板配置 // 业务系统和模板配置
type ( type (
Base struct { base struct {
ServerIndex string `json:"server_index"` // 业务系统 ServerIndex string `json:"server_index"` // 业务系统
TempIndex string `json:"temp_index"` // 配置模板 TempIndex string `json:"temp_index"` // 配置模板
} }
accessTokenResponse struct { responseBody struct {
Code int `json:"code"` Code int `json:"code"`
Msg string `json:"msg"` Msg string `json:"msg"`
Data struct { Data interface{} `json:"data"`
AccessToken string `json:"accessToken"` // 授权token
AccessExpire int `json:"accessExpire"` // 过期时间
} `json:"data"`
} }
OACreatePurchaseResponse struct { accessTokenResponse struct {
Code int `json:"code"` AccessToken string `json:"accessToken"` // 授权token
Msg string `json:"msg"` AccessExpire int `json:"accessExpire"` // 过期时间
Data struct { }
IsSuccess bool `json:"is_success"` // 是否成功 true 成功 false 失败
Msg string `json:"msg"` OAResponse struct {
InstanceId string `json:"instance_id"` // 审批实例id IsSuccess bool `json:"is_success"` // 是否成功 true 成功 false 失败
} `json:"data"` Msg string `json:"msg"`
InstanceId string `json:"instance_id"` // 审批实例id
} }
// 封装上游采购审批表单数据 // 封装上游采购审批表单数据
formDataRequest struct { formDataRequest struct {
Base Base `json:"base"` Base base `json:"base"`
formsData FormsData
} }
formsData struct {
FormBase FormsData struct {
FormComponentValues []formComponentValues `json:"form_component_values"` // 审批表单数据 formBase
FormComponentValues []FormComponentValues `json:"form_component_values"` // 审批表单数据
Finance *Finance `json:"finance"` // 财务模块调用
} }
formComponentValues struct { // 审批表单数据
FormComponentValues struct { // 审批表单数据
Name string `json:"name"` Name string `json:"name"`
Value string `json:"value"` Value string `json:"value"`
ComponentType string `json:"component_type,omitempty"` ComponentType string `json:"component_type,omitempty"`
ExtValue string `json:"extValue,omitempty"` ExtValue string `json:"extValue,omitempty"`
} }
Finance struct {
CheckUserId string `json:"checkUserId"` //审核人
Sync int64 `json:"sync"` //是否是异步,如果为异步,付款申请和业务申请是同时进行
Amount string `json:"amount"` //金额
GoodsInfo string `json:"goodsInfo"` //商品信息
PaymentAccount string `json:"paymentAccount"` //付款方账户
TaxAmount string `json:"taxAmount"` //税率
CallbackUrl string `json:"callbackUrl"` //回调地址
Remark string `json:"remark"`
SystemName string `json:"systemName"` //业务系统名称
SubjectName string `json:"subjectName"` //户名
BankInfo BankInfo `json:"bankInfo"`
}
BankInfo struct {
ResellerName string `json:"resellerName"` //供应商名称
BankName string `json:"bankName"` //银行名称
AccountBankName string `json:"accountBankName"` //开户行名称
SubjectName string `json:"subjectName"` //户名
BankAccount string `json:"bankAccount"` //银行卡号
}
// 创建OA基础数据 // 创建OA基础数据
FormBase struct { formBase struct {
OutTradeNo string `json:"out_trade_no"` // 流水号 OutTradeNo string `json:"out_trade_no"` // 流水号
OriginatorUserId string `json:"originator_user_id"` // 钉钉申请人id OriginatorUserId string `json:"originator_user_id"` // 钉钉申请人id
} }
// 创建采购审批表单数据
CreatePurchaseForm struct {
FormBase
PurchaseNum string // 采购单号
SupplierName string //供应商名称
TotalCount string //采购总数量
TotalAmount string //采购总金额
WarehouseName string //入库仓库
ExpectArrivalTime string //预计到货时间
Remark string //采购备注
PurchaseType string //采购类型
PayType string //支付类型
TotalAmountUpperCase string //总金额大写
SupplierSettlementBank string //结算账户开户行
SupplierSettlementAccount string //结算账户
PurchaseInGoodsList []PurchaseInGoods
}
// 采购单商品列表
PurchaseInGoods struct {
GoodsCode string `json:"goods_code"` // 商品编码
GoodsName string `json:"goods_name"` // 商品名称
Count string `json:"count"` // 数量
Price string `json:"price"` // 单价
Total string `json:"total"` // 总价
}
// 获取审批实列详情 请求数据 // 获取审批实列详情 请求数据
oAGetDetailRequest struct { oAGetDetailRequest struct {
Base Base `json:"base"` Base base `json:"base"`
OutTradeNo string `json:"out_trade_no"` // 流水号 OutTradeNo string `json:"out_trade_no"` // 流水号
ProcessInstanceId string `json:"process_instance_id"` // 审批实例id ProcessInstanceId string `json:"process_instance_id"` // 审批实例id
} }
@ -95,93 +88,56 @@ type (
CreateTime string `json:"createTime"` // 审批创建时间 CreateTime string `json:"createTime"` // 审批创建时间
UpdateTime string `json:"updateTime"` // 审批更新时间 UpdateTime string `json:"updateTime"` // 审批更新时间
} }
OAGetDetailResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data OAGetDetailData `json:"data"`
}
// 创建客户充值审批表单数据 smsRequest struct {
CreateCustomerRechargeForm struct { Base base `json:"base"`
FormBase
Initiator string //发起人
CustomerName string //客户名称
RecipientAccountName string //收款账户名称
RechargeType string //充值类型
RechargeAmount string //充值金额
Voucher string //充值凭证
Remark string //备注
CreatedAt string //创建时间
}
// 创建供应商充值审批表单数据
CreateSupplierRechargeForm struct {
FormBase
Initiator string //发起人
SupplierName string //供应商名称
RecipientAccountName string //收款账户名称
RechargeType string //充值类型
RechargeAmount string //充值金额
Voucher string //充值凭证
Remark string //备注
CreatedAt string //创建时间
}
/*
OaNotifyData 回调通知数据
Method: POST
{"content-type": "application/json; charset=utf-8"},
*/
OaNotifyData struct {
OutTradeNo string `json:"out_trade_no"` // 下游流水号
ProcessInstanceId string `json:"process_instance_id"` // 创建审批任务返回的 审批实例id
Title string `json:"title"` // 实例标题
StaffId string `json:"staff_id"` // 当前任务的审批人userId操作转交动作的用户userId
Result int32 `json:"result"` // 审批结果1同意2拒绝
Type string `json:"type"` // 任务状态变更类型,start审批任务开始,finish审批任务正常结束完成或转交,comment审批任务评论,cancel说明当前节点有多个审批人并且是或签其中一个人执行了审批其他审批人会推送cancel类型事件
Remark string `json:"remark"` // 操作时写的评论内容
CreatedAt string `json:"created_at"` // 创建时间
UpdatedAt string `json:"updated_at"` // 结束时间
}
SmsRequest struct {
Base Base `json:"base"`
Param string `json:"param"` // 短信模板变量对应的实际值 Param string `json:"param"` // 短信模板变量对应的实际值
Tels string `json:"tels"` Tels string `json:"tels"`
} }
SmsSendRes struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data SmsSend `json:"data"`
}
SmsSend struct { SmsSend struct {
SendList []SmsSendResView `json:"send_list"` SendList []smsSendResView `json:"send_list"`
} }
SmsSendResView struct { smsSendResView struct {
Tel string `json:"tel"` Tel string `json:"tel"`
IsSuccess uint32 `json:"is_success"` IsSuccess uint32 `json:"is_success"`
} }
DingTalkBlackBoardSendReq struct { dingTalkBlackBoardSendReq struct {
Base Base `json:"base"` Base base `json:"base"`
BlackboardReceiver BlackboardReceiverView `json:"blackboard_receiver"` //公告接收人。 BlackboardReceiver blackboardReceiverView `json:"blackboard_receiver"` //公告接收人。
Title string `json:"title,default=公告"` //公告标题 Title string `json:"title,default=公告"` //公告标题
Content string `json:"content,default=大家好"` //公告内容 Content string `json:"content,default=大家好"` //公告内容
} }
BlackboardReceiverView struct { blackboardReceiverView struct {
DeptidList []int `json:"deptid_list"` //接收部门ID列表最大的列表长度为20。 DeptidList []int `json:"deptid_list"` //接收部门ID列表最大的列表长度为20。
UseridList []string `json:"userid_list"` //接收部用户ID列表最大的列表长度为20。 UseridList []string `json:"userid_list"` //接收部用户ID列表最大的列表长度为20。
} }
DefaultRes struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data Default `json:"data"`
}
Default struct { Default struct {
IsSuccess bool `json:"is_success,default=false"` IsSuccess bool `json:"is_success,default=false"`
Msg string `json:"msg,default=ok"` Msg string `json:"msg,default=ok"`
} }
oACommentRequest struct {
Base base `json:"base"`
OutTradeNo string `json:"out_trade_no"` // 流水号
Text string `json:"text"` //评论的内容
CommentUserId string `json:"commentUserId,optional"` //评论的内容
File DingOACommentReqFile `json:"file,optional"` //文件
}
DingOACommentReqFile struct {
Photos []string `json:"photos,optional"` //图片URL地址
Attachments []DingOACommentReqFileAttachments `json:"attachments,optional"` //图片URL地址
}
DingOACommentReqFileAttachments struct {
SpaceId string `json:"spaceId,optional"` //钉盘空间ID。
FileSize string `json:"fileSize,optional"` //文件大小。
FileId string `json:"fileId,optional"` //文件ID。
FileName string `json:"fileName,optional"` //文件名称。
FileType string `json:"fileType,optional"` //文件类型。
}
) )

View File

@ -1,8 +1,8 @@
package l_msg_api package l_msg_api
const ( const (
ServerHost = "http://121.199.38.107:8000" serverHost = "http://127.0.0.1:8001"
TimeOut = 60 timeOut = 60
) )
const ( const (
@ -14,8 +14,9 @@ const (
) )
const ( const (
PathAccessToken = "/oauth/v1/accesstoken" accessToken = "/oauth/v1/accesstoken"
PathOaCreat = "/msg/v1/dingtalk/oa/create" oaCreat = "/msg/v1/dingtalk/oa/create"
PathOaGet = "/msg/v1/dingtalk/oa/create" oaGet = "/msg/v1/dingtalk/oa/get"
SendSms = "/msg/v1//sms/send" oaComment = "/msg/v1/dingtalk/oa/comment"
sendSms = "/msg/v1/sms/send"
) )

2
go.mod
View File

@ -1,6 +1,6 @@
module gitea.cdlsxd.cn/self-tools/l_msg_api module gitea.cdlsxd.cn/self-tools/l_msg_api
go 1.23.6 go 1.22.2
require github.com/valyala/fasthttp v1.59.0 require github.com/valyala/fasthttp v1.59.0

View File

@ -9,12 +9,13 @@ import (
func FastHttpPost(url string, header map[string]string, body []byte, timeout int) ([]byte, error) { func FastHttpPost(url string, header map[string]string, body []byte, timeout int) ([]byte, error) {
req := fasthttp.AcquireRequest() req := fasthttp.AcquireRequest()
defer fasthttp.ReleaseRequest(req) // 用完需要释放资源 defer fasthttp.ReleaseRequest(req) // 用完需要释放资源
// 默认是application/x-www-form-urlencoded
req.Header.SetMethod("POST") req.Header.SetMethod("POST")
for k, v := range header { for k, v := range header {
req.Header.Set(k, v) req.Header.Set(k, v)
} }
req.SetRequestURI(url) req.SetRequestURI(url)
req.SetTimeout(time.Duration(timeout) * time.Second)
req.SetBody(body) req.SetBody(body)
resp := fasthttp.AcquireResponse() resp := fasthttp.AcquireResponse()
defer fasthttp.ReleaseResponse(resp) // 用完需要释放资源 defer fasthttp.ReleaseResponse(resp) // 用完需要释放资源
@ -29,7 +30,6 @@ func FastHttpPost(url string, header map[string]string, body []byte, timeout int
} }
} }
b := resp.Body() b := resp.Body()
//fmt.Println(string(b),"http请求")
return b, nil return b, nil
} }

143
msg.go
View File

@ -2,11 +2,6 @@ package l_msg_api
import ( import (
"encoding/json" "encoding/json"
"errors"
"fmt"
"gitea.cdlsxd.cn/self-tools/l_msg_api/cache"
"gitea.cdlsxd.cn/self-tools/l_msg_api/httpclient"
"strings"
) )
type MessageCenter struct { type MessageCenter struct {
@ -14,139 +9,95 @@ type MessageCenter struct {
ClientKey string // 客户端id,获取授权token需要 ClientKey string // 客户端id,获取授权token需要
ClientSecret string ClientSecret string
header map[string]string header map[string]string
Base base
} }
func NewMessageCenter(clientKey, clientSecret, serverIndex, tempIndex string) (*MessageCenter, error) { func NewMessageCenter(host, clientKey, clientSecret, serverIndex, tempIndex string) (*MessageCenter, error) {
msg := &MessageCenter{ msg := &MessageCenter{
Host: ServerHost, Host: host,
ClientKey: clientKey, ClientKey: clientKey,
ClientSecret: clientSecret, ClientSecret: clientSecret,
Base: Base{ base: base{
ServerIndex: serverIndex, ServerIndex: serverIndex,
TempIndex: tempIndex, TempIndex: tempIndex,
}, },
} }
msg.header = map[string]string{"content-type": "application/json; charset=utf-8"}
accessToken, err := msg.getAccessToken() accessToken, err := msg.getAccessToken()
msg.header = map[string]string{"Authorization": accessToken, "content-type": "application/json; charset=utf-8"} msg.header = map[string]string{"Authorization": accessToken, "content-type": "application/json; charset=utf-8"}
return msg, err return msg, err
} }
/* // OACreate 发起OA审批
获取授权token func (m *MessageCenter) OACreate(dTalkUserId, treadNo string, formModel *FormsData) (data OAResponse, err error) {
AccessExpire 有效期内可缓存起来使用 formModel.FormBase = FormBase{
*/
func (m *MessageCenter) getAccessToken() (string, error) {
if tokenInterface, exist := cache.InstanceCacheMap().Get(m.ClientKey); exist {
return tokenInterface.(string), nil
}
var data accessTokenResponse
url := fmt.Sprintf("%s%s", m.Host, PathAccessToken)
var authParam, _ = json.Marshal(map[string]string{"client_key": m.ClientKey, "client_secret": m.ClientSecret})
res, err := httpclient.FastHttpPost(url, map[string]string{"content-type": "application/json; charset=utf-8"}, authParam, TimeOut)
if err != nil {
return "", err
}
err = json.Unmarshal(res, &data)
if data.Code != 0 {
return "", errors.New(data.Msg)
}
cache.InstanceCacheMap().Put(m.ClientKey, data.Data.AccessToken)
return data.Data.AccessToken, err
}
// 采购单OA审批
func (m *MessageCenter) OACreate(dTalkUserId, treadNo string, checkForm []formComponentValues) (data OACreatePurchaseResponse, err error) {
res, err := httpclient.FastHttpPost(
fmt.Sprintf("%s%s", m.Host, PathOaCreat),
m.header,
m.parseOACreateParam(dTalkUserId, treadNo, checkForm),
TimeOut)
if err != nil {
return
}
err = json.Unmarshal(res, &data)
return
}
func (m *MessageCenter) parseOACreateParam(dTalkUserId, treadNo string, checkForm []formComponentValues) (out []byte) {
req := formDataRequest{
Base: m.Base,
}
req.FormBase = FormBase{
OutTradeNo: treadNo, OutTradeNo: treadNo,
OriginatorUserId: dTalkUserId, OriginatorUserId: dTalkUserId,
} }
req.FormComponentValues = checkForm err = m.post(oaCreat, m.parseOACreateParam(formModel), &data)
out, _ = json.Marshal(req) if err != nil {
return
}
return return
} }
// OAGetDetail OA详情
func (m *MessageCenter) OAGetDetail(outTradeNo string) (data OAGetDetailData, err error) { func (m *MessageCenter) OAGetDetail(outTradeNo string) (data OAGetDetailData, err error) {
param, _ := json.Marshal(oAGetDetailRequest{ param, _ := json.Marshal(oAGetDetailRequest{
Base: m.Base, Base: m.base,
OutTradeNo: outTradeNo, OutTradeNo: outTradeNo,
}) })
res, err := httpclient.FastHttpPost(fmt.Sprintf("%s%s", m.Host, PathOaGet), m.header, param, TimeOut) err = m.post(oaGet, param, &data)
if err != nil { if err != nil {
return return
} }
// 解析响应参数 return
body := OAGetDetailResponse{}
err = json.Unmarshal(res, &body)
if err != nil {
return
}
if body.Code != 0 {
err = errors.New(body.Msg)
return
}
return body.Data, nil
} }
// 采购单OA审批 // SendSms 短信
func (m *MessageCenter) SendSms(tels []string, jsonParam string) (data SmsSendRes, err error) { func (m *MessageCenter) SendSms(tels []string, jsonParam string) (data SmsSend, err error) {
param := m.parseSmsSendParam(tels, jsonParam) param := m.parseSmsSendParam(tels, jsonParam)
res, err := httpclient.FastHttpPost( err = m.post(sendSms, param, &data)
fmt.Sprintf("%s%s", m.Host, SendSms),
m.header,
param,
TimeOut)
if err != nil { if err != nil {
return return
} }
err = json.Unmarshal(res, &data)
return return
} }
func (m *MessageCenter) parseSmsSendParam(tels []string, jsonParam string) (out []byte) { // BlackboardReceiverView struct {
out, _ = json.Marshal(SmsRequest{
Base: m.Base,
Tels: strings.Join(tels, ","),
Param: jsonParam,
})
return
}
func (m *MessageCenter) SendBlackBoard(title, content string, receiver BlackboardReceiverView) (data DefaultRes, err error) { // }
res, err := httpclient.FastHttpPost( // SendBlackBoard 钉钉公告
fmt.Sprintf("%s%s", m.Host, SendSms), // deptidList //接收部门ID列表最大的列表长度为20。
m.header, // UseridList //接收部用户ID列表最大的列表长度为20。
m.parseSendBlackBoardParam(title, content, receiver), func (m *MessageCenter) SendBlackBoard(title, content string, deptidList []int, useridList []string) (data Default, err error) {
TimeOut) receiver := blackboardReceiverView{
deptidList, useridList,
}
err = m.post(sendSms, m.parseSendBlackBoardParam(title, content, receiver), &data)
if err != nil { if err != nil {
return return
} }
err = json.Unmarshal(res, &data)
return return
} }
func (m *MessageCenter) parseSendBlackBoardParam(title, content string, receiver BlackboardReceiverView) (out []byte) { // OAComment OA评论,CommentUserId为空则默认审核发起人评论
out, _ = json.Marshal(DingTalkBlackBoardSendReq{ func (m *MessageCenter) OAComment(outTradeNo, text, commentUserId string, file *DingOACommentReqFile) (data OAResponse, err error) {
Base: m.Base, req := &oACommentRequest{
Content: content, Base: m.base,
Title: title, OutTradeNo: outTradeNo,
BlackboardReceiver: receiver, Text: text,
}) CommentUserId: commentUserId,
}
if file != nil {
req.File = *file
}
param, _ := json.Marshal(req)
err = m.post(oaComment, param, &data)
if err != nil {
return
}
return return
} }

102
paramset.go Normal file
View File

@ -0,0 +1,102 @@
package l_msg_api
import (
"encoding/json"
"fmt"
"gitea.cdlsxd.cn/self-tools/l_msg_api/cache"
"gitea.cdlsxd.cn/self-tools/l_msg_api/httpclient"
"strings"
)
func (m *MessageCenter) parseOACreateParam(formModel *FormsData) (out []byte) {
req := formDataRequest{
Base: m.base,
}
req.FormComponentValues = formModel.FormComponentValues
req.Finance = formModel.Finance
req.FormBase = formModel.FormBase
out, _ = json.Marshal(req)
return
}
func (m *MessageCenter) parseSmsSendParam(tels []string, jsonParam string) (out []byte) {
out, _ = json.Marshal(smsRequest{
Base: m.base,
Tels: strings.Join(tels, ","),
Param: jsonParam,
})
return
}
func (m *MessageCenter) parseSendBlackBoardParam(title, content string, receiver blackboardReceiverView) (out []byte) {
out, _ = json.Marshal(dingTalkBlackBoardSendReq{
Base: m.base,
Content: content,
Title: title,
BlackboardReceiver: receiver,
})
return
}
func (m *MessageCenter) getAccessToken() (string, error) {
if tokenInterface, exist := cache.InstanceCacheMap().Get(m.ClientKey); exist {
return tokenInterface.(string), nil
}
var data accessTokenResponse
var authParam, _ = json.Marshal(map[string]string{"client_key": m.ClientKey, "client_secret": m.ClientSecret})
err := m.accessPost(accessToken, authParam, &data)
if err != nil {
return "", err
}
cache.InstanceCacheMap().Put(m.ClientKey, data.AccessToken)
return data.AccessToken, err
}
func (m *MessageCenter) post(path string, data []byte, resReflect interface{}) (err error) {
var body responseBody
res, err := httpclient.FastHttpPost(fmt.Sprintf("%s%s", m.Host, path), m.header, data, timeOut)
if err != nil {
return
}
if err = json.Unmarshal(res, &body); err != nil {
return fmt.Errorf("请求失败:%s", string(res))
}
if body.Code != 0 {
return fmt.Errorf("请求失败:%s", body.Msg)
}
dataByte, err := json.Marshal(body.Data)
if err != nil {
return fmt.Errorf("未知的返回格式:%s", string(dataByte))
}
if err = json.Unmarshal(dataByte, &resReflect); err != nil {
return fmt.Errorf("未知的返回格式:%s", string(dataByte))
}
return
}
func (m *MessageCenter) accessPost(path string, data []byte, resReflect interface{}) (err error) {
var body responseBody
res, err := httpclient.FastHttpPost(fmt.Sprintf("%s%s", m.Host, path), m.header, data, timeOut)
if err != nil {
return
}
if err = json.Unmarshal(res, &body); err != nil {
return fmt.Errorf("请求失败:%s", string(res))
}
if body.Code != 0 {
return fmt.Errorf("请求失败:%s", body.Msg)
}
dataByte, err := json.Marshal(body.Data)
if err != nil {
return fmt.Errorf("未知的返回格式:%s", string(dataByte))
}
if err = json.Unmarshal(dataByte, &resReflect); err != nil {
return fmt.Errorf("未知的返回格式:%s", string(dataByte))
}
return
}

View File

@ -1,17 +1,78 @@
package test package test
import ( import (
"context"
"fmt" "fmt"
"gitea.cdlsxd.cn/self-tools/l_msg_api" "gitea.cdlsxd.cn/self-tools/l_msg_api"
"testing" "testing"
) )
func TestBase(t *testing.T) { const (
msg, err := l_msg_api.NewMessageCenter("", "", "sms", "cron_sms") ClientKey = "ymt"
ClientSecret = "ymt"
serverHost = "http://120.55.12.245:8200"
local = "http://127.0.0.1:8001"
)
func TestSms(t *testing.T) {
msg, err := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "smssass", "sasssms")
if err != nil { if err != nil {
panic(err) panic(err)
} }
res, err := msg.SendSms([]string{"15082245122"}, `{"content": "测试"}`) res, err := msg.SendSms([]string{"15082245107"}, `{"content": "测试"}`)
fmt.Println(res, err)
}
func TestOaCreate(t *testing.T) {
msg, err := l_msg_api.NewMessageCenter(local, ClientKey, ClientSecret, "sw_oa", "sw_oa_purchase")
if err != nil {
panic(err)
}
form := []l_msg_api.FormComponentValues{
{Name: "采购单号", Value: "123456789123"},
{Name: "供应商", Value: "测试供应商"},
{Name: "采购总数量", Value: "1"},
{Name: "入库仓库", Value: "测试仓库"},
{Name: "采购总金额", Value: "11.22"},
{Name: "预计到货时间", Value: "2025-03-21"},
}
res, err := msg.OACreate("17101201090101570", "cxvxvxcgfgfvxvxv", &l_msg_api.FormsData{
FormComponentValues: form,
Finance: &l_msg_api.Finance{
Amount: "11.22",
CheckUserId: "17109839571135417",
GoodsInfo: "实物系统测试商品",
PaymentAccount: "1312312321",
TaxAmount: "1",
CallbackUrl: "www.baidu.com",
Remark: "测试备注",
Sync: 1,
SystemName: "货易通",
SubjectName: "成都蓝色兄弟网络科技有限公司(0802)",
BankInfo: l_msg_api.BankInfo{
BankName: "中国银行",
BankAccount: "43243243434",
AccountBankName: "中国银行成都分行",
ResellerName: "张三",
SubjectName: "张三",
},
},
})
fmt.Println(res, err) fmt.Println(res, err)
} }
func TestOaComment(t *testing.T) {
msg, err := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "sw_oa", "sw_oa_purchase")
if err != nil {
panic(err)
}
res, err := msg.OAComment("P24110515152043136-20250318181554", "sdk测试", "", nil)
fmt.Println(res, err)
}
func TestContext(*testing.T) {
c := context.Background()
c.Done()
}