Merge branch 'feat-sxy-import'

This commit is contained in:
孙肖扬 2025-08-13 09:17:03 +08:00
commit 7488f76c08
10 changed files with 1685 additions and 721 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1066,6 +1066,8 @@ func (m *UpdateWorkImageReq) validate(all bool) error {
// no validation rules for ArtistPhoneAreaCode
// no validation rules for Source
if len(errors) > 0 {
return UpdateWorkImageReqMultiError(errors)
}
@ -1491,6 +1493,8 @@ func (m *UpdateWorkVideoReq) validate(all bool) error {
// no validation rules for ArtistPhoneAreaCode
// no validation rules for Source
if len(errors) > 0 {
return UpdateWorkVideoReqMultiError(errors)
}

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.21.1
// - protoc v6.32.0--rc2
// source: pb/fiee/cast.proto
package cast

31
go.mod
View File

@ -1,8 +1,8 @@
module fonchain-fiee
go 1.21.3
go 1.23.0
toolchain go1.23.6
toolchain go1.23.10
replace (
//github.com/fonchain_enterprise/utils/objstorage => ../../tyfon-/utils/objstorage
@ -89,10 +89,10 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.21.0
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/crypto v0.38.0 // indirect
golang.org/x/net v0.40.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.25.0 // indirect
google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 // indirect
google.golang.org/grpc v1.47.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
@ -109,12 +109,16 @@ require (
github.com/fonchain_enterprise/utils/objstorage v0.0.0-00010101000000-000000000000
github.com/gin-contrib/pprof v1.4.0
github.com/go-redis/redis v6.15.9+incompatible
github.com/mholt/archiver v3.1.1+incompatible
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd
github.com/signintech/gopdf v0.29.2
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/spf13/viper v1.7.1
github.com/tealeg/xlsx v1.0.5
github.com/u2takey/ffmpeg-go v0.5.0
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69
github.com/xuri/excelize/v2 v2.9.1
golang.org/x/image v0.25.0
)
require (
@ -134,6 +138,7 @@ require (
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/dorlolo/simpleRequest v1.2.7 // indirect
github.com/dsnet/compress v0.0.1 // indirect
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
github.com/emicklei/go-restful/v3 v3.7.4 // indirect
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect
@ -157,13 +162,15 @@ require (
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
github.com/nwaples/rardecode v1.1.3 // indirect
github.com/nxadm/tail v1.4.11 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.18.1 // indirect
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 // indirect
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
github.com/polarismesh/polaris-go v1.1.0 // indirect
github.com/richardlehane/mscfb v1.0.4 // indirect
github.com/richardlehane/msoleps v1.0.4 // indirect
github.com/shirou/gopsutil/v3 v3.21.6 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/smartystreets/assertions v1.1.1 // indirect
@ -173,11 +180,15 @@ require (
github.com/spf13/jwalterweatherman v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tealeg/xlsx v1.0.5 // indirect
github.com/tiendc/go-deepcopy v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.6 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/u2takey/go-utils v0.3.1 // indirect
github.com/ulikunitz/xz v0.5.12 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/xuri/efp v0.0.1 // indirect
github.com/xuri/nfp v0.0.1 // indirect
github.com/zouyx/agollo/v3 v3.4.5 // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
@ -186,7 +197,7 @@ require (
go.opentelemetry.io/otel/trace v1.7.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sync v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect

54
go.sum
View File

@ -190,6 +190,9 @@ github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/dorlolo/simpleRequest v1.2.7 h1:I6AlEhMBSZPNQ4QjpCevhpxsPRDa3lgDOxJYYfmPTU8=
github.com/dorlolo/simpleRequest v1.2.7/go.mod h1:koVT8DQu+JK40UoMNBQjt+zomlCW8FqE0ffEzjTOWYY=
github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q=
github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo=
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
github.com/dubbogo/go-zookeeper v1.0.3/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 h1:XoR8SSVziXe698dt4uZYDfsmHpKLemqAgFyndQsq5Kw=
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
@ -537,6 +540,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
@ -587,6 +592,8 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mholt/archiver v3.1.1+incompatible h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU=
github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
@ -641,6 +648,8 @@ github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk=
github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc=
github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
@ -751,6 +760,11 @@ github.com/prometheus/statsd_exporter v0.21.0/go.mod h1:rbT83sZq2V+p73lHhPZfMc3M
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM=
github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/richardlehane/msoleps v1.0.4 h1:WuESlvhX3gH2IHcd8UqyCuFY5yiq/GR/yqaSM/9/g00=
github.com/richardlehane/msoleps v1.0.4/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
@ -833,8 +847,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
@ -842,6 +857,8 @@ github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCn
github.com/tebeka/strftime v0.1.3/go.mod h1:7wJm3dZlpr4l/oVK0t1HYIc4rMzQ2XJlOMIUJUJH6XQ=
github.com/tevid/gohamcrest v1.1.1 h1:ou+xSqlIw1xfGTg1uq1nif/htZ2S3EzRqLm2BP+tYU0=
github.com/tevid/gohamcrest v1.1.1/go.mod h1:3UvtWlqm8j5JbwYZh80D/PVBt0mJ1eJiYgZMibh0H/k=
github.com/tiendc/go-deepcopy v1.6.0 h1:0UtfV/imoCwlLxVsyfUd4hNHnB3drXsfle+wzSCA5Wo=
github.com/tiendc/go-deepcopy v1.6.0/go.mod h1:toXoeQoUqXOOS/X4sKuiAoSk6elIdqc0pN7MTgOOo2I=
github.com/tklauser/go-sysconf v0.3.6 h1:oc1sJWvKkmvIxhDHeKWvZS4f6AW+YcoguSfRF2/Hmo4=
github.com/tklauser/go-sysconf v0.3.6/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI=
github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA=
@ -871,10 +888,21 @@ github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxW
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo=
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xuri/efp v0.0.1 h1:fws5Rv3myXyYni8uwj2qKjVaRP30PdjeYe2Y6FDsCL8=
github.com/xuri/efp v0.0.1/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
github.com/xuri/excelize/v2 v2.9.1 h1:VdSGk+rraGmgLHGFaGG9/9IWu1nj4ufjJ7uwMDtj8Qw=
github.com/xuri/excelize/v2 v2.9.1/go.mod h1:x7L6pKz2dvo9ejrRuD8Lnl98z4JLt0TGAwjhW+EiP8s=
github.com/xuri/nfp v0.0.1 h1:MDamSGatIvp8uOmDP8FnmjuQpu90NzdJxo7242ANR9Q=
github.com/xuri/nfp v0.0.1/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@ -960,8 +988,8 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -980,8 +1008,8 @@ golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86h
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69 h1:Lj6HJGCSn5AjxRAH2+r35Mir4icalbqku+CLUtjnvXY=
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY=
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@ -1055,8 +1083,8 @@ golang.org/x/net v0.0.0-20211105192438-b53810dc28af/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -1077,8 +1105,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -1157,8 +1185,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@ -1172,8 +1200,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

View File

@ -9,6 +9,7 @@ import (
"fonchain-fiee/pkg/service/auth"
"fonchain-fiee/pkg/service/file"
"fonchain-fiee/pkg/service/governance"
imports "fonchain-fiee/pkg/service/import"
"fonchain-fiee/pkg/service/lang"
"fonchain-fiee/pkg/service/pressreleases"
"fonchain-fiee/pkg/service/qr"
@ -184,6 +185,13 @@ func NewRouter() *gin.Engine {
pressreleasesRouteLogin.POST("/delete", pressreleases.Delete)
}
{
importRoute := v1.Group("/import")
importRoute.Use(middleware.CheckWebLogin(service.AccountProvider))
importRoute.POST("data/bind", imports.ImportBind)
importRoute.POST("data/publish", imports.ImportPublish)
importRoute.POST("data/confirm", imports.WorkConfirm)
}
//静态文件
r.StaticFS("/api/static", http.Dir("./runtime"))
r.NoRoute(func(c *gin.Context) {

View File

@ -0,0 +1,80 @@
package imports
import (
apiCast "fonchain-fiee/api/cast"
)
type ArtistAccount struct {
Name string `json:"name"`
Account map[apiCast.PlatformIDENUM]string `json:"account"`
}
type ArtistMedia struct {
Id string `json:"id"`
Name string `json:"name"`
Title string `json:"title"`
Img string `json:"img"`
Video string `json:"video"`
Youtube string `json:"youtube"`
Instagram string `json:"instagram"`
TikTok string `json:"tiktok"`
}
type FailedRecord struct {
Name string `json:"name"`
Msg string `json:"msg"`
}
type ArtistVideoDetail struct {
Id string `json:"id"`
ArtistName string `json:"artistName"`
Title string `json:"title"`
WorkUuid string `json:"workUuid"`
Youtube string `json:"youtube"`
Instagram string `json:"instagram"`
TikTok string `json:"tiktok"`
}
type CreateRequest struct {
Type string `json:"Type"`
DepartmentID int64 `json:"DepartmentID"`
Domain string `json:"Domain"`
MenuType int32 `json:"menuType"`
SaasPublishVideo *SaasPublishVideo `json:"SaasPublishVideo"`
}
type SaasPublishVideo struct {
Title string `json:"Title"`
Describe string `json:"Describe"`
IsYoutubeSee int32 `json:"IsYoutubeSee"`
IsTiktokScreen int32 `json:"IsTiktokScreen"`
IsTiktokComment int32 `json:"IsTiktokComment"`
IsTiktokQuote int32 `json:"IsTiktokQuote"`
IsTiktokAiGenerate int32 `json:"IsTiktokAiGenerate"`
Cover string `json:"Cover"`
PlatformIds []int32 `json:"PlatformIds"`
PublishAccounts []PublishAccount `json:"PublishAccounts"`
Videos []Video `json:"Videos"`
}
type PublishAccount struct {
AccountName string `json:"AccountName"`
AccountID string `json:"AccountID"`
}
type Video struct {
VideoAddress string `json:"VideoAddress"`
VideoThumbnail string `json:"VideoThumbnail"`
}
type APIResponse struct {
Status int `json:"status"`
Data ApprovalResponse `json:"data"`
Msg string `json:"msg"`
Code int `json:"code"`
Error interface{} `json:"error"`
Err string `json:"err"`
Keys []string `json:"keys"`
Positions interface{} `json:"positions"`
}
type ApprovalResponse struct {
ID uint64 `json:"ID"`
Success bool `json:"Success"`
}

View File

@ -0,0 +1,199 @@
package imports
import (
"context"
"errors"
"fmt"
"fonchain-fiee/api/accountFiee"
account "fonchain-fiee/api/accountFiee"
"fonchain-fiee/api/bundle"
apiCast "fonchain-fiee/api/cast"
"fonchain-fiee/cmd/config"
"fonchain-fiee/pkg/e"
modelCast "fonchain-fiee/pkg/model/cast"
"fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/cast"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"github.com/gin-gonic/gin"
"github.com/xuri/excelize/v2"
)
type artu struct {
}
func ImportBind(c *gin.Context) {
var failedRecords []FailedRecord
// 1. 上传文件
excelFile, err := c.FormFile("excel")
if err != nil {
c.JSON(400, gin.H{"error": "缺少 Excel 文件 excel"})
return
}
// 2. 保存临时文件
tempDir := "tmp"
os.MkdirAll(tempDir, 0755)
excelPath := filepath.Join(tempDir, "artists.xlsx")
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
c.JSON(500, gin.H{"error": "保存 Excel 失败"})
return
}
defer os.RemoveAll(tempDir)
// 3. 读取 Excel 画家名单
artists, err := readArtistAccountInfo(excelPath)
if err != nil {
c.JSON(500, gin.H{"error": "读取 Excel 失败"})
return
}
// 4. 绑定账号
for _, artist := range artists {
for accountType, accountInfo := range artist.Account {
if artist.Name == "韩风霞" || artist.Name == "荣小松" {
if accountType == 2 {
continue
}
}
res, err := service.AccountFieeProvider.UserList(context.Background(), &account.UserListRequest{
Name: artist.Name,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue
}
if res != nil && len(res.UserList) > 0 {
var infoResp *account.UserInfoResponse
var err error
// 查询艺人的信息
if config.AppConfig.System.AppMode != "dev" {
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
ID: res.UserList[0].Id,
Domain: "app",
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("查询艺人的信息失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("查询艺人的信息失败: %s", err.Error()))
continue
}
} else {
infoResp = &accountFiee.UserInfoResponse{
Name: "小波",
TelNum: "18288888888",
}
}
if _, ok := apiCast.PlatformIDENUM_name[int32(accountType)]; !ok {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: errors.New("查询平台信息失败:").Error(),
})
log.Printf(errors.New("查询平台信息失败:").Error())
continue
}
if err = cast.CheckUserBundleBalance(int32(res.UserList[0].Id), modelCast.BalanceTypeAccountValue); err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("查询检查用户账户数量失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("查询检查用户账户数量失败: %s", err.Error()))
continue
}
_, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
UserId: int32(res.UserList[0].Id),
AccountConsumptionNumber: 1,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("增加账户数量失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("增加账户数量失败: %s", err.Error()))
continue
}
_, err = service.CastProvider.UpdateMediaAccount(c, &apiCast.UpdateMediaAccountReq{
ArtistUuid: strconv.FormatUint(res.UserList[0].Id, 10),
PlatformID: accountType,
PlatformUserName: artist.Name,
PlatformUserID: accountInfo,
ArtistName: infoResp.Name,
ArtistPhone: infoResp.TelNum,
ArtistPhoneAreaCode: infoResp.TelAreaCode,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("绑定账户信息失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("绑定账户信息失败: %s", err.Error()))
_, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
UserId: int32(res.UserList[0].Id),
AccountConsumptionNumber: -1,
})
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("绑定失败后减少余额失败: %s", err.Error()),
})
log.Println(fmt.Sprintf("绑定失败后减少余额失败: %s", err.Error()), errors.New(e.GetMsg(e.InvalidParams)))
continue
}
}
}
}
// 5. 返回结果
service.Success(c, failedRecords)
}
func readArtistAccountInfo(excelPath string) ([]ArtistAccount, error) {
f, err := excelize.OpenFile(excelPath)
if err != nil {
return nil, err
}
defer f.Close()
sheetName := f.GetSheetName(0)
rows, err := f.GetRows(sheetName)
if err != nil {
return nil, err
}
log.Println("start read excel...")
var artists []ArtistAccount
for i, row := range rows {
if i == 0 || len(row) < 2 {
continue
}
if i == 58 {
break
}
tmp := ArtistAccount{
Account: make(map[apiCast.PlatformIDENUM]string),
Name: strings.TrimSpace(row[1]),
}
youtube, _ := f.GetCellValue(sheetName, fmt.Sprintf("C%d", i+1))
if youtube != "" {
tmp.Account[2] = strings.TrimSpace(youtube)
}
ins, _ := f.GetCellValue(sheetName, fmt.Sprintf("D%d", i+1))
if ins != "" {
tmp.Account[3] = strings.TrimSpace(ins)
}
tiktok, _ := f.GetCellValue(sheetName, fmt.Sprintf("E%d", i+1))
if tiktok != "" {
tmp.Account[1] = strings.TrimSpace(tiktok)
}
artists = append(artists, tmp)
}
return artists, nil
}

View File

@ -0,0 +1,78 @@
package imports
import (
"context"
"errors"
"fmt"
account "fonchain-fiee/api/accountFiee"
"fonchain-fiee/api/bundle"
apiCast "fonchain-fiee/api/cast"
"fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/cast"
"log"
"github.com/gin-gonic/gin"
)
func WorkConfirm(c *gin.Context) { // 确认作品并扣除余量
newCtx := cast.NewCtxWithUserInfo(c)
list, err := service.CastProvider.WorkList(newCtx, &apiCast.WorkListReq{
WorkStatus: 4,
Page: 1,
PageSize: 999,
})
if err != nil {
service.Error(c, err)
return
}
if len(list.Data) == 0 {
service.Error(c, errors.New("没有待确认的作品"))
return
}
//遍历更新状态
var failedRecords []FailedRecord
for _, v := range list.Data {
res, err := service.AccountFieeProvider.UserList(context.Background(), &account.UserListRequest{
Name: v.ArtistName,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: v.ArtistName,
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue
}
var artistId uint64
if res != nil && len(res.UserList) > 0 {
artistId = res.UserList[0].Id
}
_, err = service.BundleProvider.AddBundleBalance(c, &bundle.AddBundleBalanceReq{
UserId: int32(artistId),
VideoConsumptionNumber: 1,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: v.ArtistName,
Msg: fmt.Sprintf("扣除余额失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("扣除余额失败: %s", err.Error()))
continue
}
_, err = service.CastProvider.UpdateStatus(c, &apiCast.UpdateStatusReq{
WorkAction: apiCast.WorkActionENUM_CONFIRM,
WorkUuid: v.WorkUuid,
ConfirmRemark: "",
ConfirmStatus: 1,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: v.ArtistName,
Msg: fmt.Sprintf("更新状态失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("更新状态失败: %s", err.Error()))
continue
}
}
service.Success(c, failedRecords)
}

View File

@ -0,0 +1,539 @@
package imports
import (
"bytes"
"context"
"encoding/json"
"fmt"
"fonchain-fiee/api/accountFiee"
"fonchain-fiee/api/bundle"
apiCast "fonchain-fiee/api/cast"
"fonchain-fiee/api/files"
"fonchain-fiee/pkg/config"
"fonchain-fiee/pkg/model"
modelCast "fonchain-fiee/pkg/model/cast"
"fonchain-fiee/pkg/service"
"fonchain-fiee/pkg/service/cast"
"fonchain-fiee/pkg/service/upload"
"io"
"log"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
"github.com/mholt/archiver"
"github.com/xuri/excelize/v2"
)
func ImportPublish(c *gin.Context) {
// 1. 上传画家短视频详情文件
excelFile, err := c.FormFile("excel")
if err != nil {
c.JSON(400, gin.H{"error": "缺少 Excel 文件 excel"})
return
}
zipFile, err := c.FormFile("zip")
if err != nil {
c.JSON(400, gin.H{"error": "缺少 ZIP 文件"})
return
}
// 2. 保存临时文件
tempDir := "tmp"
os.MkdirAll(tempDir, 0755)
excelPath := filepath.Join(tempDir, "artists.xlsx")
zipPath := filepath.Join(tempDir, "archive.zip")
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
c.JSON(500, gin.H{"error": "保存 Excel 失败"})
return
}
if err = c.SaveUploadedFile(zipFile, zipPath); err != nil {
c.JSON(500, gin.H{"error": "保存 ZIP 文件失败"})
return
}
// 3. 解压 ZIP
unzipPath := filepath.Join(tempDir, "unzipped")
if _, err = os.Stat(unzipPath); err == nil {
// 路径已存在,删除
if removeErr := os.RemoveAll(unzipPath); removeErr != nil {
c.JSON(500, gin.H{"error": "清理已存在解压目录失败: " + removeErr.Error()})
return
}
}
os.MkdirAll(unzipPath, 0755)
if err = archiver.Unarchive(zipPath, unzipPath); err != nil {
c.JSON(500, gin.H{"error": "解压 ZIP 失败: " + err.Error()})
return
}
entries, err := os.ReadDir(unzipPath)
if err != nil || len(entries) == 0 {
c.JSON(500, gin.H{"error": "读取解压目录失败或目录为空"})
return
}
if len(entries) == 1 && entries[0].IsDir() {
// 说明解压后多了一层目录,把它设为新的 unzipPath
unzipPath = filepath.Join(unzipPath, entries[0].Name())
}
defer os.RemoveAll(tempDir)
// 4. 读取 Excel 画家名单, 匹配视频和图片
artists, err := readArtistVideoInfo(excelPath, unzipPath)
if err != nil {
c.JSON(500, gin.H{"error": "读取 Excel 失败"})
return
}
// 5.发布视频
var failedRecords []FailedRecord
var artistResp []ArtistVideoDetail
for _, artist := range artists {
var infoResp *accountFiee.UserInfoResponse
var err error
list, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
Name: artist.Name,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue
}
if list != nil && len(list.UserList) > 0 {
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
ID: list.UserList[0].Id,
Domain: "app",
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
continue
}
}
if err = cast.CheckUserBundleBalance(int32(list.UserList[0].Id), modelCast.BalanceTypeVideoValue); err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()),
})
log.Printf(fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()))
continue
}
//自媒体账号
accountList, err := service.CastProvider.MediaUserList(c, &apiCast.MediaUserListReq{
//ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
ArtistVal: artist.Name,
Page: 1,
PageSize: 10,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)),
})
log.Printf(fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)))
continue
}
if accountList == nil || len(accountList.Data) == 0 {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: "自媒体账号数量为0",
})
log.Printf(fmt.Sprintf("自媒体账号,账号数量:%d", len(accountList.Data)))
continue
}
mediaAccountUuids := []string{}
mediaAccountNames := []string{}
platformIDs := []apiCast.PlatformIDENUM{}
for _, info := range accountList.Data {
if info.PlatformID == 2 && ((artist.Id == "31" && info.ArtistName == "荣小松") ||
(artist.Id == "72" && info.ArtistName == "韩风霞")) {
continue // 跳过
}
mediaAccountUuids = append(mediaAccountUuids, info.MediaAccountUuid)
mediaAccountNames = append(mediaAccountNames, info.PlatformUserName)
platformIDs = append(platformIDs, apiCast.PlatformIDENUM(info.PlatformID))
}
newCtx := cast.NewCtxWithUserInfo(c)
resp, err := service.CastProvider.UpdateWorkVideo(newCtx, &apiCast.UpdateWorkVideoReq{
Title: artist.Title,
Content: artist.Title,
VideoUrl: artist.Video,
CoverUrl: artist.Img,
MediaAccountUuids: mediaAccountUuids,
MediaAccountNames: mediaAccountNames,
PlatformIDs: platformIDs,
PublishConfig1: &apiCast.PublishConfig{
CanComment: 1,
CanJoin: 1,
CanQuote: 1,
ForbidComment: 2,
IsAI: 1,
PublicType: 1,
},
PublishConfig2: &apiCast.PublishConfig{
CanComment: 1,
CanJoin: 1,
CanQuote: 1,
ForbidComment: 2,
IsAI: 1,
PublicType: 1,
},
PublishConfig3: &apiCast.PublishConfig{
CanComment: 1,
CanJoin: 1,
CanQuote: 1,
ForbidComment: 1,
IsAI: 1,
PublicType: 1,
},
Action: "submit",
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
ArtistName: infoResp.Name,
ArtistPhone: infoResp.TelNum,
ArtistPhoneAreaCode: infoResp.TelAreaCode,
Source: 2,
})
if err != nil {
failedRecords = append(failedRecords, FailedRecord{
Name: artist.Name,
Msg: fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()),
})
log.Printf(fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()))
continue
}
artistResp = append(artistResp, ArtistVideoDetail{
Id: artist.Id,
ArtistName: artist.Name,
Title: artist.Title,
WorkUuid: resp.WorkUuid,
Youtube: artist.Youtube,
Instagram: artist.Instagram,
TikTok: artist.TikTok,
})
}
excelUrl, err := exportRecordsToExcel(artistResp)
if err != nil {
service.Error(c, err)
return
}
// 6. 返回结果
service.Success(c, map[string]interface{}{
"excelUrl": excelUrl,
"failedRecords": failedRecords,
})
}
func readArtistVideoInfo(excelPath, unzipPath string) ([]ArtistMedia, error) {
log.Println(unzipPath)
f, err := excelize.OpenFile(excelPath)
if err != nil {
return nil, err
}
defer f.Close()
sheetName := f.GetSheetName(0)
rows, err := f.GetRows(sheetName)
if err != nil {
return nil, err
}
log.Println("start read excel")
var artists []ArtistMedia
for i, row := range rows {
if i == 0 || i == 1 || len(row) < 2 {
continue
}
if i == 165 {
break
}
id, _ := f.GetCellValue(sheetName, fmt.Sprintf("A%d", i+1))
if id != "" {
id = strings.TrimSpace(id)
}
artistName, _ := f.GetCellValue(sheetName, fmt.Sprintf("B%d", i+1))
if artistName != "" {
artistName = strings.TrimSpace(artistName)
}
title, _ := f.GetCellValue(sheetName, fmt.Sprintf("C%d", i+1))
if title != "" {
title = strings.TrimSpace(title)
}
youtube, _ := f.GetCellValue(sheetName, fmt.Sprintf("D%d", i+1))
if youtube != "" {
youtube = strings.TrimSpace(youtube)
}
instagram, _ := f.GetCellValue(sheetName, fmt.Sprintf("E%d", i+1))
if instagram != "" {
instagram = strings.TrimSpace(instagram)
}
tiktok, _ := f.GetCellValue(sheetName, fmt.Sprintf("F%d", i+1))
if tiktok != "" {
tiktok = strings.TrimSpace(tiktok)
}
artists = append(artists, ArtistMedia{
Id: id,
Name: artistName,
Title: title,
Youtube: youtube,
Instagram: instagram,
TikTok: tiktok,
})
}
artists, err = matchArtistMedia(artists, unzipPath)
return artists, nil
}
func matchArtistMedia(artists []ArtistMedia, unzipPath string) ([]ArtistMedia, error) {
var err error
var res []ArtistMedia
for _, artist := range artists {
oldImgPath := fmt.Sprintf("%s/%s/%s.jpg", unzipPath, artist.Name, artist.Id)
oldVideoPath := fmt.Sprintf("%s/%s/%s.mp4", unzipPath, artist.Name, artist.Id)
// 检查源文件是否存在
if _, err = os.Stat(oldImgPath); os.IsNotExist(err) {
continue
}
if _, err = os.Stat(oldVideoPath); os.IsNotExist(err) {
continue
}
baseDir := filepath.Join(unzipPath, artist.Name)
if err = os.MkdirAll(baseDir, 0755); err != nil {
log.Println("创建目录失败:", err)
return nil, err
}
log.Println("创建目录成功:", baseDir)
// 重命名
now := time.Now().Unix()
imgPath := fmt.Sprintf("%s/%s/%s_%d.jpg", unzipPath, artist.Name, artist.Id, now)
videoPath := fmt.Sprintf("%s/%s/%s_%d.mp4", unzipPath, artist.Name, artist.Id, now)
if err = os.Rename(oldImgPath, imgPath); err != nil {
log.Println("图片:"+oldImgPath+"重命名失败:", err)
return nil, err
}
if err = os.Rename(oldVideoPath, videoPath); err != nil {
log.Println("视频:"+oldVideoPath+"重命名失败:", err)
return nil, err
}
//转为url
content, err := os.ReadFile(videoPath)
if err != nil {
return nil, err
}
if err = UploadToAnotherService(context.Background(), content, filepath.Base(videoPath)); err != nil {
log.Println("上传视频失败:", err)
return nil, err
}
var httpType string
if config.AppMode == "prod" {
url := "saas.fiee.com"
httpType = fmt.Sprintf("%s%s", model.HttpsType, url)
} else {
url := "114.218.158.24:9020"
httpType = fmt.Sprintf("%s%s", model.HttpType, url)
}
baseUrl := fmt.Sprintf("%s/api/fiee/resource/raw/", httpType)
videoUrl := baseUrl + filepath.Base(videoPath)
imgUrl, err := upload.PutBos(filepath.ToSlash(imgPath), "image", false)
if err != nil {
log.Println("上传图片失败:", err)
return nil, err
}
tmp := artist
tmp.Id = artist.Id
tmp.Name = artist.Name
tmp.Title = artist.Title
tmp.Img = imgUrl
//tmp.Video = filepath.ToSlash(videoPath)
tmp.Video = videoUrl
res = append(res, tmp)
}
return res, nil
}
func UploadToAnotherService(ctx context.Context, fileData []byte, path string) error {
const chunkSize = 4*1024*1024 - 100
_, err := service.FilesProvider.TusCreate(ctx, &files.TusCreateReq{
Path: path,
UserSpacePath: "",
Override: true,
})
if err != nil {
return err
}
log.Println("create success ......**********")
offset := int64(0)
totalSize := int64(len(fileData))
for offset < totalSize {
end := offset + chunkSize
if end > totalSize {
end = totalSize
}
chunk := fileData[offset:end]
_, err = service.FilesProvider.TusUpload(ctx, &files.TusUploadReq{
Path: path,
UploadOffset: offset,
Content: chunk,
UserSpacePath: "",
})
if err != nil {
return fmt.Errorf("上传 offset=%d chunk 失败: %w", offset, err)
}
log.Printf("upload chunk: %d - %d success\n", offset, end)
offset = end
}
return nil
}
func exportRecordsToExcel(artistInfos []ArtistVideoDetail) (string, error) {
f := excelize.NewFile()
sheet := "Sheet1"
f.NewSheet(sheet)
// 写表头
headers := []string{"序号", "画家名", "标题", "uuid", "youtube", "instagram", "tiktok"}
for col, h := range headers {
_ = f.SetCellValue(sheet, string(rune('A'+col))+"1", h)
}
// 写数据
for i, artistInfo := range artistInfos {
row := i + 2
_ = f.SetCellValue(sheet, "A"+strconv.Itoa(row), artistInfo.Id)
_ = f.SetCellValue(sheet, "B"+strconv.Itoa(row), artistInfo.ArtistName)
_ = f.SetCellValue(sheet, "C"+strconv.Itoa(row), artistInfo.Title)
_ = f.SetCellValue(sheet, "D"+strconv.Itoa(row), artistInfo.WorkUuid)
_ = f.SetCellValue(sheet, "E"+strconv.Itoa(row), artistInfo.Youtube)
_ = f.SetCellValue(sheet, "F"+strconv.Itoa(row), artistInfo.Instagram)
_ = f.SetCellValue(sheet, "G"+strconv.Itoa(row), artistInfo.TikTok)
}
// 保存文件
filename := "画家视频详情记录.xlsx"
fileDir := "./runtime/import/" // 自定义目录
_ = os.MkdirAll(fileDir, os.ModePerm)
filePath := filepath.Join(fileDir, filename)
if err := f.SaveAs(filePath); err != nil {
return "", err
}
excelUrl, err := upload.PutBos(filePath, "excel", true)
if err != nil {
return "", err
}
return excelUrl, nil
}
func updateApproval(ctx *gin.Context, artistId uint64, workUuid string, accountInfos []*apiCast.MediaUserInfo, videoUrl, imgUrl, title string) error {
var publishAccounts []PublishAccount
var publishPlatformIds []int32
for _, v := range accountInfos {
publishAccounts = append(publishAccounts, PublishAccount{
AccountName: v.PlatformUserName,
AccountID: v.MediaAccountUuid,
})
publishPlatformIds = append(publishPlatformIds, int32(v.PlatformID))
}
var req CreateRequest
var url string
saasPublishVideo := &SaasPublishVideo{
Title: title,
Describe: title,
IsYoutubeSee: 1,
IsTiktokScreen: 1,
IsTiktokComment: 1,
IsTiktokQuote: 1,
IsTiktokAiGenerate: 1,
Cover: imgUrl,
PlatformIds: publishPlatformIds,
PublishAccounts: publishAccounts,
Videos: []Video{
{
VideoAddress: videoUrl,
VideoThumbnail: imgUrl,
},
},
}
if config.AppMode == "prod" {
url = "https://erp.fonchain.com/approval/v2/create"
req = CreateRequest{
Type: "SaasPublishVideo",
DepartmentID: 3,
Domain: "7bfa3942cceb20389822af7b57c5798e",
MenuType: 2,
SaasPublishVideo: saasPublishVideo,
}
} else {
url = "http://114.218.158.24:9020/approval/v2/create"
req = CreateRequest{
Type: "SaasPublishVideo",
DepartmentID: 3,
Domain: "7bfa3942cceb20389822af7b57c5798e",
MenuType: 2,
SaasPublishVideo: saasPublishVideo,
}
}
jsonBytes, err := json.Marshal(req)
if err != nil {
return err
}
res, err := http.Post(url, "application/json", bytes.NewBuffer(jsonBytes))
if err != nil {
return err
}
defer res.Body.Close()
responseBodyBytes, err := io.ReadAll(res.Body)
if err != nil {
return err
}
var apiResp APIResponse
err = json.Unmarshal(responseBodyBytes, &apiResp)
if err != nil {
// 处理错误
return err
}
fmt.Println("拿到审批ID:", apiResp.Data.ID)
_, err = service.CastProvider.UpdateStatus(ctx, &apiCast.UpdateStatusReq{
WorkUuid: workUuid,
WorkAction: apiCast.WorkActionENUM_APPROVAL,
ApprovalID: strconv.FormatUint(apiResp.Data.ID, 10),
})
if err != nil {
return err
}
_, err = service.CastProvider.UpdateStatus(ctx, &apiCast.UpdateStatusReq{
WorkUuid: workUuid,
WorkAction: apiCast.WorkActionENUM_APPROVAL_PASS,
ApprovalID: strconv.FormatUint(apiResp.Data.ID, 10),
})
if err != nil {
return err
}
_, err = service.BundleProvider.AddBundleBalance(ctx, &bundle.AddBundleBalanceReq{
UserId: int32(artistId),
VideoConsumptionNumber: 1,
})
if err != nil {
log.Printf(fmt.Sprintf("扣除余额失败: %s", err.Error()))
return err
}
_, err = service.CastProvider.UpdateStatus(ctx, &apiCast.UpdateStatusReq{
WorkAction: apiCast.WorkActionENUM_CONFIRM,
WorkUuid: workUuid,
ConfirmRemark: "",
ConfirmStatus: 1,
})
if err != nil {
log.Printf(fmt.Sprintf("更新状态失败: %s", err.Error()))
return err
}
return nil
}