From dac74d1a31da861730dc691f2ed491060f5daf9e Mon Sep 17 00:00:00 2001 From: jiangyong Date: Wed, 20 Aug 2025 11:29:20 +0800 Subject: [PATCH] getdata applay --- go.mod | 59 +++++++++++++++++++++++++++++++++++++++++ qyweixin/app_approve.go | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/go.mod b/go.mod index e3f36f1..c28ca18 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,62 @@ module git.u8t.cn/open/gosdk go 1.24 + +require ( + github.com/bradfitz/gomemcache v0.0.0-20250403215159-8d39553ac7cf + github.com/eclipse/paho.mqtt.golang v1.5.0 + github.com/gin-gonic/gin v1.10.1 + github.com/gomodule/redigo v1.9.2 + github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c + github.com/minio/minio-go v6.0.14+incompatible + github.com/qiniu/go-sdk/v7 v7.25.4 + github.com/sirupsen/logrus v1.9.3 + github.com/smbrave/goutil v0.0.0-20250409122131-41cca9439387 + github.com/spf13/cast v1.9.2 + github.com/tidwall/gjson v1.18.0 + github.com/wechatpay-apiv3/wechatpay-go v0.2.21 + golang.org/x/crypto v0.41.0 + gorm.io/gorm v1.30.1 +) + +require ( + github.com/BurntSushi/toml v1.3.2 // indirect + github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82 // indirect + github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gammazero/toposort v0.1.1 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-ini/ini v1.67.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/gofrs/flock v0.8.1 // indirect + github.com/gorilla/websocket v1.5.3 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/speps/go-hashids v2.0.0+incompatible // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + golang.org/x/arch v0.8.0 // indirect + golang.org/x/net v0.42.0 // indirect + golang.org/x/sync v0.16.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.28.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + modernc.org/fileutil v1.0.0 // indirect +) diff --git a/qyweixin/app_approve.go b/qyweixin/app_approve.go index d853c8d..48af83f 100644 --- a/qyweixin/app_approve.go +++ b/qyweixin/app_approve.go @@ -139,6 +139,52 @@ func (d *ApproveDetail) GetValue(title string) string { return "" } +func (d *ApproveDetail) GetData() map[string]string { + data := make(map[string]string) + for _, content := range d.ApplyData.Contents { + + var value string + if content.Control == "Selector" { + for _, v := range content.Value.Selector.Options[0].Value { + if v.Text != "" { + value = v.Text + } + } + } else if content.Control == "Text" || content.Control == "Textarea" { + value = content.Value.Text + } else if content.Control == "Date" { + value = content.Value.Date.Timestamp + } else if content.Control == "Money" { + value = content.Value.NewMoney + } else if content.Control == "File" { + value = content.Value.Files[0].FileId + } 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) + + "," + cast.ToString(content.Value.Vacation.Attendance.DateRange.NewEnd) + + "," + cast.ToString(content.Value.Vacation.Attendance.DateRange.NewDuration) + } else if content.Control == "PunchCorrection" { //补卡:日期,时间,状态 + mp := cast.ToStringMap(content.Value.PunchCorrection) + ddate := cast.ToString(mp["daymonthyear"]) + dtime := cast.ToString(mp["time"]) + if ddate == "" { + ddate = dtime + } + value = ddate + "," + dtime + "," + cast.ToString(mp["state"]) + } else if content.Control == "BankAccount" { + mp := cast.ToStringMap(content.Value.BankAccount) + value = cast.ToString(mp["account_type"]) + "," + cast.ToString(mp["account_name"]) + "," + cast.ToString(mp["account_number"]) + } + + for _, ti := range content.Title { + if ti.Lang == "zh_CN" { + data[ti.Text] = value + } + } + } + return data +} + func (d *ApproveDetail) String() string { return goutil.EncodeJSONIndent(d) }