Refactor OACreate, update test server URL and add fields

This commit is contained in:
renzhiyuan 2025-04-03 10:37:50 +08:00
parent cc5b1464a4
commit e2192a040f
2 changed files with 10 additions and 5 deletions

6
msg.go
View File

@ -31,8 +31,10 @@ func NewMessageCenter(host, clientKey, clientSecret, serverIndex, tempIndex stri
// OACreate 发起OA审批
func (m *MessageCenter) OACreate(dTalkUserId, treadNo string, formModel *FormsData) (data OAResponse, err error) {
formModel.FormBase.OutTradeNo = treadNo
formModel.FormBase.OriginatorUserId = dTalkUserId
formModel.FormBase = FormBase{
OutTradeNo: treadNo,
OriginatorUserId: dTalkUserId,
}
err = m.post(oaCreat, m.parseOACreateParam(formModel), &data)
if err != nil {
return

View File

@ -10,7 +10,8 @@ import (
const (
ClientKey = "ymt"
ClientSecret = "ymt"
serverHost = "http://127.0.0.1:8001"
serverHost = "http://120.55.12.245:8200"
local = "http://127.0.0.1:8001"
)
func TestSms(t *testing.T) {
@ -25,7 +26,7 @@ func TestSms(t *testing.T) {
}
func TestOaCreate(t *testing.T) {
msg, err := l_msg_api.NewMessageCenter(serverHost, ClientKey, ClientSecret, "sw_oa", "sw_oa_purchase")
msg, err := l_msg_api.NewMessageCenter(local, ClientKey, ClientSecret, "sw_oa", "sw_oa_purchase")
if err != nil {
panic(err)
}
@ -37,7 +38,7 @@ func TestOaCreate(t *testing.T) {
{Name: "采购总金额", Value: "11.22"},
{Name: "预计到货时间", Value: "2025-03-21"},
}
res, err := msg.OACreate("17101201090101570", "123456789123bgff", &l_msg_api.FormsData{
res, err := msg.OACreate("17101201090101570", "cxvxvxcgfgfvxvxv", &l_msg_api.FormsData{
FormComponentValues: form,
Finance: &l_msg_api.Finance{
Amount: "11.22",
@ -48,6 +49,8 @@ func TestOaCreate(t *testing.T) {
CallbackUrl: "www.baidu.com",
Remark: "测试备注",
Sync: 1,
SystemName: "货易通",
SubjectName: "成都蓝色兄弟网络科技有限公司(0802)",
BankInfo: l_msg_api.BankInfo{
BankName: "中国银行",
BankAccount: "43243243434",