From bfdd9339e6d45fd41d2e22670a1014df8ab98285 Mon Sep 17 00:00:00 2001 From: jiangyong Date: Thu, 12 Mar 2026 20:43:21 +0800 Subject: [PATCH] media --- qyweixin/app.go | 5 +++++ qyweixin/app_approve.go | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/qyweixin/app.go b/qyweixin/app.go index ce9a3b3..8b6fff7 100644 --- a/qyweixin/app.go +++ b/qyweixin/app.go @@ -316,6 +316,11 @@ func (a *App) Upload(path, kind string) (string, error) { return cast.ToString(result["media_id"]), nil } +func (a *App) MediaUrl(mediaId string) string { + mUrl := fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token=%s&media_id=%s", a.GetToken(), mediaId) + return mUrl +} + func (q *App) GetJsapiConfig(url string) (*JsapiConfig, error) { ticket, err := q.getJsapiTicket() if err != nil { diff --git a/qyweixin/app_approve.go b/qyweixin/app_approve.go index f343a23..3b9f251 100644 --- a/qyweixin/app_approve.go +++ b/qyweixin/app_approve.go @@ -3,11 +3,12 @@ package qyweixin import ( "encoding/json" "fmt" + "strings" + "git.u8t.cn/open/gosdk/util" "git.u8t.cn/open/goutil" log "github.com/sirupsen/logrus" "github.com/spf13/cast" - "strings" ) type Applyer struct { @@ -165,9 +166,11 @@ func (d *ApproveDetail) GetData() map[string]string { } else if content.Control == "Money" { value = content.Value.NewMoney } else if content.Control == "File" { - if len(content.Value.Files) > 0 { - value = content.Value.Files[0].FileId + fileIds := make([]string, 0) + for _, v := range content.Value.Files { + fileIds = append(fileIds, v.FileId) } + value = strings.Join(fileIds, ",") } else if content.Control == "Vacation" { //请假 : 请假类型,开始时间,结束时间,请假时长 tp := content.Value.Vacation.Selector.Options[0].Value[0].Text value = tp + "," + cast.ToString(content.Value.Vacation.Attendance.DateRange.NewBegin) +