Compare commits
213 Commits
main
...
dev-lzh-09
Author | SHA1 | Date | |
---|---|---|---|
4897fbe098 | |||
1ed1085d0f | |||
4939c916ef | |||
78d1935065 | |||
1ba0cce450 | |||
37fa991a9f | |||
8b6b184863 | |||
c4affb238c | |||
c69a5d8c14 | |||
8bdc5982df | |||
53bf31865a | |||
fc7c88c85f | |||
9e4fb0543c | |||
f4d6345707 | |||
12301aef82 | |||
cae2e19a96 | |||
ea00e1e361 | |||
3324129ed2 | |||
bcc418a55f | |||
6907e59e2e | |||
84e78bc808 | |||
bbd69e32b3 | |||
ce243c39b8 | |||
8b35ba97c8 | |||
cf07e0d29b | |||
1112d253ee | |||
9b37dab44f | |||
ec1e99ec42 | |||
|
cf427ec269 | ||
|
5f4e1610d3 | ||
|
5fd972942b | ||
|
95a6219fd7 | ||
|
2fc46f8bb7 | ||
|
1b9a64068a | ||
ec5abc5fe4 | |||
897f375130 | |||
|
6e2bff33da | ||
|
7edef20a45 | ||
|
75de934c4f | ||
|
7c08286128 | ||
|
4e066d88d5 | ||
|
e406bcc63a | ||
|
0595617645 | ||
|
51f1c674fa | ||
|
9830f38ffb | ||
|
66c2669557 | ||
|
bca70c5493 | ||
479cb7255f | |||
|
9635ec4572 | ||
0dcbb3a057 | |||
|
4d42019882 | ||
|
5d47d6f1a9 | ||
|
2461bb8a93 | ||
|
49f89d1319 | ||
|
2280cc40d9 | ||
1d6b207aea | |||
73d997f754 | |||
dad33b003e | |||
b6dd26f8a3 | |||
c18f4162ff | |||
|
caca0d91c7 | ||
|
7741a5dc35 | ||
|
a803a80f52 | ||
|
04b4b3f7c5 | ||
|
e5d4e80e19 | ||
|
4b999f57c4 | ||
ab79bf6e89 | |||
|
1624992428 | ||
478c553c37 | |||
|
c1e1ef5e0f | ||
019197fc15 | |||
|
1c148b0078 | ||
|
0c7f70af93 | ||
49b7c0c529 | |||
6a943ed3bd | |||
567f70c610 | |||
567503bcd6 | |||
6cf7804b39 | |||
dad01f7f85 | |||
170793fbd7 | |||
2e845b4fe1 | |||
b2732eeaf9 | |||
1dada43e0c | |||
776574c4e0 | |||
bda31412ee | |||
641c10aec2 | |||
40b3d8ddde | |||
37c525d5c2 | |||
ea4d3cacd4 | |||
46ffdc0d0d | |||
c25157b661 | |||
f436794256 | |||
150e7162fe | |||
24a6fd1eba | |||
66f70eb643 | |||
f2785fd407 | |||
953641b575 | |||
047451e5c4 | |||
f4841ed772 | |||
63516ad0a8 | |||
93dac4ec2e | |||
5a3367e47d | |||
7154d0a92a | |||
cd4e1492c8 | |||
6e29d40998 | |||
d6888a4e3c | |||
38fccfa827 | |||
e46e5a3635 | |||
e8f76dd102 | |||
58a066315b | |||
93ccab7d42 | |||
621f6c906d | |||
360ea2b4d5 | |||
a45369d1b5 | |||
cba59941cb | |||
06da79539e | |||
3506b1fdc7 | |||
99ba1fc52d | |||
107a457111 | |||
edc93077a7 | |||
1228060121 | |||
f9510db2eb | |||
fabc41aa92 | |||
19aa5b8955 | |||
c61ab9c0bd | |||
b896c73fbb | |||
9d57cb0188 | |||
c545988663 | |||
145a4258eb | |||
32632183cf | |||
5c0652888e | |||
f9fe550528 | |||
44f40ee10f | |||
54ea18edc4 | |||
83ea888de1 | |||
e39b72f666 | |||
190faad47f | |||
8febf219f7 | |||
b9c0b6b282 | |||
137255a2e1 | |||
f4036ffa77 | |||
e59d05f1e5 | |||
ece5feb935 | |||
b415537dd7 | |||
8f6326bfaf | |||
3da31de230 | |||
0304b71d8f | |||
41cd63b88a | |||
44e5c9abe7 | |||
792834ec27 | |||
1d696825d3 | |||
3b267ef26f | |||
5394e81a3a | |||
988d1342f5 | |||
f2332671aa | |||
7b12a726fd | |||
360b1377a8 | |||
505f459d89 | |||
829891cb7c | |||
1883adf5b5 | |||
044f79575c | |||
5e2fa0e7a0 | |||
33cd40fafa | |||
e52b81f5c7 | |||
46c62fa213 | |||
eacfce8ea6 | |||
883e5613e6 | |||
289518d2f9 | |||
e5255d3022 | |||
46839556cd | |||
a3e999f345 | |||
df96102509 | |||
412e679b94 | |||
fc396fd909 | |||
ebb08194d6 | |||
19ac6f4bf3 | |||
5e6f69bacf | |||
8ce0c39fb1 | |||
cb76c941dd | |||
e1ecefba63 | |||
0da63da9d8 | |||
ede67efea9 | |||
665afeced0 | |||
7c12b60c32 | |||
56dee3eb9d | |||
e4445ebf5b | |||
1504285bc8 | |||
d6cc359a36 | |||
6829778c8c | |||
346206b1d3 | |||
28d92a6ca2 | |||
335f8589ad | |||
a939b53340 | |||
c8e6c459f1 | |||
4231fdd1f9 | |||
76641cd124 | |||
42bd5409f6 | |||
f9e7f9e13c | |||
d8ae7edb3b | |||
e9bc29a205 | |||
4ad9771a3a | |||
b91131b7cd | |||
70a3e0a317 | |||
9ef0599430 | |||
f33ecd7b92 | |||
dc5ba41c0d | |||
5157dd589e | |||
8f533c4601 | |||
9415b3b701 | |||
5887473b9e | |||
fb043a2dd9 | |||
b1831b09ae | |||
1d3871de3a |
@ -5,6 +5,8 @@ import (
|
||||
"micro-bundle/internal/controller"
|
||||
_ "micro-bundle/internal/handler"
|
||||
"micro-bundle/pkg/app"
|
||||
"micro-bundle/pkg/cron"
|
||||
"micro-bundle/pkg/db"
|
||||
"micro-bundle/pkg/tracing"
|
||||
|
||||
"dubbo.apache.org/dubbo-go/v3/config"
|
||||
@ -12,15 +14,15 @@ import (
|
||||
_ "dubbo.apache.org/dubbo-go/v3/imports"
|
||||
"github.com/bwmarrin/snowflake"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func NewApp(Lg *zap.Logger, JaegerTracer *tracing.JaegerProvider, SfNode *snowflake.Node, BundleDB *gorm.DB) *app.App {
|
||||
func NewApp(Lg *zap.Logger, JaegerTracer *tracing.JaegerProvider, SfNode *snowflake.Node, BundleDB *db.BundleDB, TaskBenchDB *db.TaskBenchDB) *app.App {
|
||||
return &app.App{
|
||||
Lg: Lg,
|
||||
JaegerTracer: JaegerTracer,
|
||||
SfNode: SfNode,
|
||||
BundleDB: BundleDB,
|
||||
TaskBenchDB: TaskBenchDB,
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,6 +48,7 @@ func main() {
|
||||
if err = config.Load(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
cron.InitCronJob() // 定时任务
|
||||
select {}
|
||||
// dao.AddBundleExtendRecord(model.BundleExtensionRecords{
|
||||
// UserId: 57,
|
||||
|
@ -1314,56 +1314,3 @@
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-03-29T11:31:52.521+0800","caller":"zookeeper/listener.go:179","message":"[ZkEventListener][listenServiceNodeEvent]Get a EventNodeDeleted event for path {/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F192.168.88.77%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DBundleDetail%2CBundleList%2CCreateBundle%2CCreateOrderRecord%2CCreateValueAddBundle%2CDeleteBundle%2COrderRecordsDetail%2COrderRecordsList%2CUpdateBundle%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CValueAddBundleDetail%2CValueAddBundleList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D93332%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1743219110%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}"}
|
||||
{"level":"\u001b[33mWARN\u001b[0m","time":"2025-03-29T11:31:52.521+0800","caller":"zookeeper/listener.go:338","message":"listenDirEvent->listenSelf(zk path{/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F192.168.88.77%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DBundleDetail%2CBundleList%2CCreateBundle%2CCreateOrderRecord%2CCreateValueAddBundle%2CDeleteBundle%2COrderRecordsDetail%2COrderRecordsList%2CUpdateBundle%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CValueAddBundleDetail%2CValueAddBundleList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D93332%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1743219110%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}) goroutine exit now"}
|
||||
{"level":"\u001b[33mWARN\u001b[0m","time":"2025-03-29T11:31:52.522+0800","caller":"zookeeper/listener.go:244","message":"delete oldNode{/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F192.168.88.77%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DBundleDetail%2CBundleList%2CCreateBundle%2CCreateOrderRecord%2CCreateValueAddBundle%2CDeleteBundle%2COrderRecordsDetail%2COrderRecordsList%2CUpdateBundle%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CValueAddBundleDetail%2CValueAddBundleList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D93332%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1743219110%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:50.300+0800","caller":"config/root_config.go:129","message":"[Config Center] Config center doesn't start"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:50.302+0800","caller":"dubbo3/dubbo3_protocol.go:81","message":"[Triple Protocol] Export service: tri://:20201/grpc.reflection.v1alpha.ServerReflection?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=XXX_serverReflectionServer&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=grpc.reflection.v1alpha.ServerReflection&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=32300®istry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=tracing&side=provider×tamp=1750930370&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&warmup="}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:50.304+0800","caller":"dubbo3/dubbo3_protocol.go:81","message":"[Triple Protocol] Export service: tri://:20201/com.fontree.microservices.fiee.bundle?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=BundleProvider&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=com.fontree.microservices.fiee.bundle&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=32300®istry=zookeeper®istry.role=3&release=dubbo-golang-3.0.0&retries=0&serialization=&service.filter=tps%2Ctracing&side=provider×tamp=1750930370&tps.limit.interval=1000&tps.limit.rate=30&tps.limit.rejected.handler=DefaultValueHandler&tps.limit.strategy=fixedWindow&tps.limiter=method-service&warmup=100"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:50.304+0800","caller":"zookeeper/registry.go:67","message":"[Zookeeper Registry] New zookeeper registry with url map[host:127.0.0.1 port:2181 protocol:zookeeper registry:zookeeper registry.group: registry.label:true registry.namespace: registry.preferred:false registry.role:3 registry.timeout:10s registry.ttl:10s registry.weight:0 registry.zone: remote-client-name:dubbo.registries-zookeeper-127.0.0.1:2181 simplified:false]"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:50.304+0800","caller":"zookeeper/client.go:53","message":"[Zookeeper Client] New zookeeper client with name = 127.0.0.1:2181, zkAddress = 127.0.0.1:2181, timeout = 5s"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:50.377+0800","caller":"zookeeper/registry.go:217","message":"[Zookeeper Registry] Registry instance with root = /dubbo/com.fontree.microservices.fiee.bundle/providers, node = tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D32300%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930370%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:50.393+0800","caller":"zookeeper/listener.go:392","message":"[Zookeeper Listener] listen dubbo path{/dubbo/com.fontree.microservices.fiee.bundle/providers}"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:50.395+0800","caller":"dubbo/dubbo_protocol.go:83","message":"[DUBBO Protocol] Export service: dubbo://:53003/org.apache.dubbo.metadata.MetadataService?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=MetadataService&cluster=&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&group=dubbo.io&interface=org.apache.dubbo.metadata.MetadataService&loadbalance=&message_size=0&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=32300®istry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider×tamp=1750930370&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&version=1.0.0&warmup="}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:50.395+0800","caller":"configurable/exporter.go:77","message":"[Metadata Service] The MetadataService exports urls : [dubbo://:53003/org.apache.dubbo.metadata.MetadataService?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=MetadataService&cluster=&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&group=dubbo.io&interface=org.apache.dubbo.metadata.MetadataService&loadbalance=&message_size=0&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=32300®istry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider×tamp=1750930370&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&version=1.0.0&warmup=] "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:53.212+0800","caller":"config/graceful_shutdown.go:81","message":"get signal interrupt, applicationConfig will shutdown."}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:53.212+0800","caller":"config/graceful_shutdown.go:121","message":"Graceful shutdown --- Destroy all registriesConfig. "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:53.218+0800","caller":"config/graceful_shutdown.go:162","message":"Graceful shutdown --- Keep waiting and accept new requests for a short time. "}
|
||||
{"level":"\u001b[33mWARN\u001b[0m","time":"2025-06-26T17:32:53.218+0800","caller":"zookeeper/listener.go:153","message":"get a zookeeper keyEventCh{type:EventNodeDeleted, server:, path:/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D32300%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930370%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100, state:3-zookeeper connected, err:%!s(<nil>)}"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:53.218+0800","caller":"zookeeper/listener.go:179","message":"[ZkEventListener][listenServiceNodeEvent]Get a EventNodeDeleted event for path {/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D32300%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930370%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}"}
|
||||
{"level":"\u001b[33mWARN\u001b[0m","time":"2025-06-26T17:32:53.218+0800","caller":"zookeeper/listener.go:338","message":"listenDirEvent->listenSelf(zk path{/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D32300%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930370%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}) goroutine exit now"}
|
||||
{"level":"\u001b[33mWARN\u001b[0m","time":"2025-06-26T17:32:53.219+0800","caller":"zookeeper/listener.go:244","message":"delete oldNode{/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D32300%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930370%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:56.218+0800","caller":"config/graceful_shutdown.go:193","message":"Graceful shutdown --- Keep waiting until sending/accepting requests finish or timeout. "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:56.218+0800","caller":"config/graceful_shutdown.go:129","message":"Graceful shutdown --- Destroy protocols. "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:56.218+0800","caller":"config/graceful_shutdown.go:144","message":"Graceful shutdown --- First destroy provider's protocols. "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:56.218+0800","caller":"protocol/protocol.go:139","message":"Exporter unexport."}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:56.218+0800","caller":"protocol/invoker.go:91","message":"Destroy invoker: tri://:20201/grpc.reflection.v1alpha.ServerReflection?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=XXX_serverReflectionServer&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=grpc.reflection.v1alpha.ServerReflection&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=32300®istry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=tracing&side=provider×tamp=1750930370&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&warmup="}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:56.218+0800","caller":"protocol/protocol.go:139","message":"Exporter unexport."}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:56.218+0800","caller":"protocol/invoker.go:91","message":"Destroy invoker: tri://:20201/com.fontree.microservices.fiee.bundle?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=BundleProvider&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=com.fontree.microservices.fiee.bundle&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=32300®istry=zookeeper®istry.role=3&release=dubbo-golang-3.0.0&retries=0&serialization=&service.filter=tps%2Ctracing&side=provider×tamp=1750930370&tps.limit.interval=1000&tps.limit.rate=30&tps.limit.rejected.handler=DefaultValueHandler&tps.limit.strategy=fixedWindow&tps.limiter=method-service&warmup=100"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:56.219+0800","caller":"config/graceful_shutdown.go:155","message":"Graceful shutdown --- Second Destroy consumer's protocols. "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:32:56.219+0800","caller":"config/graceful_shutdown.go:113","message":"Graceful shutdown --- Execute the custom callbacks."}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:34.831+0800","caller":"config/root_config.go:129","message":"[Config Center] Config center doesn't start"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:34.832+0800","caller":"dubbo3/dubbo3_protocol.go:81","message":"[Triple Protocol] Export service: tri://:20201/grpc.reflection.v1alpha.ServerReflection?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=XXX_serverReflectionServer&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=grpc.reflection.v1alpha.ServerReflection&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=46056®istry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=tracing&side=provider×tamp=1750930414&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&warmup="}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:34.833+0800","caller":"dubbo3/dubbo3_protocol.go:81","message":"[Triple Protocol] Export service: tri://:20201/com.fontree.microservices.fiee.bundle?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=BundleProvider&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=com.fontree.microservices.fiee.bundle&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=46056®istry=zookeeper®istry.role=3&release=dubbo-golang-3.0.0&retries=0&serialization=&service.filter=tps%2Ctracing&side=provider×tamp=1750930414&tps.limit.interval=1000&tps.limit.rate=30&tps.limit.rejected.handler=DefaultValueHandler&tps.limit.strategy=fixedWindow&tps.limiter=method-service&warmup=100"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:34.833+0800","caller":"zookeeper/registry.go:67","message":"[Zookeeper Registry] New zookeeper registry with url map[host:127.0.0.1 port:2181 protocol:zookeeper registry:zookeeper registry.group: registry.label:true registry.namespace: registry.preferred:false registry.role:3 registry.timeout:10s registry.ttl:10s registry.weight:0 registry.zone: remote-client-name:dubbo.registries-zookeeper-127.0.0.1:2181 simplified:false]"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:34.833+0800","caller":"zookeeper/client.go:53","message":"[Zookeeper Client] New zookeeper client with name = 127.0.0.1:2181, zkAddress = 127.0.0.1:2181, timeout = 5s"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:34.865+0800","caller":"zookeeper/registry.go:217","message":"[Zookeeper Registry] Registry instance with root = /dubbo/com.fontree.microservices.fiee.bundle/providers, node = tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D46056%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930414%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:34.881+0800","caller":"zookeeper/listener.go:392","message":"[Zookeeper Listener] listen dubbo path{/dubbo/com.fontree.microservices.fiee.bundle/providers}"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:34.882+0800","caller":"dubbo/dubbo_protocol.go:83","message":"[DUBBO Protocol] Export service: dubbo://:53298/org.apache.dubbo.metadata.MetadataService?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=MetadataService&cluster=&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&group=dubbo.io&interface=org.apache.dubbo.metadata.MetadataService&loadbalance=&message_size=0&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=46056®istry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider×tamp=1750930414&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&version=1.0.0&warmup="}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:34.882+0800","caller":"configurable/exporter.go:77","message":"[Metadata Service] The MetadataService exports urls : [dubbo://:53298/org.apache.dubbo.metadata.MetadataService?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=MetadataService&cluster=&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&group=dubbo.io&interface=org.apache.dubbo.metadata.MetadataService&loadbalance=&message_size=0&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=46056®istry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider×tamp=1750930414&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&version=1.0.0&warmup=] "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:46.757+0800","caller":"config/graceful_shutdown.go:81","message":"get signal interrupt, applicationConfig will shutdown."}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:46.757+0800","caller":"config/graceful_shutdown.go:121","message":"Graceful shutdown --- Destroy all registriesConfig. "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:46.761+0800","caller":"config/graceful_shutdown.go:162","message":"Graceful shutdown --- Keep waiting and accept new requests for a short time. "}
|
||||
{"level":"\u001b[33mWARN\u001b[0m","time":"2025-06-26T17:33:46.761+0800","caller":"zookeeper/listener.go:153","message":"get a zookeeper keyEventCh{type:EventNodeDeleted, server:, path:/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D46056%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930414%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100, state:3-zookeeper connected, err:%!s(<nil>)}"}
|
||||
{"level":"\u001b[33mWARN\u001b[0m","time":"2025-06-26T17:33:46.761+0800","caller":"zookeeper/listener.go:153","message":"get a zookeeper keyEventCh{type:EventNodeDeleted, server:, path:/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D46056%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930414%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100, state:3-zookeeper connected, err:%!s(<nil>)}"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:46.761+0800","caller":"zookeeper/listener.go:179","message":"[ZkEventListener][listenServiceNodeEvent]Get a EventNodeDeleted event for path {/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D46056%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930414%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:46.761+0800","caller":"zookeeper/listener.go:179","message":"[ZkEventListener][listenServiceNodeEvent]Get a EventNodeDeleted event for path {/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D46056%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930414%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}"}
|
||||
{"level":"\u001b[33mWARN\u001b[0m","time":"2025-06-26T17:33:46.761+0800","caller":"zookeeper/listener.go:226","message":"delete zkNode{/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D46056%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930414%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}"}
|
||||
{"level":"\u001b[33mWARN\u001b[0m","time":"2025-06-26T17:33:46.762+0800","caller":"zookeeper/listener.go:338","message":"listenDirEvent->listenSelf(zk path{/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D46056%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930414%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}) goroutine exit now"}
|
||||
{"level":"\u001b[33mWARN\u001b[0m","time":"2025-06-26T17:33:46.762+0800","caller":"zookeeper/listener.go:244","message":"delete oldNode{/dubbo/com.fontree.microservices.fiee.bundle/providers/tri%3A%2F%2F172.23.64.1%3A20201%2Fcom.fontree.microservices.fiee.bundle%3Fanyhost%3Dtrue%26application%3Ddubbo.io%26bean.name%3DBundleProvider%26cluster%3Dfailover%26export%3Dtrue%26interface%3Dcom.fontree.microservices.fiee.bundle%26loadbalance%3Drandom%26message_size%3D4%26metadata-type%3Dlocal%26methods%3DAddBundleBalance%2CBatchGetValueAddServiceLang%2CBundleDetail%2CBundleDetailV2%2CBundleExtend%2CBundleExtendRecordsList%2CBundleLangDetailV2%2CBundleList%2CBundleListH5V2%2CBundleListV2%2CCalculatePrice%2CConfirmWork%2CCreateBundle%2CCreateBundleBalance%2CCreateOrderAddRecord%2CCreateOrderRecord%2CCreateReconciliation%2CCreateValueAddBundle%2CDeleteBundle%2CDeleteValueAddService%2CGetBundleBalanceByUserId%2CGetBundleBalanceList%2CGetImageWorkDetail%2CGetReconciliationList%2CGetUsedRecordList%2CGetVedioWorkDetail%2CHandShelf%2COnlyAddValueListByOrderNo%2COrderListByOrderNo%2COrderRecordsDetail%2COrderRecordsList%2COrderRecordsListV2%2CPackagePriceAndTime%2CSaveBundle%2CSaveValueAddService%2CToBeComfirmedWorks%2CUpdateBundle%2CUpdateFinancialConfirmationStatus%2CUpdateOrderRecord%2CUpdateOrderRecordByOrderNo%2CUpdateReconciliation%2CUpdateReconciliationStatusBySerialNumber%2CValueAddBundleDetail%2CValueAddBundleList%2CValueAddServiceDetail%2CValueAddServiceLangByUuidAndLanguage%2CValueAddServiceList%26module%3Dsample%26name%3Ddubbo.io%26organization%3Ddubbo-go%26owner%3Ddubbo-go%26pid%3D46056%26registry%3Dzookeeper%26registry.role%3D3%26release%3Ddubbo-golang-3.0.0%26retries%3D0%26service.filter%3Dtps%2Ctracing%26side%3Dprovider%26timestamp%3D1750930414%26tps.limit.interval%3D1000%26tps.limit.rate%3D30%26tps.limit.rejected.handler%3DDefaultValueHandler%26tps.limit.strategy%3DfixedWindow%26tps.limiter%3Dmethod-service%26warmup%3D100}"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:49.762+0800","caller":"config/graceful_shutdown.go:193","message":"Graceful shutdown --- Keep waiting until sending/accepting requests finish or timeout. "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:49.762+0800","caller":"config/graceful_shutdown.go:129","message":"Graceful shutdown --- Destroy protocols. "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:49.762+0800","caller":"config/graceful_shutdown.go:144","message":"Graceful shutdown --- First destroy provider's protocols. "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:49.762+0800","caller":"protocol/protocol.go:139","message":"Exporter unexport."}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:49.762+0800","caller":"protocol/invoker.go:91","message":"Destroy invoker: tri://:20201/com.fontree.microservices.fiee.bundle?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=BundleProvider&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=com.fontree.microservices.fiee.bundle&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=46056®istry=zookeeper®istry.role=3&release=dubbo-golang-3.0.0&retries=0&serialization=&service.filter=tps%2Ctracing&side=provider×tamp=1750930414&tps.limit.interval=1000&tps.limit.rate=30&tps.limit.rejected.handler=DefaultValueHandler&tps.limit.strategy=fixedWindow&tps.limiter=method-service&warmup=100"}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:49.762+0800","caller":"protocol/protocol.go:139","message":"Exporter unexport."}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:49.762+0800","caller":"protocol/invoker.go:91","message":"Destroy invoker: tri://:20201/grpc.reflection.v1alpha.ServerReflection?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=XXX_serverReflectionServer&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=grpc.reflection.v1alpha.ServerReflection&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go¶m.sign=&pid=46056®istry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=tracing&side=provider×tamp=1750930414&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&warmup="}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:49.762+0800","caller":"config/graceful_shutdown.go:155","message":"Graceful shutdown --- Second Destroy consumer's protocols. "}
|
||||
{"level":"\u001b[34mINFO\u001b[0m","time":"2025-06-26T17:33:49.762+0800","caller":"config/graceful_shutdown.go:113","message":"Graceful shutdown --- Execute the custom callbacks."}
|
||||
|
@ -14,6 +14,6 @@ import (
|
||||
)
|
||||
|
||||
func InitApp() (*app.App, error) {
|
||||
wire.Build(logger.Provider, tracing.Provider, snowf.Provider, db.Provider, NewApp)
|
||||
wire.Build(logger.Provider, tracing.Provider, snowf.Provider, db.Provider, db.TaskBenchProvider, NewApp)
|
||||
return &app.App{}, nil
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by Wire. DO NOT EDIT.
|
||||
|
||||
//go:generate go run github.com/google/wire/cmd/wire
|
||||
//go:generate go run -mod=mod github.com/google/wire/cmd/wire
|
||||
//go:build !wireinject
|
||||
// +build !wireinject
|
||||
|
||||
@ -12,6 +12,12 @@ import (
|
||||
"micro-bundle/pkg/logger"
|
||||
"micro-bundle/pkg/snowf"
|
||||
"micro-bundle/pkg/tracing"
|
||||
|
||||
_ "dubbo.apache.org/dubbo-go/v3/filter/tps/strategy"
|
||||
|
||||
_ "dubbo.apache.org/dubbo-go/v3/imports"
|
||||
|
||||
_ "micro-bundle/internal/handler"
|
||||
)
|
||||
|
||||
// Injectors from wire.go:
|
||||
@ -20,7 +26,8 @@ func InitApp() (*app.App, error) {
|
||||
zapLogger := logger.ZapInit()
|
||||
jaegerProvider := tracing.NewTracing()
|
||||
node := snowf.NewSf()
|
||||
gormDB := db.NewBundleDB()
|
||||
appApp := NewApp(zapLogger, jaegerProvider, node, gormDB)
|
||||
bundleDB := db.NewBundleDB()
|
||||
taskBenchDB := db.NewTaskBenchDB()
|
||||
appApp := NewApp(zapLogger, jaegerProvider, node, bundleDB, taskBenchDB)
|
||||
return appApp, nil
|
||||
}
|
||||
|
@ -7,6 +7,12 @@ bundleDB:
|
||||
user: artuser
|
||||
password: C250PflXIWv2SQm8
|
||||
db_name: "fiee_bundle"
|
||||
taskBenchDB:
|
||||
host: 121.229.45.214
|
||||
port: 9007
|
||||
user: artuser
|
||||
password: C250PflXIWv2SQm8
|
||||
db_name: "fiee_task_bench"
|
||||
#aliYunRtc:
|
||||
# appid: "aeztom27"
|
||||
# app_key: "76c62466cbd77d7a3606660a15861d1e"
|
||||
|
@ -7,6 +7,12 @@ bundleDB:
|
||||
user: artuser
|
||||
password: C250PflXIWv2SQm8
|
||||
db_name: "fiee_bundle"
|
||||
taskBenchDB:
|
||||
host: 121.229.45.214
|
||||
port: 9007
|
||||
user: artuser
|
||||
password: C250PflXIWv2SQm8
|
||||
db_name: "fiee_task_bench"
|
||||
#aliYunRtc:
|
||||
# appid: "aeztom27"
|
||||
# app_key: "76c62466cbd77d7a3606660a15861d1e"
|
||||
|
@ -7,6 +7,12 @@ bundleDB:
|
||||
user: fonchain_opv
|
||||
password: IhQmhg8HZjDmU=Ove5PnA^D
|
||||
db_name: "micro_bundle"
|
||||
taskBenchDB:
|
||||
host: svc-fontree-mysql-service
|
||||
port: 3306
|
||||
user: fonchain_opv
|
||||
password: IhQmhg8HZjDmU=Ove5PnA^D
|
||||
db_name: "fiee_task_bench"
|
||||
#redis:
|
||||
# db: ${oa-meeting.redis.db}
|
||||
# addr: ${redis.addr}
|
||||
|
@ -26,6 +26,13 @@ type AppConfig struct {
|
||||
Password string
|
||||
DbName string `mapstructure:"db_name"`
|
||||
}
|
||||
TaskBenchDB struct {
|
||||
Host string
|
||||
Port string
|
||||
User string
|
||||
Password string
|
||||
DbName string `mapstructure:"db_name"`
|
||||
}
|
||||
Redis struct {
|
||||
DB string
|
||||
Addr string
|
||||
|
@ -49,3 +49,18 @@ func (b *BundleProvider) ToBeComfirmedWorks(_ context.Context, req *bundle.ToBeC
|
||||
func (b *BundleProvider) ConfirmWork(_ context.Context, req *bundle.ConfirmWorkReq) (*bundle.ConfirmWorkResp, error) {
|
||||
return logic.ConfirmWork(req)
|
||||
}
|
||||
|
||||
func (b *BundleProvider) BundleActivate(_ context.Context, req *bundle.BundleActivateReq) (*bundle.BundleActivateResp, error) {
|
||||
return nil, logic.BundleActivate(req)
|
||||
}
|
||||
|
||||
func (b *BundleProvider) BundleBalanceExport(_ context.Context, req *bundle.BundleBalanceExportReq) (*bundle.BundleBalanceExportResp, error) {
|
||||
return logic.BundleBalanceExport(req)
|
||||
}
|
||||
|
||||
func (b *BundleProvider) GetBundleBalanceLayout(_ context.Context, req *bundle.GetBundleBalanceLayoutReq) (*bundle.GetBundleBalanceLayoutResp, error) {
|
||||
return logic.GetBundleBalanceLayout(req)
|
||||
}
|
||||
func (b *BundleProvider) SetBundleBalanceLayout(_ context.Context, req *bundle.SetBundleBalanceLayoutReq) (*bundle.SetBundleBalanceLayoutResp, error) {
|
||||
return logic.SetBundleBalanceLayout(req)
|
||||
}
|
||||
|
296
internal/controller/task.go
Normal file
296
internal/controller/task.go
Normal file
@ -0,0 +1,296 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"micro-bundle/internal/dao"
|
||||
"micro-bundle/internal/logic"
|
||||
"micro-bundle/pb/bundle"
|
||||
)
|
||||
|
||||
// GetPendingTaskList 查询待指派任务记录
|
||||
func (b *BundleProvider) GetPendingTaskList(_ context.Context, req *bundle.TaskQueryRequest) (*bundle.TaskQueryResponse, error) {
|
||||
// 转换请求参数
|
||||
daoReq := &dao.TaskQueryRequest{
|
||||
Keyword: req.Keyword,
|
||||
Page: int(req.Page),
|
||||
PageSize: int(req.PageSize),
|
||||
SortBy: req.SortBy,
|
||||
SortType: req.SortType,
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
tasks, total, err := logic.GetPendingTaskList(daoReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 转换响应数据
|
||||
var taskInfos []*bundle.TaskManagementInfo
|
||||
for _, task := range tasks {
|
||||
taskInfo := &bundle.TaskManagementInfo{
|
||||
SubNum: task.SubNum,
|
||||
TelNum: task.TelNum,
|
||||
ArtistName: task.ArtistName,
|
||||
PendingVideoCount: int32(task.PendingVideoCount),
|
||||
PendingPostCount: int32(task.PendingPostCount),
|
||||
PendingDataCount: int32(task.PendingDataCount),
|
||||
ProgressTaskCount: int32(task.ProgressTaskCount),
|
||||
CompleteTaskCount: int32(task.CompleteTaskCount),
|
||||
LastTaskAssignee: task.LastTaskAssignee,
|
||||
TaskAssigneeNum: task.TaskAssigneeNum,
|
||||
}
|
||||
taskInfos = append(taskInfos, taskInfo)
|
||||
}
|
||||
|
||||
return &bundle.TaskQueryResponse{
|
||||
Tasks: taskInfos,
|
||||
Total: total,
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// AssignTask 指派某位员工完成某个艺人的任务
|
||||
// AssignTask 指派某位员工完成某个艺人的任务
|
||||
func (b *BundleProvider) AssignTask(_ context.Context, req *bundle.TaskAssignRequest) (*bundle.CommonResponse, error) {
|
||||
// 转换请求参数
|
||||
daoReq := &dao.TaskAssignRequest{
|
||||
SubNum: req.SubNum,
|
||||
TelNum: req.TelNum,
|
||||
ArtistName: req.ArtistName, // 添加缺失的ArtistName字段
|
||||
TaskAssignee: req.TaskAssignee,
|
||||
TaskAssigneeNum: req.TaskAssigneeNum,
|
||||
Operator: req.Operator,
|
||||
OperatorNum: req.OperatorNum,
|
||||
AssignVideoCount: int(req.AssignVideoCount),
|
||||
AssignPostCount: int(req.AssignPostCount),
|
||||
AssignDataCount: int(req.AssignDataCount),
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
err := logic.AssignTask(daoReq)
|
||||
if err != nil {
|
||||
return &bundle.CommonResponse{
|
||||
Msg: err.Error(),
|
||||
}, err
|
||||
}
|
||||
|
||||
return &bundle.CommonResponse{
|
||||
Msg: "任务指派成功",
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UpdatePendingCount 修改待发数量
|
||||
func (b *BundleProvider) UpdatePendingCount(_ context.Context, req *bundle.UpdatePendingCountRequest) (*bundle.CommonResponse, error) {
|
||||
// 转换请求参数
|
||||
daoReq := &dao.UpdatePendingCountRequest{
|
||||
SubNum: req.SubNum,
|
||||
TelNum: req.TelNum,
|
||||
ArtistName: req.ArtistName, // 添加缺失的ArtistName字段
|
||||
PendingVideoCount: int(req.PendingVideoCount),
|
||||
PendingPostCount: int(req.PendingPostCount),
|
||||
PendingDataCount: int(req.PendingDataCount),
|
||||
Operator: req.Operator,
|
||||
OperatorNum: req.OperatorNum,
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
err := logic.UpdatePendingCount(daoReq)
|
||||
if err != nil {
|
||||
return &bundle.CommonResponse{
|
||||
Msg: err.Error(),
|
||||
}, err
|
||||
}
|
||||
|
||||
return &bundle.CommonResponse{
|
||||
Msg: "待发数量修改成功",
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetRecentAssignRecords 查询最近被指派记录
|
||||
func (b *BundleProvider) GetRecentAssignRecords(_ context.Context, req *bundle.RecentAssignRecordsRequest) (*bundle.RecentAssignRecordsResponse, error) {
|
||||
limit := int(req.Limit)
|
||||
if limit == 0 {
|
||||
limit = 3 // 默认查询3条
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
operatorList, err := logic.GetRecentAssignRecords(limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &bundle.RecentAssignRecordsResponse{
|
||||
OperatorList: operatorList,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetEmployeeAssignedTasks 根据登录人信息查询被指派给该员工的任务
|
||||
func (b *BundleProvider) GetEmployeeAssignedTasks(_ context.Context, req *bundle.EmployeeTaskQueryRequest) (*bundle.EmployeeTaskQueryResponse, error) {
|
||||
// 转换请求参数
|
||||
daoReq := &dao.EmployeeTaskQueryRequest{
|
||||
TaskAssigneeNum: req.TaskAssigneeNum,
|
||||
Keyword: req.Keyword,
|
||||
Operator: req.Operator,
|
||||
SortBy: req.SortBy,
|
||||
StartTime: req.StartTime,
|
||||
EndTime: req.EndTime,
|
||||
StartCompleteTime: req.StartCompleteTime,
|
||||
EndCompleteTime: req.EndCompleteTime,
|
||||
Status: int(req.Status),
|
||||
Page: int(req.Page),
|
||||
PageSize: int(req.PageSize),
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
records, total, err := logic.GetEmployeeAssignedTasks(daoReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 转换响应数据
|
||||
var recordInfos []*bundle.TaskAssignRecordInfo
|
||||
for _, record := range records {
|
||||
recordInfo := convertToTaskAssignRecordInfo(record)
|
||||
recordInfos = append(recordInfos, recordInfo)
|
||||
}
|
||||
|
||||
return &bundle.EmployeeTaskQueryResponse{
|
||||
Records: recordInfos,
|
||||
Total: total,
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CompleteTaskManually 员工手动点击完成任务
|
||||
func (b *BundleProvider) CompleteTaskManually(_ context.Context, req *bundle.CompleteTaskManuallyRequest) (*bundle.CommonResponse, error) {
|
||||
// 调用logic层
|
||||
err := logic.CompleteTaskManually(req.AssignRecordsUUID, req.TaskAssigneeNum)
|
||||
if err != nil {
|
||||
return &bundle.CommonResponse{
|
||||
Msg: err.Error(),
|
||||
}, err
|
||||
}
|
||||
|
||||
return &bundle.CommonResponse{
|
||||
Msg: "任务完成状态更新成功",
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UpdateTaskProgress 员工实际完成任务状态更新
|
||||
func (b *BundleProvider) UpdateTaskProgress(_ context.Context, req *bundle.UpdateTaskProgressRequest) (*bundle.CommonResponse, error) {
|
||||
// 转换请求参数
|
||||
daoReq := &dao.CompleteTaskRequest{
|
||||
AssignRecordsUUID: req.AssignRecordsUUID,
|
||||
EmployeeName: req.EmployeeName,
|
||||
EmployeeNum: req.EmployeeNum,
|
||||
TaskType: req.TaskType,
|
||||
CompleteCount: int(req.CompleteCount),
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
err := logic.UpdateTaskProgress(daoReq)
|
||||
if err != nil {
|
||||
return &bundle.CommonResponse{
|
||||
Msg: err.Error(),
|
||||
}, err
|
||||
}
|
||||
|
||||
return &bundle.CommonResponse{
|
||||
Msg: "任务进度更新成功",
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetTaskAssignRecordsList 多条件查询操作记录表
|
||||
func (b *BundleProvider) GetTaskAssignRecordsList(_ context.Context, req *bundle.TaskAssignRecordsQueryRequest) (*bundle.TaskAssignRecordsQueryResponse, error) {
|
||||
// 转换请求参数
|
||||
daoReq := &dao.TaskAssignRecordsQueryRequest{
|
||||
Keyword: req.Keyword,
|
||||
TaskAssignee: req.TaskAssignee,
|
||||
Operator: req.Operator,
|
||||
OperatorNum: req.OperatorNum,
|
||||
StartTime: req.StartTime,
|
||||
EndTime: req.EndTime,
|
||||
Status: int(req.Status),
|
||||
ActualStatus: int(req.ActualStatus),
|
||||
Page: int(req.Page),
|
||||
PageSize: int(req.PageSize),
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
records, total, err := logic.GetTaskAssignRecordsList(daoReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 转换响应数据
|
||||
var recordInfos []*bundle.TaskAssignRecordInfo
|
||||
for _, record := range records {
|
||||
recordInfo := convertToTaskAssignRecordInfo(record)
|
||||
recordInfos = append(recordInfos, recordInfo)
|
||||
}
|
||||
|
||||
return &bundle.TaskAssignRecordsQueryResponse{
|
||||
Records: recordInfos,
|
||||
Total: total,
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// convertToTaskAssignRecordInfo 转换TaskAssignRecords模型为proto消息
|
||||
func convertToTaskAssignRecordInfo(record *dao.TaskAssignRecordsResponse) *bundle.TaskAssignRecordInfo {
|
||||
var completeTime string
|
||||
if record.CompleteTime != nil {
|
||||
completeTime = record.CompleteTime.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
|
||||
return &bundle.TaskAssignRecordInfo{
|
||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
ArtistName: record.ArtistName,
|
||||
Status: int32(record.Status),
|
||||
ActualStatus: int32(record.ActualStatus),
|
||||
CompleteTime: completeTime,
|
||||
OperatorType: int32(record.OperatorType),
|
||||
Operator: record.Operator,
|
||||
OperatorNum: record.OperatorNum,
|
||||
OperatorTime: record.OperatorTime.Format("2006-01-02 15:04:05"),
|
||||
TaskAssignee: record.TaskAssignee,
|
||||
TaskAssigneeNum: record.TaskAssigneeNum,
|
||||
PendingVideoCount: int32(record.PendingVideoCount),
|
||||
PendingPostCount: int32(record.PendingPostCount),
|
||||
PendingDataCount: int32(record.PendingDataCount),
|
||||
UpdatedAt: record.UpdatedAt.Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
}
|
||||
|
||||
// GetArtistBundleBalance 查询艺人套餐剩余数量
|
||||
func (b *BundleProvider) GetArtistBundleBalance(_ context.Context, req *bundle.ArtistBundleBalanceRequest) (*bundle.ArtistBundleBalanceResponse, error) {
|
||||
// 参数验证
|
||||
if req.CustomerNum == "" && req.TelNum == "" {
|
||||
return nil, fmt.Errorf("艺人编号和手机号不能同时为空")
|
||||
}
|
||||
|
||||
// 转换请求参数
|
||||
daoReq := &dao.ArtistBundleBalanceRequest{
|
||||
CustomerNum: req.CustomerNum,
|
||||
TelNum: req.TelNum,
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
result, err := logic.GetArtistBundleBalance(daoReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 转换响应数据
|
||||
return &bundle.ArtistBundleBalanceResponse{
|
||||
RemainingVideoCount: int32(result.RemainingVideoCount),
|
||||
RemainingImageCount: int32(result.RemainingImageCount),
|
||||
RemainingDataAnalysisCount: int32(result.RemainingDataAnalysisCount),
|
||||
}, nil
|
||||
}
|
@ -163,12 +163,23 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
|
||||
if len(bundles) > 0 {
|
||||
for _, bundleProfile := range bundles {
|
||||
selectValueAddService := make([]*bundle.SelectValueAddService, 0)
|
||||
SelectValueAdditionalService := make([]*bundle.SelectValueAdditionalService, 0)
|
||||
if bundleProfile.BundleToValueAddService != nil {
|
||||
for _, v := range bundleProfile.BundleToValueAddService {
|
||||
selectValueAddService = append(selectValueAddService, &bundle.SelectValueAddService{
|
||||
ValueAddUuid: v.ValueUid,
|
||||
IsDisplay: v.IsDisplay,
|
||||
})
|
||||
//根据权益类型存入对应的list
|
||||
switch v.BenefitsType {
|
||||
case msg.Benefits:
|
||||
selectValueAddService = append(selectValueAddService, &bundle.SelectValueAddService{
|
||||
ValueAddUuid: v.ValueUid,
|
||||
IsDisplay: v.IsDisplay,
|
||||
})
|
||||
case msg.OptionalBenefits:
|
||||
SelectValueAdditionalService = append(SelectValueAdditionalService, &bundle.SelectValueAdditionalService{
|
||||
ValueAddUuid: v.ValueUid,
|
||||
IsDisplay: v.IsDisplay,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
bundleProfileLang := []*bundle.BundleProfileLang{}
|
||||
@ -188,25 +199,26 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
|
||||
}
|
||||
}
|
||||
res.Bundles = append(res.Bundles, &bundle.BundleProfile{
|
||||
Uuid: bundleProfile.UUID,
|
||||
Name: bundleProfile.Name,
|
||||
Content: bundleProfile.Content,
|
||||
Price: bundleProfile.Price,
|
||||
PriceType: bundleProfile.PriceType,
|
||||
Contract: bundleProfile.Contract,
|
||||
Language: bundleProfile.Language,
|
||||
CreatedAt: bundleProfile.CreatedAt.Format("2006-01-02 15:04:05"),
|
||||
UpdatedAt: bundleProfile.UpdatedAt.Format("2006-01-02 15:04:05"),
|
||||
CompanySign: bundleProfile.CompanySign,
|
||||
ContractDuration: int64(bundleProfile.ContractDuration),
|
||||
Sort: bundleProfile.Sort,
|
||||
ImgOption: int32(bundleProfile.ImgOption),
|
||||
BgImg1: bundleProfile.BgImg1,
|
||||
BgImg2: bundleProfile.BgImg2,
|
||||
SelectValueAddService: selectValueAddService,
|
||||
BundleProfileLang: bundleProfileLang,
|
||||
ShelfStatus: int64(bundleProfile.ShelfStatus),
|
||||
FontColor: bundleProfile.FontColor,
|
||||
Uuid: bundleProfile.UUID,
|
||||
Name: bundleProfile.Name,
|
||||
Content: bundleProfile.Content,
|
||||
Price: bundleProfile.Price,
|
||||
PriceType: bundleProfile.PriceType,
|
||||
Contract: bundleProfile.Contract,
|
||||
Language: bundleProfile.Language,
|
||||
CreatedAt: bundleProfile.CreatedAt.Format("2006-01-02 15:04:05"),
|
||||
UpdatedAt: bundleProfile.UpdatedAt.Format("2006-01-02 15:04:05"),
|
||||
CompanySign: bundleProfile.CompanySign,
|
||||
ContractDuration: int64(bundleProfile.ContractDuration),
|
||||
Sort: bundleProfile.Sort,
|
||||
ImgOption: int32(bundleProfile.ImgOption),
|
||||
BgImg1: bundleProfile.BgImg1,
|
||||
BgImg2: bundleProfile.BgImg2,
|
||||
SelectValueAddService: selectValueAddService,
|
||||
SelectValueAdditionalService: SelectValueAdditionalService,
|
||||
BundleProfileLang: bundleProfileLang,
|
||||
ShelfStatus: int64(bundleProfile.ShelfStatus),
|
||||
FontColor: bundleProfile.FontColor,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -322,6 +334,12 @@ func GetValueAddServiceUuidsByBundleUuid(bundleUuid string) ([]string, error) {
|
||||
return uuids, err
|
||||
}
|
||||
|
||||
func GetValueAddServiceUuidsByAndBenefitsBundleUuid(bundleUuid string) ([]*model.ValueUidWithBenefits, error) {
|
||||
var result []*model.ValueUidWithBenefits
|
||||
err := app.ModuleClients.BundleDB.Model(&model.BundleToValueAddService{}).Select("value_uid, benefits_type").Where("bundle_uuid = ? and deleted_at = 0", bundleUuid).Scan(&result).Error
|
||||
return result, err
|
||||
}
|
||||
|
||||
// GetBundleToValueAddServiceByBundleUuid 根据套餐UUID获取所有关联的增值服务uuid
|
||||
func GetBundleToValueAddServiceByBundleUuid(bundleUuid string) ([]*model.BundleToValueAddService, error) {
|
||||
var result []*model.BundleToValueAddService
|
||||
|
@ -7,13 +7,10 @@ import (
|
||||
"micro-bundle/pb/bundle"
|
||||
"micro-bundle/pkg/app"
|
||||
"micro-bundle/pkg/utils"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
||||
"github.com/duke-git/lancet/v2/datetime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
func AddBundleExtendRecord(data model.BundleExtensionRecords) error {
|
||||
@ -22,40 +19,19 @@ func AddBundleExtendRecord(data model.BundleExtensionRecords) error {
|
||||
return err
|
||||
}
|
||||
if data.AvailableDurationAdditional != 0 && data.TimeUnit != 0 {
|
||||
record := model.BundleOrderRecords{}
|
||||
if err := tx.Model(&model.BundleOrderRecords{}).Where(&model.BundleOrderRecords{CustomerID: strconv.Itoa(data.UserId)}).Order("created_at desc").First(&record).Error; err != nil {
|
||||
record := model.BundleBalance{}
|
||||
if err := tx.Model(&model.BundleBalance{}).Where(&model.BundleBalance{UserId: data.UserId}).Order("month desc").First(&record).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
var expireTime time.Time
|
||||
if record.ExpirationTime != "" {
|
||||
loc, _ := time.LoadLocation("Asia/Shanghai")
|
||||
et, _ := time.ParseInLocation(time.DateTime, record.ExpirationTime, loc)
|
||||
expireTime = et
|
||||
} else {
|
||||
t, _ := time.Parse("2006-01-02 15:04:05", record.PayTime)
|
||||
expireTime = t
|
||||
logger.Infof("过期时间为空,使用默认过期时间" + expireTime.Format(time.DateTime))
|
||||
}
|
||||
|
||||
switch data.TimeUnit {
|
||||
case 1:
|
||||
expireTime = datetime.AddDay(expireTime, int64(data.AvailableDurationAdditional))
|
||||
case 2:
|
||||
expireTime = datetime.AddMonth(expireTime, int64(data.AvailableDurationAdditional))
|
||||
case 3:
|
||||
expireTime = datetime.AddYear(expireTime, int64(data.AvailableDurationAdditional))
|
||||
default:
|
||||
return errors.New("时间单位有误")
|
||||
}
|
||||
record.ExpirationTime = expireTime.Format(time.DateTime)
|
||||
return tx.Model(&model.BundleOrderRecords{}).Where(&model.BundleOrderRecords{UUID: record.UUID}).Updates(&record).Error
|
||||
record.ExpiredAt = record.ExpiredAt.Add(time.Hour * 24 * time.Duration(data.AvailableDurationAdditional))
|
||||
return tx.Save(record).Error
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func GetBundleExtendRecordList(req *bundle.BundleExtendRecordsListRequest) (data []model.BundleExtendRecordItemPo, total int64, err error) {
|
||||
session := app.ModuleClients.BundleDB.Table("micro_bundle.bundle_extension_records AS ber").
|
||||
session := app.ModuleClients.BundleDB.Table("fiee_bundle.bundle_extension_records AS ber").
|
||||
Select(`
|
||||
ber.*,
|
||||
rn.name as user_name,
|
||||
@ -107,15 +83,17 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
||||
FROM bundle_order_records
|
||||
GROUP BY customer_id
|
||||
) bor2 ON bor1.customer_id = bor2.customer_id AND bor1.created_at = bor2.max_created_time`)
|
||||
session := app.ModuleClients.BundleDB.Table("`micro-account`.`user` AS u").
|
||||
Select(`bb.*, bor.expiration_time as expired_time, bor.bundle_name, bor.status,
|
||||
bor.uuid as order_uuid, rn.name as user_name,
|
||||
session := app.ModuleClients.BundleDB.Table("`micro-account`.`user` AS u").Unscoped().
|
||||
Select(`bb.*, bor.bundle_name, bor.status,bor.created_at as pay_time,bor.customer_num,
|
||||
bor.uuid as order_uuid, rn.name as user_name,bc.activate,
|
||||
u.tel_num as user_phone_number, u.id as user_id`).
|
||||
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id").
|
||||
Joins("LEFT JOIN (?) as bor ON bor.customer_id = u.id", subQuery).
|
||||
Joins("LEFT JOIN micro_bundle.bundle_balance bb ON u.id = bb.user_id AND bb.order_uuid = bor.uuid").
|
||||
Joins("LEFT JOIN fiee_bundle.bundle_balance bb ON u.id = bb.user_id AND bb.order_uuid = bor.uuid").
|
||||
Joins("LEFT JOIN bundle_activate bc on bc.user_id = u.id").
|
||||
Where("rn.name IS NOT NULL").
|
||||
Where("u.deleted_at = 0").
|
||||
Where("bb.month = ?", req.Month).
|
||||
Order("bor.expiration_time desc")
|
||||
if req.UserName != "" {
|
||||
if utils.IsPhoneNumber(req.UserName) {
|
||||
@ -131,10 +109,10 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
||||
session = session.Where("bor.bundle_name like ?", "%"+req.BundleName+"%")
|
||||
}
|
||||
if req.ExpiredTimeEnd != 0 {
|
||||
session = session.Where("bor.expiration_time <= ?", time.UnixMilli(req.ExpiredTimeEnd))
|
||||
session = session.Where("bb.expired_at <= ?", time.UnixMilli(req.ExpiredTimeEnd))
|
||||
}
|
||||
if req.ExpiredTimeStart != 0 {
|
||||
session = session.Where("bor.expiration_time >= ?", time.UnixMilli(req.ExpiredTimeStart))
|
||||
session = session.Where("bb.expired_at >= ?", time.UnixMilli(req.ExpiredTimeStart))
|
||||
}
|
||||
if req.Bought == 2 {
|
||||
session = session.Where("bor.uuid IS NOT NULL")
|
||||
@ -154,63 +132,246 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
||||
}
|
||||
|
||||
func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (data model.UserBundleBalancePo, err error) {
|
||||
err = app.ModuleClients.BundleDB.Table("micro_bundle.bundle_balance AS bb").
|
||||
Select("bb.*,bor.uuid AS order_uuid, bor.bundle_name AS bundle_name, bor.status AS bundle_status, bor.pay_time AS pay_time, bor.expiration_time AS expired_time,bor.amount AS payment_amount,bor.amount_type AS payment_type").
|
||||
Joins("LEFT JOIN bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||
Joins("LEFT JOIN `micro-account`.`user` u ON u.id = bb.user_id").
|
||||
Where("bor.deleted_at IS NULL").
|
||||
Where("bb.user_id = ?", req.UserId).
|
||||
// Where("bor.expiration_time > ?", time.Now()).
|
||||
Order("bb.created_at desc").
|
||||
First(&data).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var additionalInfo model.UserBundleBalancePo
|
||||
err = app.ModuleClients.BundleDB.Model(&model.BundleExtensionRecords{}).
|
||||
Select("SUM(account_additional) as account_additional, SUM(images_additional) as image_additional, SUM(video_additional) as video_additional, SUM(data_additional) as data_additional").
|
||||
Where("type = 1"). // 手动扩展
|
||||
Where("user_id = ?", req.UserId).
|
||||
Where("created_at > ?", data.PayTime). // 判断扩展是否生效
|
||||
First(&additionalInfo).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
data.AccountAdditional = additionalInfo.AccountAdditional
|
||||
data.VideoAdditional = additionalInfo.VideoAdditional
|
||||
data.ImageAdditional = additionalInfo.ImageAdditional
|
||||
data.DataAnalysisAdditional = additionalInfo.DataAnalysisAdditional
|
||||
subQuery := app.ModuleClients.BundleDB.Table("bundle_order_records as bor1").
|
||||
Select("bor1.*").
|
||||
Joins(`INNER JOIN (
|
||||
SELECT customer_id, MAX(created_at) AS max_created_time
|
||||
FROM bundle_order_records
|
||||
GROUP BY customer_id
|
||||
) bor2 ON bor1.customer_id = bor2.customer_id AND bor1.created_at = bor2.max_created_time`)
|
||||
session := app.ModuleClients.BundleDB.Table("`micro-account`.`user` AS u").Unscoped().
|
||||
Select(`bb.*, bor.bundle_name, bor.status,bor.amount AS payment_amount,bor.amount_type AS payment_type,bor.customer_num,
|
||||
bor.uuid as order_uuid, rn.name as user_name,bc.activate,bor.created_at as pay_time,
|
||||
u.tel_num as user_phone_number, u.id as user_id`).
|
||||
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id").
|
||||
Joins("LEFT JOIN (?) as bor ON bor.customer_id = u.id", subQuery).
|
||||
Joins("LEFT JOIN fiee_bundle.bundle_balance bb ON u.id = bb.user_id AND bb.order_uuid = bor.uuid").
|
||||
Joins("LEFT JOIN bundle_activate bc on bc.user_id = u.id").
|
||||
Where("rn.name IS NOT NULL").
|
||||
Where("u.deleted_at = 0").
|
||||
Where("u.id = ?", req.UserId).
|
||||
Where("bb.month = ?", time.Now().Format("2006-01")).
|
||||
Order("bor.expiration_time desc")
|
||||
err = session.First(&data).Error
|
||||
return
|
||||
}
|
||||
|
||||
func AddBundleBalanceByUserId(data model.BundleBalance) error {
|
||||
func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err error) {
|
||||
err = app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) (err error) {
|
||||
ba := model.BundleActivate{}
|
||||
if err := tx.Model(&model.BundleActivate{}).Where("user_id = ?", data.UserId).First(&ba).Error; err != nil || ba.Activate != 2 {
|
||||
return errors.New("套餐未激活")
|
||||
}
|
||||
oldData := model.BundleBalance{}
|
||||
if err := tx.Model(&model.BundleBalance{}).Where("user_id = ?", data.UserId).Where("month = ?", time.Now().Format("2006-01")).Order("created_at desc").First(&oldData).Error; err != nil {
|
||||
return errors.New("用户还没有套餐信息")
|
||||
}
|
||||
if data.AccountNumber > 0 { // 增加账号消耗数
|
||||
if oldData.BundleAccountConsumptionNumber < oldData.BundleAccountNumber { // 消耗账号数优先套餐内
|
||||
oldData.BundleAccountConsumptionNumber++
|
||||
usedType = 1
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseAccountConsumptionNumber < oldData.IncreaseAccountNumber { // 其次消耗增值的
|
||||
oldData.IncreaseAccountConsumptionNumber++
|
||||
usedType = 2
|
||||
goto Over
|
||||
}
|
||||
if oldData.ManualAccountConsumptionNumber < oldData.ManualAccountNumber { // 最后消耗手动扩展的
|
||||
oldData.ManualAccountConsumptionNumber++
|
||||
oldData.MonthlyManualAccountConsumptionNumber++
|
||||
usedType = 3
|
||||
goto Over
|
||||
}
|
||||
return errors.New("账号数不足")
|
||||
} else if data.AccountNumber < 0 { // 减少账号消耗数,用于解绑账号
|
||||
if oldData.ManualAccountConsumptionNumber > 0 { // 最后消耗手动扩展的
|
||||
oldData.ManualAccountConsumptionNumber--
|
||||
oldData.MonthlyManualAccountConsumptionNumber--
|
||||
usedType = 3
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseAccountConsumptionNumber > 0 {
|
||||
oldData.IncreaseAccountConsumptionNumber--
|
||||
usedType = 2
|
||||
goto Over
|
||||
}
|
||||
if oldData.BundleAccountConsumptionNumber > 0 {
|
||||
oldData.BundleAccountConsumptionNumber--
|
||||
usedType = 1
|
||||
goto Over
|
||||
}
|
||||
return errors.New("当前未绑定账号")
|
||||
}
|
||||
if data.VideoNumber > 0 {
|
||||
if oldData.MonthlyLimitVideoExpireNumber > oldData.MonthlyLimitVideoExpireConsumptionNumber { // 当月可使用的会过期的限制类型充足
|
||||
if oldData.BundleLimitVideoExpiredConsumptionNumber < oldData.BundleLimitVideoExpiredNumber { // 套餐内会过期的限制类型视频充足
|
||||
oldData.MonthlyLimitVideoExpireConsumptionNumber++
|
||||
oldData.BundleLimitVideoExpiredConsumptionNumber++
|
||||
oldData.MonthlyBundleVideoConsumptionNumber++
|
||||
usedType = 1
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseLimitVideoExpiredConsumptionNumber < oldData.IncreaseLimitVideoExpiredNumber { // 增值服务会过期的限制类型视频充足
|
||||
oldData.MonthlyLimitVideoExpireConsumptionNumber++
|
||||
oldData.IncreaseLimitVideoExpiredConsumptionNumber++
|
||||
oldData.MonthlyIncreaseVideoConsumptionNumber++
|
||||
usedType = 2
|
||||
goto Over
|
||||
}
|
||||
}
|
||||
if oldData.MonthlyLimitVideoNumber > oldData.MonthlyLimitVideoConsumptionNumber { // 当月可使用的不过期的限制类型充足
|
||||
if oldData.BundleLimitVideoConsumptionNumber < oldData.BundleLimitVideoNumber { // 套餐内不过期的限制类型视频充足
|
||||
oldData.MonthlyLimitVideoConsumptionNumber++
|
||||
oldData.BundleLimitVideoConsumptionNumber++
|
||||
oldData.MonthlyBundleVideoConsumptionNumber++
|
||||
usedType = 1
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseLimitVideoConsumptionNumber < oldData.IncreaseLimitVideoNumber { // 增值服务不过期的限制类型视频充足
|
||||
oldData.MonthlyLimitVideoConsumptionNumber++
|
||||
oldData.IncreaseLimitVideoConsumptionNumber++
|
||||
oldData.MonthlyIncreaseVideoConsumptionNumber++
|
||||
usedType = 2
|
||||
goto Over
|
||||
}
|
||||
}
|
||||
if oldData.BundleVideoConsumptionNumber < oldData.BundleVideoNumber { //套餐内非限制类型的视频充足
|
||||
oldData.BundleVideoConsumptionNumber++
|
||||
oldData.MonthlyBundleVideoConsumptionNumber++
|
||||
usedType = 1
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseVideoConsumptionNumber < oldData.IncreaseVideoNumber { //增值服务非限制类型的视频充足
|
||||
oldData.IncreaseVideoConsumptionNumber++
|
||||
oldData.MonthlyIncreaseVideoConsumptionNumber++
|
||||
usedType = 2
|
||||
goto Over
|
||||
}
|
||||
if oldData.ManualVideoConsumptionNumber < oldData.ManualDataAnalysisNumber { // 手动扩展类型充足
|
||||
oldData.ManualVideoConsumptionNumber++
|
||||
oldData.MonthlyManualVideoConsumptionNumber++ // 记录本月使用的手动扩展
|
||||
usedType = 3
|
||||
goto Over
|
||||
}
|
||||
return errors.New("可用视频数不足")
|
||||
}
|
||||
|
||||
if data.ImageNumber > 0 {
|
||||
if oldData.MonthlyLimitImageExpireNumber > oldData.MonthlyLimitImageExpireConsumptionNumber { // 当月可使用的会过期的限制类型充足
|
||||
if oldData.BundleLimitImageExpiredConsumptionNumber < oldData.BundleLimitImageExpiredNumber { // 套餐内会过期的限制类型图文充足
|
||||
oldData.MonthlyLimitImageExpireConsumptionNumber++
|
||||
oldData.BundleLimitImageExpiredConsumptionNumber++
|
||||
oldData.MonthlyBundleImageConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseLimitImageExpiredConsumptionNumber < oldData.IncreaseLimitImageExpiredNumber { // 增值服务会过期的限制类型图文充足
|
||||
oldData.MonthlyLimitImageExpireConsumptionNumber++
|
||||
oldData.IncreaseLimitImageExpiredConsumptionNumber++
|
||||
oldData.MonthlyIncreaseImageConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
}
|
||||
if oldData.MonthlyLimitImageNumber > oldData.MonthlyLimitImageConsumptionNumber { // 当月可使用的不过期的限制类型充足
|
||||
if oldData.BundleLimitImageConsumptionNumber < oldData.BundleLimitImageNumber { // 套餐内不过期的限制类型图文充足
|
||||
oldData.MonthlyLimitImageConsumptionNumber++
|
||||
oldData.BundleLimitImageConsumptionNumber++
|
||||
oldData.MonthlyBundleImageConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseLimitImageConsumptionNumber < oldData.IncreaseLimitImageNumber { // 增值服务不过期的限制类型图文充足
|
||||
oldData.MonthlyLimitImageConsumptionNumber++
|
||||
oldData.IncreaseLimitImageConsumptionNumber++
|
||||
oldData.MonthlyIncreaseImageConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
}
|
||||
if oldData.BundleImageConsumptionNumber < oldData.BundleImageNumber { //套餐内非限制类型的图文充足
|
||||
oldData.BundleImageConsumptionNumber++
|
||||
oldData.MonthlyBundleImageConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseImageConsumptionNumber < oldData.IncreaseImageNumber { //增值服务非限制类型的图文充足
|
||||
oldData.IncreaseImageConsumptionNumber++
|
||||
oldData.MonthlyIncreaseImageConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
if oldData.ManualImageConsumptionNumber < oldData.ManualDataAnalysisNumber { // 手动扩展类型充足
|
||||
oldData.ManualImageConsumptionNumber++
|
||||
oldData.MonthlyManualImageConsumptionNumber++ // 记录本月使用的手动扩展
|
||||
goto Over
|
||||
}
|
||||
return errors.New("可用图文数不足")
|
||||
}
|
||||
|
||||
if data.DataAnalysisNumber > 0 {
|
||||
if oldData.MonthlyLimitDataAnalysisExpireNumber > oldData.MonthlyLimitDataAnalysisExpireConsumptionNumber { // 当月可使用的会过期的限制类型充足
|
||||
if oldData.BundleLimitDataAnalysisExpiredConsumptionNumber < oldData.BundleLimitDataAnalysisExpiredNumber { // 套餐内会过期的限制类型数据分析充足
|
||||
oldData.MonthlyLimitDataAnalysisExpireConsumptionNumber++
|
||||
oldData.BundleLimitDataAnalysisExpiredConsumptionNumber++
|
||||
oldData.MonthlyBundleDataAnalysisConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseLimitDataAnalysisExpiredConsumptionNumber < oldData.IncreaseLimitDataAnalysisExpiredNumber { // 增值服务会过期的限制类型数据分析充足
|
||||
oldData.MonthlyLimitDataAnalysisExpireConsumptionNumber++
|
||||
oldData.IncreaseLimitDataAnalysisExpiredConsumptionNumber++
|
||||
oldData.MonthlyIncreaseDataAnalysisConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
}
|
||||
if oldData.MonthlyLimitDataAnalysisNumber > oldData.MonthlyLimitDataAnalysisConsumptionNumber { // 当月可使用的不过期的限制类型充足
|
||||
if oldData.BundleLimitDataAnalysisConsumptionNumber < oldData.BundleLimitDataAnalysisNumber { // 套餐内不过期的限制类型数据分析充足
|
||||
oldData.MonthlyLimitDataAnalysisConsumptionNumber++
|
||||
oldData.BundleLimitDataAnalysisConsumptionNumber++
|
||||
oldData.MonthlyBundleDataAnalysisConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseLimitDataAnalysisConsumptionNumber < oldData.IncreaseLimitDataAnalysisNumber { // 增值服务不过期的限制类型数据分析充足
|
||||
oldData.MonthlyLimitDataAnalysisConsumptionNumber++
|
||||
oldData.IncreaseLimitDataAnalysisConsumptionNumber++
|
||||
oldData.MonthlyIncreaseDataAnalysisConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
}
|
||||
if oldData.BundleLimitDataAnalysisNumber < oldData.BundleDataAnalysisNumber { //套餐内非限制类型的数据分析充足
|
||||
oldData.BundleLimitDataAnalysisNumber++
|
||||
oldData.MonthlyBundleDataAnalysisConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseDataAnalysisConsumptionNumber < oldData.IncreaseDataAnalysisNumber { //增值服务非限制类型的数据分析充足
|
||||
oldData.IncreaseDataAnalysisConsumptionNumber++
|
||||
oldData.MonthlyIncreaseDataAnalysisConsumptionNumber++
|
||||
goto Over
|
||||
}
|
||||
if oldData.ManualDataAnalysisConsumptionNumber < oldData.ManualDataAnalysisNumber { // 手动扩展类型充足
|
||||
oldData.ManualDataAnalysisConsumptionNumber++
|
||||
oldData.MonthlyManualDataAnalysisConsumptionNumber++ // 记录本月使用的手动扩展
|
||||
goto Over
|
||||
}
|
||||
return errors.New("可用数据分析数不足")
|
||||
}
|
||||
Over:
|
||||
return tx.Model(&model.BundleBalance{}).Where("id = ?", oldData.ID).Save(&oldData).Error
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func CreateUsedRecord(tx *gorm.DB, data model.BundleUsedRecord) error {
|
||||
return tx.Create(&data).Error
|
||||
}
|
||||
|
||||
func ExtendBundleBalanceByUserId(data model.BundleBalanceExtendPo) error {
|
||||
return app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {
|
||||
oldData := model.BundleBalance{}
|
||||
if err := tx.Model(&model.BundleBalance{}).Where("user_id = ?", data.UserId).Order("created_at desc").First(&oldData).Error; err != nil {
|
||||
return errors.New("用户还没有套餐信息")
|
||||
}
|
||||
newData := model.BundleBalance{
|
||||
Model: oldData.Model,
|
||||
UserId: oldData.UserId,
|
||||
OrderUUID: oldData.OrderUUID,
|
||||
AccountNumber: oldData.AccountNumber + data.AccountNumber,
|
||||
AccountConsumptionNumber: oldData.AccountConsumptionNumber + data.AccountConsumptionNumber,
|
||||
VideoNumber: oldData.VideoNumber + data.VideoNumber,
|
||||
VideoConsumptionNumber: oldData.VideoConsumptionNumber + data.VideoConsumptionNumber,
|
||||
ImageNumber: oldData.ImageNumber + data.ImageNumber,
|
||||
ImageConsumptionNumber: oldData.ImageConsumptionNumber + data.ImageConsumptionNumber,
|
||||
DataAnalysisNumber: oldData.DataAnalysisNumber + data.DataAnalysisNumber,
|
||||
DataAnalysisConsumptionNumber: oldData.DataAnalysisConsumptionNumber + data.DataAnalysisConsumptionNumber,
|
||||
ExpansionPacksNumber: oldData.ExpansionPacksNumber + data.ExpansionPacksNumber,
|
||||
}
|
||||
|
||||
if newData.AccountConsumptionNumber > newData.AccountNumber ||
|
||||
newData.VideoConsumptionNumber > newData.VideoNumber ||
|
||||
newData.ImageConsumptionNumber > newData.ImageNumber ||
|
||||
newData.DataAnalysisConsumptionNumber > newData.DataAnalysisNumber {
|
||||
return errors.New("套餐余量不足")
|
||||
}
|
||||
return tx.Model(&model.BundleBalance{}).Where("id = ?", oldData.ID).Save(&newData).Error
|
||||
oldData.ManualImageNumber += data.ImageNumber
|
||||
oldData.ManualDataAnalysisNumber += data.DataAnalysisNumber
|
||||
oldData.ManualVideoNumber += data.VideoNumber
|
||||
oldData.MonthlyNewDurationNumber += data.DurationNumber // 记录本月新增手动扩展时长
|
||||
oldData.ExpiredAt.Add(time.Hour * 24 * time.Duration(data.DurationNumber))
|
||||
return tx.Model(&model.BundleBalance{}).Where("id = ?", oldData.ID).Save(&oldData).Error
|
||||
})
|
||||
}
|
||||
|
||||
@ -314,3 +475,163 @@ func ToBeComfirmedWorks(req *bundle.ToBeComfirmedWorksReq) (data []model.CastWor
|
||||
func ConfirmWork(req *bundle.ConfirmWorkReq) error {
|
||||
return app.ModuleClients.BundleDB.Model(&model.CastWorkLog{}).Where(&model.CastWorkLog{WorkUuid: req.WorkUuid}).Update("confirmed_at", time.Now().Unix()).Error
|
||||
}
|
||||
|
||||
func BundleActivate(ids []uint32) error {
|
||||
for _, v := range ids {
|
||||
app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {
|
||||
activate := model.BundleActivate{}
|
||||
if err := tx.Model(&model.BundleActivate{}).Where("user_id = ?", v).First(&activate).Error; err != nil {
|
||||
balance := model.BundleBalance{}
|
||||
if err := tx.Model(&model.BundleBalance{}).Where("user_id = ?", v).First(&balance).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
balance.ExpiredAt = balance.ExpiredAt.Add(time.Since(balance.StartAt))
|
||||
balance.StartAt = time.Now()
|
||||
if err := tx.Model(&model.BundleBalance{}).Where("id = ?", balance.ID).Save(balance).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Model(&model.BundleActivate{}).Where("user_id = ?", v).Create(&model.BundleActivate{UserId: int(v), Activate: 2}).Error
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetValueAddByOrderUUID(orderUUID string) (data []model.BundleOrderValueAdd, err error) {
|
||||
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderValueAdd{}).Where("order_uuid = ?", orderUUID).Find(&data).Error
|
||||
return
|
||||
}
|
||||
|
||||
func UpdateBundleBalance() error {
|
||||
bl := []model.BundleBalance{}
|
||||
if err := app.ModuleClients.BundleDB.Raw(`select
|
||||
*
|
||||
from
|
||||
bundle_balance bb
|
||||
inner join (
|
||||
select
|
||||
max(bb.month) as month ,
|
||||
user_id
|
||||
from
|
||||
bundle_balance bb
|
||||
group by
|
||||
bb.user_id
|
||||
) newest on
|
||||
newest.month = bb.month
|
||||
and bb.user_id = newest.user_id
|
||||
and bb.expired_at > now()`).Find(&bl).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
now := time.Now()
|
||||
month := time.Now().Format("2006-01")
|
||||
for _, v := range bl {
|
||||
if v.Month == month {
|
||||
continue
|
||||
}
|
||||
|
||||
cal := func(total, limit int) int { // 计算本月发放的限制类型数量
|
||||
var released int // 已释放的次数
|
||||
if v.StartAt.Month() == now.Month() && v.StartAt.Year() == now.Year() {
|
||||
} else if v.StartAt.Day() >= 16 { //第一个月释放的
|
||||
released += limit/2 + 1
|
||||
} else {
|
||||
released += limit
|
||||
}
|
||||
interval := now.Year()*12 + int(now.Month()) - (v.StartAt.Year()*12 + int(v.StartAt.Month())) // 后续月份释放的
|
||||
released += interval * limit
|
||||
remaining := max(total-released, 0) // 还剩余多少次没有发放
|
||||
|
||||
if v.StartAt.Month() == now.Month() && v.StartAt.Year() == now.Year() && v.StartAt.Day() >= 16 { // 本月为第一个月并且16号后购买只给一半(向上取整)
|
||||
return min(limit/2+1, remaining)
|
||||
}
|
||||
if v.ExpiredAt.Month() == now.Month() && v.ExpiredAt.Year() == now.Year() && v.ExpiredAt.Day() < 16 { // 本月为最后一个月并且16号前到期只给一半(向下取整)
|
||||
return min(limit/2, remaining)
|
||||
}
|
||||
return min(limit, remaining)
|
||||
}
|
||||
|
||||
v.MonthlyInvalidBundleVideoNumber = v.MonthlyLimitVideoExpireNumber - v.MonthlyLimitVideoExpireConsumptionNumber // 当月过期的视频数
|
||||
v.InvalidBundleVideoNumber += v.MonthlyInvalidBundleVideoNumber
|
||||
v.MonthlyInvalidBundleImageNumber = v.MonthlyLimitImageExpireNumber - v.MonthlyLimitImageExpireConsumptionNumber
|
||||
v.InvalidBundleImageNumber += v.MonthlyInvalidBundleImageNumber
|
||||
v.MonthlyInvalidBundleDataAnalysisNumber = v.MonthlyLimitDataAnalysisExpireNumber - v.MonthlyLimitDataAnalysisExpireConsumptionNumber
|
||||
v.InvalidBundleDataAnalysisNumber += v.MonthlyInvalidBundleDataAnalysisNumber
|
||||
|
||||
// 当月可用的限制类型数等于本月方法的套餐和增值两种类型的总和
|
||||
v.MonthlyLimitVideoExpireNumber = cal(v.BundleLimitVideoExpiredNumber, v.MonthlyLimitVideoQuotaNumber) + cal(v.IncreaseLimitVideoExpiredNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||
v.MonthlyLimitVideoNumber = v.MonthlyLimitVideoNumber - v.MonthlyLimitVideoConsumptionNumber + cal(v.BundleLimitVideoNumber, v.MonthlyLimitVideoQuotaNumber) + cal(v.IncreaseLimitVideoNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||
v.MonthlyLimitImageExpireNumber = cal(v.BundleLimitImageExpiredNumber, v.MonthlyLimitImageQuotaNumber) + cal(v.IncreaseLimitImageExpiredNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
v.MonthlyLimitImageNumber = v.MonthlyLimitImageNumber - v.MonthlyLimitImageConsumptionNumber + cal(v.BundleLimitImageNumber, v.MonthlyLimitImageQuotaNumber) + cal(v.IncreaseLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
v.MonthlyLimitDataAnalysisExpireNumber = cal(v.BundleLimitDataAnalysisExpiredNumber, v.MonthlyLimitDataAnalysisQuotaNumber) + cal(v.IncreaseLimitDataAnalysisExpiredNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||
v.MonthlyLimitDataAnalysisNumber = v.MonthlyLimitDataAnalysisNumber - v.MonthlyLimitDataAnalysisConsumptionNumber + cal(v.BundleLimitDataAnalysisNumber, v.MonthlyLimitDataAnalysisQuotaNumber) + cal(v.IncreaseLimitDataAnalysisNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||
|
||||
v.MonthlyLimitVideoConsumptionNumber = 0 // 重置单月消耗数量
|
||||
v.MonthlyLimitVideoExpireConsumptionNumber = 0
|
||||
v.MonthlyManualVideoConsumptionNumber = 0
|
||||
v.MonthlyLimitImageConsumptionNumber = 0
|
||||
v.MonthlyLimitImageExpireConsumptionNumber = 0
|
||||
v.MonthlyManualImageConsumptionNumber = 0
|
||||
v.MonthlyLimitDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyLimitDataAnalysisExpireConsumptionNumber = 0
|
||||
v.MonthlyManualDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyBundleVideoConsumptionNumber = 0
|
||||
v.MonthlyBundleImageConsumptionNumber = 0
|
||||
v.MonthlyBundleDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyIncreaseVideoConsumptionNumber = 0
|
||||
v.MonthlyIncreaseImageConsumptionNumber = 0
|
||||
v.MonthlyIncreaseDataAnalysisConsumptionNumber = 0
|
||||
v.Month = month
|
||||
v.ID = 0
|
||||
app.ModuleClients.BundleDB.Create(&v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// excel导出前置信息
|
||||
func BalanceExportPrefix() (data []model.BundleExportDto, err error) {
|
||||
err = app.ModuleClients.BundleDB.DB.Raw(`select
|
||||
bor.pay_time as pay_time,
|
||||
bor.customer_num as customer_num,
|
||||
r.fee as fee,
|
||||
bor.customer_id as user_id,
|
||||
bor.amount as bundle_amount,
|
||||
total_amount as total_pay_amount
|
||||
from
|
||||
bundle_order_records bor
|
||||
right join (
|
||||
select
|
||||
max(created_at) as created_at
|
||||
from
|
||||
bundle_order_records bor
|
||||
group by
|
||||
bor.customer_id
|
||||
) newest on
|
||||
bor.created_at = newest.created_at
|
||||
left join (
|
||||
select
|
||||
sum(r.handling_fee) as fee,
|
||||
r.bundle_order_on
|
||||
from
|
||||
reconciliation r
|
||||
group by
|
||||
r.bundle_order_on
|
||||
) r on r.bundle_order_on = bor.order_no
|
||||
`).Scan(&data).Error
|
||||
return
|
||||
}
|
||||
|
||||
func GetBundleBalanceLayout(req *bundle.GetBundleBalanceLayoutReq) (string, error) {
|
||||
data := &model.BundleBalanceLayout{}
|
||||
if err := app.ModuleClients.BundleDB.Model(&model.BundleBalanceLayout{}).Where("user_id = ?", req.UserId).First(data).Error; err != nil {
|
||||
return "nil", err
|
||||
}
|
||||
return data.Data, nil
|
||||
}
|
||||
|
||||
func SetBundleBalanceLayout(req *bundle.SetBundleBalanceLayoutReq) error {
|
||||
return app.ModuleClients.BundleDB.Clauses(clause.OnConflict{
|
||||
Columns: []clause.Column{{Name: "user_id"}},
|
||||
DoUpdates: clause.AssignmentColumns([]string{"data"}),
|
||||
}).Create(&model.BundleBalanceLayout{Data: req.Data, UserId: uint64(req.UserId)}).Error
|
||||
}
|
||||
|
@ -732,25 +732,6 @@ func OnlyAddValueListByOrderNo(req *bundle.OnlyAddValueListByOrderNoRequest) (re
|
||||
// 返回成功响应
|
||||
return response, nil
|
||||
}
|
||||
func UpdateReconciliationStatusBySerialNumber(req *bundle.UpdateStatusAndPayTimeBySerialNumber) (res *bundle.CommonResponse, err error) {
|
||||
var existing model.Reconciliation
|
||||
if err := app.ModuleClients.BundleDB.Where("serial_number = ?", req.SerialNumber).First(&existing).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.New("对账单记录不存在")
|
||||
}
|
||||
return nil, fmt.Errorf("查询对账单失败: %v", err)
|
||||
}
|
||||
updates := model.Reconciliation{
|
||||
PayTime: req.PayTime,
|
||||
PayStatus: int(req.PaymentStatus),
|
||||
SerialNumber: req.SerialNumber,
|
||||
}
|
||||
if err := app.ModuleClients.BundleDB.Model(&existing).Updates(updates).Error; err != nil {
|
||||
return nil, fmt.Errorf("更新对账单失败: %v", err)
|
||||
}
|
||||
// 返回成功响应
|
||||
return &bundle.CommonResponse{Msg: "更新成功"}, nil
|
||||
}
|
||||
func DeleteValueAddService(req *bundle.DeleteValueAddServiceRequest) (res *bundle.CommonResponse, err error) {
|
||||
res = new(bundle.CommonResponse)
|
||||
var paidServices []*model.BundleOrderValueAdd
|
||||
@ -792,6 +773,26 @@ func DeleteValueAddService(req *bundle.DeleteValueAddServiceRequest) (res *bundl
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func UpdateReconciliationStatusBySerialNumber(req *bundle.UpdateStatusAndPayTimeBySerialNumber) (res *bundle.CommonResponse, err error) {
|
||||
var existing model.Reconciliation
|
||||
if err := app.ModuleClients.BundleDB.Where("serial_number = ?", req.SerialNumber).First(&existing).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.New("对账单记录不存在")
|
||||
}
|
||||
return nil, fmt.Errorf("查询对账单失败: %v", err)
|
||||
}
|
||||
updates := model.Reconciliation{
|
||||
PayTime: req.PayTime,
|
||||
PayStatus: int(req.PaymentStatus),
|
||||
SerialNumber: req.SerialNumber,
|
||||
}
|
||||
if err := app.ModuleClients.BundleDB.Model(&existing).Updates(updates).Error; err != nil {
|
||||
return nil, fmt.Errorf("更新对账单失败: %v", err)
|
||||
}
|
||||
// 返回成功响应
|
||||
return &bundle.CommonResponse{Msg: "更新成功"}, nil
|
||||
}
|
||||
|
||||
func ListUnfinishedInfos(req *bundle.AutoCreateUserAndOrderRequest) (res *bundle.UnfinishedInfos, err error) {
|
||||
res = new(bundle.UnfinishedInfos)
|
||||
res.UnfinishedInfos = make([]*bundle.UnfinishedInfo, 0)
|
||||
|
967
internal/dao/taskDao.go
Normal file
967
internal/dao/taskDao.go
Normal file
@ -0,0 +1,967 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"micro-bundle/internal/model"
|
||||
"micro-bundle/pkg/app"
|
||||
commonErr "micro-bundle/pkg/err"
|
||||
"micro-bundle/pkg/msg"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// TaskQueryRequest 查询待指派任务记录请求参数
|
||||
type TaskQueryRequest struct {
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
Page int `json:"page"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页数量
|
||||
SortBy string `json:"sortBy"` // 排序字段
|
||||
SortType string `json:"sortType"` // 排序类型 asc/desc
|
||||
}
|
||||
|
||||
// TaskAssignRequest 指派任务请求参数
|
||||
type TaskAssignRequest struct {
|
||||
SubNum string `json:"subNum"` // 艺人编号
|
||||
TelNum string `json:"telNum"` // 艺人手机号
|
||||
ArtistName string `json:"artistName"` // 艺人姓名
|
||||
TaskAssignee string `json:"taskAssignee"` // 任务指派人
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 任务指派人账号
|
||||
Operator string `json:"operator"` // 操作人
|
||||
OperatorNum string `json:"operatorNum"` // 操作人账号
|
||||
AssignVideoCount int `json:"assignVideoCount"` // 指派视频数
|
||||
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
||||
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
||||
}
|
||||
|
||||
// UpdatePendingCountRequest 修改待发数量请求参数
|
||||
type UpdatePendingCountRequest struct {
|
||||
SubNum string `json:"subNum"` // 艺人编号
|
||||
TelNum string `json:"telNum"` // 艺人手机号
|
||||
ArtistName string `json:"artistName"` // 艺人姓名
|
||||
PendingVideoCount int `json:"pendingVideoCount"` // 待发视频数量
|
||||
PendingPostCount int `json:"pendingPostCount"` // 待发图文数量
|
||||
PendingDataCount int `json:"pendingDataCount"` // 待发数据数量
|
||||
Operator string `json:"operator"` // 操作人
|
||||
OperatorNum string `json:"operatorNum"` // 操作人账号
|
||||
}
|
||||
|
||||
// EmployeeTaskQueryRequest 员工任务查询请求参数
|
||||
type EmployeeTaskQueryRequest struct {
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 被指派人账号
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
Operator string `json:"operator"` // 操作人
|
||||
SortBy string `json:"sortBy"` // 排序字段
|
||||
StartTime string `json:"startTime"` // 指派开始时间
|
||||
EndTime string `json:"endTime"` // 指派结束时间
|
||||
StartCompleteTime string `json:"startCompleteTime"` // 开始完成时间
|
||||
EndCompleteTime string `json:"endCompleteTime"` // 结束完成时间
|
||||
Status int `json:"status"` // 反馈完成状态
|
||||
|
||||
Page int `json:"page"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页数量
|
||||
}
|
||||
|
||||
// CompleteTaskRequest 完成任务请求参数
|
||||
type CompleteTaskRequest struct {
|
||||
AssignRecordsUUID string `json:"assignRecordsUUID,omitempty"` // 指派记录UUID(可选)
|
||||
EmployeeName string `json:"employeeName"` // 员工姓名(必要)
|
||||
EmployeeNum string `json:"employeeNum"` // 员工工号(必要)
|
||||
TaskType string `json:"taskType"` // 任务类型: video/post/data
|
||||
CompleteCount int `json:"completeCount"` // 完成数量
|
||||
}
|
||||
|
||||
// TaskAssignRecordsQueryRequest 多条件查询操作记录表请求参数
|
||||
type TaskAssignRecordsQueryRequest struct {
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
TaskAssignee string `json:"taskAssignee"` // 指派人姓名
|
||||
Operator string `json:"operator"` // 操作人姓名
|
||||
OperatorNum string `json:"operatorNum"` // 操作人手机号
|
||||
StartTime string `json:"startTime"` // 操作开始时间
|
||||
EndTime string `json:"endTime"` // 操作结束时间
|
||||
Status int `json:"status"` // 反馈完成状态 0:全部 1:未完成 2:完成
|
||||
ActualStatus int `json:"actualStatus"` // 实际完成状态 0:全部 1:未完成 2:完成
|
||||
Page int `json:"page"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页数量
|
||||
}
|
||||
|
||||
// 待指派任务 response
|
||||
type TaskQueryResponse struct {
|
||||
SubNum string `json:"subNum"`
|
||||
TelNum string `json:"telNum"`
|
||||
ArtistName string `json:"artistName"`
|
||||
PendingVideoCount int `gorm:"column:pending_video_count;comment:待发视频数量" json:"pendingVideoCount"`
|
||||
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
||||
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
||||
ProgressTaskCount int `gorm:"column:progress_task_count;comment:进行中的任务数量" json:"progressTaskCount"`
|
||||
CompleteTaskCount int `gorm:"column:complete_task_count;comment:已完成任务数量" json:"completeTaskCount"`
|
||||
LastTaskAssignee string `gorm:"column:last_task_assignee;comment:最后一次的任务指派人" json:"lastTaskAssignee"`
|
||||
TaskAssigneeNum string `gorm:"column:task_assignee_num;comment:最后一次指派人账号" json:"taskAssigneeNum"`
|
||||
}
|
||||
|
||||
// 任务记录表返回结构体
|
||||
type TaskAssignRecordsResponse struct {
|
||||
AssignRecordsUUID string `gorm:"column:assign_records_uuid;comment:指派记录UUID" json:"assignRecordsUUID"`
|
||||
SubNum string `gorm:"column:sub_num;comment:艺人编号" json:"subNum"`
|
||||
TelNum string `gorm:"column:tel_num;comment:艺人手机号" json:"telNum"`
|
||||
ArtistName string `gorm:"column:artist_name;comment:艺人名称" json:"artistName"`
|
||||
Status int `gorm:"column:status;comment:反馈完成状态 1:未完成 2:完成" json:"status"`
|
||||
ActualStatus int `gorm:"column:actual_status;comment:实际完成状态 1:未完成 2:完成" json:"actualStatus"`
|
||||
CompleteTime *time.Time `gorm:"column:complete_time;comment:反馈完成时间" json:"completeTime"`
|
||||
OperatorType int `gorm:"column:operator_type;comment:操作类型 1:修改待发数量 2:指派" json:"operatorType"`
|
||||
Operator string `gorm:"column:operator;comment:操作人" json:"operator"`
|
||||
OperatorNum string `gorm:"column:operator_num;comment:操作人账号" json:"operatorNum"`
|
||||
OperatorTime time.Time `gorm:"column:operator_time;comment:操作时间" json:"operatorTime"`
|
||||
TaskAssignee string `gorm:"column:task_assignee;comment:任务指派人" json:"taskAssignee"`
|
||||
TaskAssigneeNum string `gorm:"column:task_assignee_num;comment:任务指派人账号" json:"taskAssigneeNum"`
|
||||
PendingVideoCount int `gorm:"column:pending_video_count;comment:待发视频数量" json:"pendingVideoCount"`
|
||||
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
||||
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
||||
}
|
||||
|
||||
// 任务指派记录数量结构体
|
||||
type TaskAssignRecords struct {
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 任务指派人工号
|
||||
ProgressTaskCount int `json:"progressTaskCount"` // 进行中任务数量
|
||||
CompleteTaskCount int `json:"completeTaskCount"` // 已完成任务数量
|
||||
}
|
||||
|
||||
// ValidArtistInfo 有效艺人信息结构体
|
||||
type ValidArtistInfo struct {
|
||||
UserID int `json:"userId"` // 用户ID
|
||||
CustomerNum string `json:"customerNum"` // 艺人编号
|
||||
UserName string `json:"userName"` // 艺人姓名
|
||||
UserPhoneNumber string `json:"userPhoneNumber"` // 艺人手机号
|
||||
BundleName string `json:"bundleName"` // 套餐名称
|
||||
ExpirationTime string `json:"expirationTime"` // 过期时间
|
||||
Status int `json:"status"` // 套餐状态
|
||||
OrderUUID string `json:"orderUUID"` // 订单UUID
|
||||
AccountNumber int `json:"accountNumber"` // 账号数量
|
||||
AccountConsumptionNumber int `json:"accountConsumptionNumber"` // 账号消耗数量
|
||||
VideoNumber int `json:"videoNumber"` // 视频数量
|
||||
VideoConsumptionNumber int `json:"videoConsumptionNumber"` // 视频消耗数量
|
||||
ImageNumber int `json:"imageNumber"` // 图片数量
|
||||
ImageConsumptionNumber int `json:"imageConsumptionNumber"` // 图片消耗数量
|
||||
DataAnalysisNumber int `json:"dataAnalysisNumber"` // 数据分析数量
|
||||
DataAnalysisConsumptionNumber int `json:"dataAnalysisConsumptionNumber"` // 数据分析消耗数量
|
||||
ExpansionPacksNumber int `json:"expansionPacksNumber"` // 扩展套餐数量
|
||||
}
|
||||
|
||||
// ArtistBundleBalanceRequest 查询艺人套餐剩余数量请求参数
|
||||
type ArtistBundleBalanceRequest struct {
|
||||
CustomerNum string `json:"customerNum"` // 艺人编号(推荐使用)
|
||||
TelNum string `json:"telNum"` // 艺人手机号(备选)
|
||||
}
|
||||
|
||||
// ArtistBundleBalanceResponse 艺人套餐剩余数量响应结构体
|
||||
type ArtistBundleBalanceResponse struct {
|
||||
RemainingVideoCount int `json:"remainingVideoCount"` // 剩余视频数量 (video_number - video_consumption_number)
|
||||
RemainingImageCount int `json:"remainingImageCount"` // 剩余图片数量 (image_number - image_consumption_number)
|
||||
RemainingDataAnalysisCount int `json:"remainingDataAnalysisCount"` // 剩余数据分析数量 (data_analysis_number - data_analysis_consumption_number)
|
||||
}
|
||||
|
||||
// GetPendingTaskList 查询待指派任务记录
|
||||
// 根据套餐没有过期的艺人查询TaskManagement表中的记录,如果不存在则构建默认值
|
||||
func GetPendingTaskList(req *TaskQueryRequest, validArtist []ValidArtistInfo) ([]*model.TaskManagement, int64, error) {
|
||||
// 构建有效艺人ID列表
|
||||
var validArtistIDs []string
|
||||
for _, artist := range validArtist {
|
||||
if artist.CustomerNum != "" {
|
||||
validArtistIDs = append(validArtistIDs, artist.CustomerNum)
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有有效艺人,直接返回空结果
|
||||
if len(validArtistIDs) == 0 {
|
||||
return []*model.TaskManagement{}, 0, nil
|
||||
}
|
||||
|
||||
// 第一步:查询所有有效艺人在数据库中的存在情况(不应用关键词过滤)
|
||||
var existingTasks []*model.TaskManagement
|
||||
existQuery := app.ModuleClients.TaskBenchDB.Model(&model.TaskManagement{}).Where("sub_num IN (?)", validArtistIDs)
|
||||
err := existQuery.Find(&existingTasks).Error
|
||||
if err != nil {
|
||||
return nil, 0, commonErr.ReturnError(err, msg.ErrorGetBundleList, "查询现有任务记录失败: ")
|
||||
}
|
||||
|
||||
// 创建已存在艺人编号的映射
|
||||
existingSubNums := make(map[string]bool)
|
||||
for _, task := range existingTasks {
|
||||
existingSubNums[task.SubNum] = true
|
||||
}
|
||||
|
||||
// 创建艺人编号到艺人信息的映射,便于快速查找
|
||||
artistMap := make(map[string]ValidArtistInfo)
|
||||
for _, artist := range validArtist {
|
||||
artistMap[artist.CustomerNum] = artist
|
||||
}
|
||||
|
||||
// 为不存在的艺人创建默认记录
|
||||
var newTasksToCreate []*model.TaskManagement
|
||||
for _, subNum := range validArtistIDs {
|
||||
if !existingSubNums[subNum] {
|
||||
artist := artistMap[subNum]
|
||||
// 构建默认任务记录
|
||||
defaultTask := &model.TaskManagement{
|
||||
SubNum: subNum,
|
||||
TelNum: artist.UserPhoneNumber,
|
||||
ArtistName: artist.UserName,
|
||||
PendingVideoCount: artist.VideoNumber - artist.VideoConsumptionNumber,
|
||||
PendingPostCount: artist.ImageNumber - artist.ImageConsumptionNumber,
|
||||
PendingDataCount: artist.DataAnalysisNumber - artist.DataAnalysisConsumptionNumber,
|
||||
ProgressCount: 0,
|
||||
CompleteCount: 0,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
newTasksToCreate = append(newTasksToCreate, defaultTask)
|
||||
}
|
||||
}
|
||||
|
||||
// 批量创建新的任务记录
|
||||
if len(newTasksToCreate) > 0 {
|
||||
if err := app.ModuleClients.TaskBenchDB.Create(&newTasksToCreate).Error; err != nil {
|
||||
return nil, 0, commonErr.ReturnError(err, msg.ErrorGetBundleList, "创建默认任务记录失败: ")
|
||||
}
|
||||
}
|
||||
|
||||
// 第二步:应用完整的查询条件进行最终查询
|
||||
var tasks []*model.TaskManagement
|
||||
var total int64
|
||||
|
||||
// 构建最终查询条件
|
||||
query := app.ModuleClients.TaskBenchDB.Model(&model.TaskManagement{})
|
||||
|
||||
// 限制在有效艺人范围内
|
||||
query = query.Where("sub_num IN (?)", validArtistIDs)
|
||||
|
||||
// 关键词搜索(艺人姓名、编号、手机号)
|
||||
if req.Keyword != "" {
|
||||
query = query.Where("sub_num LIKE ? OR tel_num LIKE ? OR artist_name LIKE ?",
|
||||
"%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
|
||||
}
|
||||
|
||||
// 计算总数
|
||||
query.Count(&total)
|
||||
|
||||
// 排序
|
||||
if req.SortBy != "" && req.SortType != "" {
|
||||
orderClause := fmt.Sprintf("%s %s", req.SortBy, req.SortType)
|
||||
query = query.Order(orderClause)
|
||||
} else {
|
||||
// 默认按待发视频降序
|
||||
query = query.Order("pending_video_count DESC")
|
||||
}
|
||||
|
||||
// 分页
|
||||
if req.PageSize > 0 && req.Page > 0 {
|
||||
offset := (req.Page - 1) * req.PageSize
|
||||
query = query.Limit(req.PageSize).Offset(offset)
|
||||
}
|
||||
|
||||
err = query.Find(&tasks).Error
|
||||
if err != nil {
|
||||
return nil, 0, commonErr.ReturnError(err, msg.ErrorGetBundleList, "查询待指派任务记录失败: ")
|
||||
}
|
||||
|
||||
return tasks, total, nil
|
||||
}
|
||||
|
||||
// AssignTask 指派某位员工完成某个艺人的任务
|
||||
func AssignTask(req *TaskAssignRequest, progressTaskCount int, completeTaskCount int) error {
|
||||
// 开启事务
|
||||
tx := app.ModuleClients.TaskBenchDB.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
// 1. 查询当前艺人的任务记录
|
||||
var taskManagement model.TaskManagement
|
||||
err := tx.Where("sub_num = ? AND tel_num = ?", req.SubNum, req.TelNum).First(&taskManagement).Error
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
// 如果不存在,创建新记录
|
||||
taskManagement = model.TaskManagement{
|
||||
SubNum: req.SubNum,
|
||||
TelNum: req.TelNum,
|
||||
ArtistName: req.ArtistName,
|
||||
PendingVideoCount: 0,
|
||||
PendingPostCount: 0,
|
||||
PendingDataCount: 0,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
if err = tx.Create(&taskManagement).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "创建任务记录失败", "创建任务记录失败: ")
|
||||
}
|
||||
} else {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "查询任务记录失败", "查询任务记录失败: ")
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 检查待发数量是否大于0
|
||||
if taskManagement.PendingVideoCount <= 0 && taskManagement.PendingPostCount <= 0 && taskManagement.PendingDataCount <= 0 {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(nil, "无可指派任务", "当前艺人待发视频数、图文数、数据数均为0,无法指派任务")
|
||||
}
|
||||
|
||||
// 3. 检查指派数量是否合理(增强验证)
|
||||
if req.AssignVideoCount < 0 || req.AssignPostCount < 0 || req.AssignDataCount < 0 {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(nil, "指派数量不能为负数", "指派数量必须大于等于0")
|
||||
}
|
||||
|
||||
if req.AssignVideoCount > taskManagement.PendingVideoCount ||
|
||||
req.AssignPostCount > taskManagement.PendingPostCount ||
|
||||
req.AssignDataCount > taskManagement.PendingDataCount {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(nil, "指派数量超出限制",
|
||||
fmt.Sprintf("指派数量不能超过待发数量。当前待发:视频%d,图文%d,数据%d",
|
||||
taskManagement.PendingVideoCount, taskManagement.PendingPostCount, taskManagement.PendingDataCount))
|
||||
}
|
||||
|
||||
if req.AssignVideoCount == 0 && req.AssignPostCount == 0 && req.AssignDataCount == 0 {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(nil, "指派数量不能全为0", "至少需要指派一种类型的任务")
|
||||
}
|
||||
|
||||
// 4. 更新TaskManagement表
|
||||
updateData := map[string]interface{}{
|
||||
"pending_video_count": taskManagement.PendingVideoCount - req.AssignVideoCount,
|
||||
"pending_post_count": taskManagement.PendingPostCount - req.AssignPostCount,
|
||||
"pending_data_count": taskManagement.PendingDataCount - req.AssignDataCount,
|
||||
"last_task_assignee": req.TaskAssignee,
|
||||
"task_assignee_num": req.TaskAssigneeNum,
|
||||
"progress_count": progressTaskCount,
|
||||
"complete_count": completeTaskCount,
|
||||
"updated_at": time.Now(),
|
||||
}
|
||||
|
||||
if err = tx.Model(&taskManagement).Updates(updateData).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "更新任务记录失败", "更新任务记录失败: ")
|
||||
}
|
||||
|
||||
// 5. 创建指派记录
|
||||
assignRecord := &model.TaskAssignRecords{
|
||||
AssignRecordsUUID: uuid.New().String(), // 使用Google UUID
|
||||
SubNum: req.SubNum,
|
||||
TelNum: req.TelNum,
|
||||
ArtistName: req.ArtistName,
|
||||
Status: 1, // 1:未完成
|
||||
ActualStatus: 1, // 1:未完成
|
||||
OperatorType: 2, // 2:指派
|
||||
Operator: req.Operator, // 当前操作人名字
|
||||
OperatorNum: req.OperatorNum, // 当前操作人账号
|
||||
OperatorTime: time.Now(),
|
||||
TaskAssignee: req.TaskAssignee, // 指派员工姓名
|
||||
TaskAssigneeNum: req.TaskAssigneeNum, // 指派员工账号
|
||||
PendingVideoCount: taskManagement.PendingVideoCount,
|
||||
PendingPostCount: taskManagement.PendingPostCount,
|
||||
PendingDataCount: taskManagement.PendingDataCount,
|
||||
AssignVideoCount: req.AssignVideoCount,
|
||||
AssignPostCount: req.AssignPostCount,
|
||||
AssignDataCount: req.AssignDataCount,
|
||||
CompleteVideoCount: 0,
|
||||
CompletePostCount: 0,
|
||||
CompleteDataCount: 0,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
|
||||
if err = tx.Create(assignRecord).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "创建指派记录失败", "创建指派记录失败: ")
|
||||
}
|
||||
|
||||
// 提交事务
|
||||
if err = tx.Commit().Error; err != nil {
|
||||
return commonErr.ReturnError(err, "提交事务失败", "提交事务失败: ")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdatePendingCount 修改待发数量
|
||||
func UpdatePendingCount(req *UpdatePendingCountRequest) error {
|
||||
// 开启事务
|
||||
tx := app.ModuleClients.TaskBenchDB.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
// 1. 查询或创建TaskManagement记录
|
||||
var taskManagement model.TaskManagement
|
||||
err := tx.Where("sub_num = ? AND tel_num = ?", req.SubNum, req.TelNum).First(&taskManagement).Error
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return commonErr.ReturnError(err, "无该艺人任务记录", "无该艺人任务记录")
|
||||
} else {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "查询任务记录失败", "查询任务记录失败: ")
|
||||
}
|
||||
} else {
|
||||
// 更新现有记录
|
||||
updateData := map[string]interface{}{
|
||||
"pending_video_count": req.PendingVideoCount,
|
||||
"pending_post_count": req.PendingPostCount,
|
||||
"pending_data_count": req.PendingDataCount,
|
||||
"updated_at": time.Now(),
|
||||
}
|
||||
if err = tx.Model(&taskManagement).Updates(updateData).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "更新任务记录失败", "更新任务记录失败: ")
|
||||
}
|
||||
}
|
||||
|
||||
// 提交事务
|
||||
if err = tx.Commit().Error; err != nil {
|
||||
return commonErr.ReturnError(err, "提交事务失败", "提交事务失败: ")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetRecentAssignRecords 查询最近被指派记录
|
||||
// 查询操作类型为"指派"的最近n条不同员工的记录
|
||||
func GetRecentAssignRecords(limit int) ([]*model.TaskAssignRecords, error) {
|
||||
var records []*model.TaskAssignRecords
|
||||
|
||||
// 查询操作类型为指派(2)的记录,按操作时间倒序,去重员工
|
||||
err := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{}).
|
||||
Where("operator_type = ?", 2). // 2:指派
|
||||
Group("task_assignee_num"). // 按指派人账号分组去重
|
||||
Order("operator_time DESC"). // 按操作时间倒序
|
||||
Limit(limit).
|
||||
Find(&records).Error
|
||||
|
||||
if err != nil {
|
||||
return nil, commonErr.ReturnError(err, "查询最近指派记录失败", "查询最近指派记录失败: ")
|
||||
}
|
||||
|
||||
return records, nil
|
||||
}
|
||||
|
||||
// GetEmployeeAssignedTasks 根据登录人信息查询被指派给该员工的艺人任务
|
||||
func GetEmployeeAssignedTasks(req *EmployeeTaskQueryRequest) ([]*model.TaskAssignRecords, int64, error) {
|
||||
var records []*model.TaskAssignRecords
|
||||
var total int64
|
||||
|
||||
// 构建查询条件
|
||||
query := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{}).
|
||||
Where("task_assignee_num = ?", req.TaskAssigneeNum)
|
||||
|
||||
// 关键词搜索(艺人姓名、编号、手机号)
|
||||
if req.Keyword != "" {
|
||||
query = query.Where("sub_num LIKE ? OR tel_num LIKE ? OR artist_name LIKE ?",
|
||||
"%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
|
||||
}
|
||||
|
||||
// 被指派人姓名
|
||||
if req.Operator != "" {
|
||||
query = query.Where("task_assignee LIKE ?", "%"+req.Operator+"%")
|
||||
}
|
||||
|
||||
// 指派时间区间
|
||||
if req.StartTime != "" && req.EndTime != "" {
|
||||
query = query.Where("operator_time BETWEEN ? AND ?", req.StartTime, req.EndTime)
|
||||
} else if req.StartTime != "" {
|
||||
query = query.Where("operator_time >= ?", req.StartTime)
|
||||
} else if req.EndTime != "" {
|
||||
query = query.Where("operator_time <= ?", req.EndTime)
|
||||
}
|
||||
|
||||
// 完成时间区间
|
||||
if req.StartCompleteTime != "" && req.EndCompleteTime != "" {
|
||||
query = query.Where("complete_time BETWEEN ? AND ?", req.StartCompleteTime, req.EndCompleteTime)
|
||||
} else if req.StartCompleteTime != "" {
|
||||
query = query.Where("complete_time >= ?", req.StartCompleteTime)
|
||||
} else if req.EndCompleteTime != "" {
|
||||
query = query.Where("complete_time <= ?", req.EndCompleteTime)
|
||||
}
|
||||
|
||||
// 反馈完成状态
|
||||
if req.Status != 0 {
|
||||
query = query.Where("status = ?", req.Status)
|
||||
}
|
||||
|
||||
// 根据排序字段倒序
|
||||
if req.SortBy != "" {
|
||||
query = query.Order(req.SortBy + " DESC")
|
||||
}
|
||||
|
||||
// 计算总数
|
||||
query.Count(&total)
|
||||
|
||||
// 分页
|
||||
if req.PageSize > 0 && req.Page > 0 {
|
||||
offset := (req.Page - 1) * req.PageSize
|
||||
query = query.Limit(req.PageSize).Offset(offset)
|
||||
}
|
||||
|
||||
// 按操作时间倒序
|
||||
err := query.Order("operator_time DESC").Find(&records).Error
|
||||
if err != nil {
|
||||
return nil, 0, commonErr.ReturnError(err, "查询员工指派任务失败", "查询员工指派任务失败: ")
|
||||
}
|
||||
|
||||
return records, total, nil
|
||||
}
|
||||
|
||||
// CompleteTaskManually 员工手动点击完成任务
|
||||
func CompleteTaskManually(assignRecordsUUID string) error {
|
||||
now := time.Now()
|
||||
updateData := map[string]interface{}{
|
||||
"status": 2, // 2:完成
|
||||
"complete_time": &now,
|
||||
"updated_at": now,
|
||||
}
|
||||
|
||||
err := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{}).
|
||||
Where("assign_records_uuid = ?", assignRecordsUUID).
|
||||
Updates(updateData).Error
|
||||
|
||||
if err != nil {
|
||||
return commonErr.ReturnError(err, "更新任务完成状态失败", "更新任务完成状态失败: ")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateTaskProgress 员工实际完成任务状态更新
|
||||
// 员工调用视频、图文、数据时,对应的待完成数据减一,已完成数据加一
|
||||
func UpdateTaskProgress(req *CompleteTaskRequest) error {
|
||||
// 开启事务
|
||||
tx := app.ModuleClients.TaskBenchDB.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
// 1. 查询指派记录
|
||||
var assignRecord model.TaskAssignRecords
|
||||
var err error
|
||||
|
||||
if req.AssignRecordsUUID != "" {
|
||||
// 如果提供了UUID,直接根据UUID查询
|
||||
err = tx.Where("assign_records_uuid = ?", req.AssignRecordsUUID).First(&assignRecord).Error
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "查询指派记录失败", "查询指派记录失败: ")
|
||||
}
|
||||
} else {
|
||||
// 如果没有提供UUID,根据员工信息查询最早的未完成任务
|
||||
if req.EmployeeName == "" || req.EmployeeNum == "" {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(nil, "参数错误", "员工姓名和手机号不能为空")
|
||||
}
|
||||
|
||||
err = tx.Where("task_assignee = ? AND task_assignee_num = ? AND actual_status = 1",
|
||||
req.EmployeeName, req.EmployeeNum).
|
||||
Order("operator_time ASC").
|
||||
First(&assignRecord).Error
|
||||
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(nil, "未找到任务记录", "该员工没有未完成的任务记录")
|
||||
}
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "查询指派记录失败", "查询指派记录失败: ")
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 根据任务类型更新完成数量
|
||||
updateData := map[string]interface{}{
|
||||
"updated_at": time.Now(),
|
||||
}
|
||||
|
||||
switch req.TaskType {
|
||||
case "video":
|
||||
newCompleteCount := assignRecord.CompleteVideoCount + req.CompleteCount
|
||||
if newCompleteCount > assignRecord.AssignVideoCount {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(nil, "完成数量超出限制", "视频完成数量不能超过指派数量")
|
||||
}
|
||||
updateData["complete_video_count"] = newCompleteCount
|
||||
case "post":
|
||||
newCompleteCount := assignRecord.CompletePostCount + req.CompleteCount
|
||||
if newCompleteCount > assignRecord.AssignPostCount {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(nil, "完成数量超出限制", "图文完成数量不能超过指派数量")
|
||||
}
|
||||
updateData["complete_post_count"] = newCompleteCount
|
||||
case "data":
|
||||
newCompleteCount := assignRecord.CompleteDataCount + req.CompleteCount
|
||||
if newCompleteCount > assignRecord.AssignDataCount {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(nil, "完成数量超出限制", "数据完成数量不能超过指派数量")
|
||||
}
|
||||
updateData["complete_data_count"] = newCompleteCount
|
||||
default:
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(nil, "无效的任务类型", "任务类型必须是video、post或data")
|
||||
}
|
||||
|
||||
// 3. 更新指派记录
|
||||
if err = tx.Model(&assignRecord).Updates(updateData).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "更新完成数量失败", "更新完成数量失败: ")
|
||||
}
|
||||
|
||||
// 4. 重新查询更新后的记录,检查是否全部完成
|
||||
if err = tx.Where("assign_records_uuid = ?", assignRecord.AssignRecordsUUID).First(&assignRecord).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "查询更新后记录失败", "查询更新后记录失败: ")
|
||||
}
|
||||
|
||||
// 5. 检查是否所有任务都已完成
|
||||
if assignRecord.CompleteVideoCount == assignRecord.AssignVideoCount &&
|
||||
assignRecord.CompletePostCount == assignRecord.AssignPostCount &&
|
||||
assignRecord.CompleteDataCount == assignRecord.AssignDataCount {
|
||||
// 更新实际完成状态
|
||||
if err = tx.Model(&assignRecord).Update("actual_status", 2).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "更新实际完成状态失败", "更新实际完成状态失败: ")
|
||||
}
|
||||
}
|
||||
|
||||
// 提交事务
|
||||
if err = tx.Commit().Error; err != nil {
|
||||
return commonErr.ReturnError(err, "提交事务失败", "提交事务失败: ")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetTaskManagementBySubNum 根据艺人编号查询任务管理记录
|
||||
func GetTaskManagementBySubNum(subNum string) (*model.TaskManagement, error) {
|
||||
var task model.TaskManagement
|
||||
err := app.ModuleClients.TaskBenchDB.Where("sub_num = ?", subNum).First(&task).Error
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return nil, nil // 记录不存在
|
||||
}
|
||||
return nil, commonErr.ReturnError(err, "查询任务管理记录失败", "查询任务管理记录失败: ")
|
||||
}
|
||||
return &task, nil
|
||||
}
|
||||
|
||||
// GetAssignRecordByUUID 根据UUID查询指派记录
|
||||
func GetAssignRecordByUUID(uuid string) (*model.TaskAssignRecords, error) {
|
||||
var record model.TaskAssignRecords
|
||||
err := app.ModuleClients.TaskBenchDB.Where("assign_records_uuid = ?", uuid).First(&record).Error
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return nil, nil // 记录不存在
|
||||
}
|
||||
return nil, commonErr.ReturnError(err, "查询指派记录失败", "查询指派记录失败: ")
|
||||
}
|
||||
return &record, nil
|
||||
}
|
||||
|
||||
// GetTaskAssignRecordsList 多条件查询操作记录表
|
||||
// 支持通过艺人信息、指派人、操作人、操作时间、完成状态等多条件查询TaskAssignRecords表
|
||||
func GetTaskAssignRecordsList(req *TaskAssignRecordsQueryRequest) ([]*model.TaskAssignRecords, int64, error) {
|
||||
var records []*model.TaskAssignRecords
|
||||
var total int64
|
||||
|
||||
// 构建查询条件
|
||||
query := app.ModuleClients.TaskBenchDB.Model(&model.TaskAssignRecords{})
|
||||
|
||||
// 关键词搜索(艺人姓名、编号、手机号)
|
||||
if req.Keyword != "" {
|
||||
query = query.Where("sub_num LIKE ? OR tel_num LIKE ? OR artist_name LIKE ?",
|
||||
"%"+req.Keyword+"%", "%"+req.Keyword+"%", "%"+req.Keyword+"%")
|
||||
}
|
||||
|
||||
// 指派人姓名
|
||||
if req.TaskAssignee != "" {
|
||||
query = query.Where("task_assignee LIKE ?", "%"+req.TaskAssignee+"%")
|
||||
}
|
||||
|
||||
// 操作人姓名
|
||||
if req.Operator != "" {
|
||||
query = query.Where("operator LIKE ?", "%"+req.Operator+"%")
|
||||
}
|
||||
|
||||
// 操作人手机号
|
||||
if req.OperatorNum != "" {
|
||||
query = query.Where("operator_num LIKE ?", "%"+req.OperatorNum+"%")
|
||||
}
|
||||
|
||||
// 操作时间区间
|
||||
if req.StartTime != "" && req.EndTime != "" {
|
||||
query = query.Where("operator_time BETWEEN ? AND ?", req.StartTime, req.EndTime)
|
||||
} else if req.StartTime != "" {
|
||||
query = query.Where("operator_time >= ?", req.StartTime)
|
||||
} else if req.EndTime != "" {
|
||||
query = query.Where("operator_time <= ?", req.EndTime)
|
||||
}
|
||||
|
||||
// 反馈完成状态
|
||||
if req.Status != 0 {
|
||||
query = query.Where("status = ?", req.Status)
|
||||
}
|
||||
|
||||
// 实际完成状态
|
||||
if req.ActualStatus != 0 {
|
||||
query = query.Where("actual_status = ?", req.ActualStatus)
|
||||
}
|
||||
|
||||
// 计算总数
|
||||
query.Count(&total)
|
||||
|
||||
// 分页
|
||||
if req.PageSize > 0 && req.Page > 0 {
|
||||
offset := (req.Page - 1) * req.PageSize
|
||||
query = query.Limit(req.PageSize).Offset(offset)
|
||||
}
|
||||
|
||||
// 按更新时间倒序排序
|
||||
err := query.Order("updated_at DESC").Find(&records).Error
|
||||
if err != nil {
|
||||
return nil, 0, commonErr.ReturnError(err, "查询操作记录失败", "查询操作记录失败: ")
|
||||
}
|
||||
|
||||
return records, total, nil
|
||||
}
|
||||
|
||||
// GetValidArtistList 查询套餐状态为有效中的艺人数据列表
|
||||
// 根据BundleOrderRecords表查询过期时间大于当前时间且状态为已支付的艺人详细信息
|
||||
func GetValidArtistList() ([]ValidArtistInfo, error) {
|
||||
// 构建子查询,获取每个用户的最新订单记录
|
||||
subQuery := app.ModuleClients.BundleDB.Table("bundle_order_records as bor1").
|
||||
Select("bor1.*").
|
||||
Joins(`INNER JOIN (
|
||||
SELECT customer_id, MAX(created_at) AS max_created_time
|
||||
FROM bundle_order_records
|
||||
GROUP BY customer_id
|
||||
) bor2 ON bor1.customer_id = bor2.customer_id AND bor1.created_at = bor2.max_created_time`)
|
||||
|
||||
// 主查询,关联用户表和实名信息表
|
||||
session := app.ModuleClients.BundleDB.Table("`micro-account`.`user` AS u").
|
||||
Select(`u.id as user_id, bor.customer_num, rn.name as user_name,
|
||||
u.tel_num as user_phone_number, bor.bundle_name, bor.expiration_time,
|
||||
bor.status, bor.uuid as order_uuid, bb.account_number, bb.account_consumption_number,
|
||||
bb.video_number, bb.video_consumption_number, bb.image_number, bb.image_consumption_number,
|
||||
bb.data_analysis_number, bb.data_analysis_consumption_number, bb.expansion_packs_number`).
|
||||
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id").
|
||||
Joins("LEFT JOIN (?) as bor ON bor.customer_id = u.id", subQuery).
|
||||
Joins("LEFT JOIN bundle_balance bb ON u.id = bb.user_id AND bb.order_uuid = bor.uuid").
|
||||
Where("rn.name IS NOT NULL").
|
||||
Where("u.deleted_at = 0").
|
||||
Where("bor.expiration_time > ?", time.Now().Format("2006-01-02 15:04:05")).
|
||||
Where("bor.status = ?", 2). // 2:已签已支付
|
||||
Order("bor.expiration_time desc")
|
||||
|
||||
var data []ValidArtistInfo
|
||||
err := session.Find(&data).Error
|
||||
if err != nil {
|
||||
return nil, commonErr.ReturnError(err, "查询有效艺人失败", "查询有效艺人失败: ")
|
||||
}
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// 根据员工的工号从指派任务记录表中查询这名员工,进行中任务数量和已经完成的任务数量
|
||||
func GetTaskAssigneeInfo(taskAssigneeNum string) (int, int, error) {
|
||||
// 如果taskAssigneeNum为空,直接返回默认值
|
||||
if taskAssigneeNum == "" {
|
||||
return 0, 0, nil
|
||||
}
|
||||
|
||||
var taskAssignRecords TaskAssignRecords
|
||||
err := app.ModuleClients.TaskBenchDB.Table("task_assign_records").
|
||||
Select("task_assignee_num, count(*) as progress_task_count, sum(status = 2) as complete_task_count").
|
||||
Where("task_assignee_num = ?", taskAssigneeNum).
|
||||
Group("task_assignee_num").
|
||||
First(&taskAssignRecords).Error
|
||||
|
||||
// 如果查询不到记录,返回默认值而不是错误
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return 0, 0, nil
|
||||
}
|
||||
return 0, 0, commonErr.ReturnError(err, "查询任务指派记录失败", "查询任务指派记录失败: ")
|
||||
}
|
||||
return taskAssignRecords.ProgressTaskCount, taskAssignRecords.CompleteTaskCount, nil
|
||||
}
|
||||
|
||||
// 更新被指派员工为 taskAssigneeNum 的记录中的ProgressCount + 1 和CompleteCount - 1
|
||||
func UpdateTaskRecordsByAssigneeNum(taskAssigneeNum string) error {
|
||||
err := app.ModuleClients.TaskBenchDB.Table("task_management").
|
||||
Where("task_assignee_num = ?", taskAssigneeNum).
|
||||
Update("progress_count", gorm.Expr("progress_count + ?", 1)).
|
||||
Update("complete_count", gorm.Expr("complete_count - ?", 1)).Error
|
||||
if err != nil {
|
||||
return commonErr.ReturnError(err, "更新员工任务进度失败", "更新员工任务进度失败: ")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetArtistBundleBalance 根据艺人编号或手机号查询套餐剩余数量
|
||||
// 优先使用艺人编号查询,如果为空则使用手机号查询
|
||||
func GetArtistBundleBalance(req *ArtistBundleBalanceRequest) (*ArtistBundleBalanceResponse, error) {
|
||||
// 构建子查询,获取用户的最新订单记录
|
||||
subQuery := app.ModuleClients.BundleDB.Table("bundle_order_records as bor1").
|
||||
Select("bor1.*").
|
||||
Joins(`INNER JOIN (
|
||||
SELECT customer_id, MAX(created_at) AS max_created_time
|
||||
FROM bundle_order_records
|
||||
GROUP BY customer_id
|
||||
) bor2 ON bor1.customer_id = bor2.customer_id AND bor1.created_at = bor2.max_created_time`)
|
||||
|
||||
// 主查询,关联用户表和实名信息表
|
||||
session := app.ModuleClients.BundleDB.Table("`micro-account`.`user` AS u").
|
||||
Select(`u.id, bor.customer_num, rn.name as user_name,
|
||||
u.tel_num as user_phone_number, bor.bundle_name, bor.expiration_time,
|
||||
bor.status, bor.uuid as order_uuid, bb.account_number, bb.account_consumption_number,
|
||||
bb.video_number, bb.video_consumption_number, bb.image_number, bb.image_consumption_number,
|
||||
bb.data_analysis_number, bb.data_analysis_consumption_number, bb.expansion_packs_number`).
|
||||
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id").
|
||||
Joins("LEFT JOIN (?) as bor ON bor.customer_id = u.id", subQuery).
|
||||
Joins("LEFT JOIN bundle_balance bb ON u.id = bb.user_id AND bb.order_uuid = bor.uuid").
|
||||
Where("rn.name IS NOT NULL").
|
||||
Where("u.deleted_at = 0").
|
||||
Where("bor.expiration_time > ?", time.Now().Format("2006-01-02 15:04:05")).
|
||||
Where("bor.status = ?", 2) // 2:已签已支付
|
||||
|
||||
// 根据查询条件添加WHERE子句
|
||||
if req.CustomerNum != "" {
|
||||
session = session.Where("bor.customer_num = ?", req.CustomerNum)
|
||||
} else if req.TelNum != "" {
|
||||
session = session.Where("u.tel_num = ?", req.TelNum)
|
||||
} else {
|
||||
return nil, commonErr.ReturnError(nil, "查询参数错误", "艺人编号和手机号不能同时为空")
|
||||
}
|
||||
|
||||
var data ValidArtistInfo
|
||||
err := session.Take(&data).Error // 使用Take()替代First(),避免自动排序
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return nil, commonErr.ReturnError(err, "艺人不存在或套餐已过期", "未找到有效的艺人套餐信息")
|
||||
}
|
||||
return nil, commonErr.ReturnError(err, "查询艺人套餐信息失败", "查询艺人套餐信息失败: ")
|
||||
}
|
||||
|
||||
// 计算剩余数量
|
||||
response := &ArtistBundleBalanceResponse{
|
||||
RemainingVideoCount: data.VideoNumber - data.VideoConsumptionNumber,
|
||||
RemainingImageCount: data.ImageNumber - data.ImageConsumptionNumber,
|
||||
RemainingDataAnalysisCount: data.DataAnalysisNumber - data.DataAnalysisConsumptionNumber,
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// AdjustPendingCountRequest 调整待发数量请求参数
|
||||
type AdjustPendingCountRequest struct {
|
||||
SubNum string `json:"subNum"` // 艺人编号
|
||||
TelNum string `json:"telNum"` // 艺人手机号
|
||||
ArtistName string `json:"artistName"` // 艺人姓名
|
||||
AdjustVideoCount int `json:"adjustVideoCount"` // 调整视频数量(正数为增加,负数为减少)
|
||||
AdjustPostCount int `json:"adjustPostCount"` // 调整图文数量(正数为增加,负数为减少)
|
||||
AdjustDataCount int `json:"adjustDataCount"` // 调整数据数量(正数为增加,负数为减少)
|
||||
CreateIfNotExists bool `json:"createIfNotExists"` // 如果记录不存在是否创建
|
||||
}
|
||||
|
||||
// AdjustPendingCount 调整待发数量(增加或减少)
|
||||
// 支持正数增加和负数减少,可用于套餐扩展时同步增加待发任务数量
|
||||
func AdjustPendingCount(req *AdjustPendingCountRequest) error {
|
||||
// 开启事务
|
||||
tx := app.ModuleClients.TaskBenchDB.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
// 1. 查询现有任务记录
|
||||
var taskManagement model.TaskManagement
|
||||
err := tx.Where("sub_num = ? AND tel_num = ?", req.SubNum, req.TelNum).First(&taskManagement).Error
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
if req.CreateIfNotExists {
|
||||
// 创建新记录
|
||||
taskManagement = model.TaskManagement{
|
||||
SubNum: req.SubNum,
|
||||
TelNum: req.TelNum,
|
||||
ArtistName: req.ArtistName,
|
||||
PendingVideoCount: req.AdjustVideoCount,
|
||||
PendingPostCount: req.AdjustPostCount,
|
||||
PendingDataCount: req.AdjustDataCount,
|
||||
ProgressCount: 0,
|
||||
CompleteCount: 0,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
// 确保数量不为负数
|
||||
if taskManagement.PendingVideoCount < 0 {
|
||||
taskManagement.PendingVideoCount = 0
|
||||
}
|
||||
if taskManagement.PendingPostCount < 0 {
|
||||
taskManagement.PendingPostCount = 0
|
||||
}
|
||||
if taskManagement.PendingDataCount < 0 {
|
||||
taskManagement.PendingDataCount = 0
|
||||
}
|
||||
if err = tx.Create(&taskManagement).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "创建任务记录失败", "创建任务记录失败: ")
|
||||
}
|
||||
} else {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "任务记录不存在", "找不到对应的任务记录")
|
||||
}
|
||||
} else {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "查询任务记录失败", "查询任务记录失败: ")
|
||||
}
|
||||
} else {
|
||||
// 2. 计算调整后的数量
|
||||
newVideoCount := taskManagement.PendingVideoCount + req.AdjustVideoCount
|
||||
newPostCount := taskManagement.PendingPostCount + req.AdjustPostCount
|
||||
newDataCount := taskManagement.PendingDataCount + req.AdjustDataCount
|
||||
|
||||
// 3. 确保调整后的数量不为负数
|
||||
if newVideoCount < 0 {
|
||||
newVideoCount = 0
|
||||
}
|
||||
if newPostCount < 0 {
|
||||
newPostCount = 0
|
||||
}
|
||||
if newDataCount < 0 {
|
||||
newDataCount = 0
|
||||
}
|
||||
|
||||
// 4. 更新TaskManagement表
|
||||
updateData := map[string]interface{}{
|
||||
"pending_video_count": newVideoCount,
|
||||
"pending_post_count": newPostCount,
|
||||
"pending_data_count": newDataCount,
|
||||
"updated_at": time.Now(),
|
||||
}
|
||||
|
||||
if err = tx.Model(&taskManagement).Updates(updateData).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return commonErr.ReturnError(err, "更新任务记录失败", "更新任务记录失败: ")
|
||||
}
|
||||
}
|
||||
|
||||
// 提交事务
|
||||
if err = tx.Commit().Error; err != nil {
|
||||
return commonErr.ReturnError(err, "提交事务失败", "提交事务失败: ")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
@ -115,10 +115,28 @@ func UpdateValueAddServiceLang(tx *gorm.DB, columns map[string]interface{}) (err
|
||||
// 增值套餐列表
|
||||
func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res []*model.ValueAddService, total int64, err error) {
|
||||
query := app.ModuleClients.BundleDB.Model(&model.ValueAddService{}).
|
||||
Where("deleted_at = 0").
|
||||
Preload("ValueAddServiceLang", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("uuid,service_name,service_type,price_mode,original_price,unit,language,price_type,options,created_at,updated_at")
|
||||
})
|
||||
Where("deleted_at = 0")
|
||||
|
||||
// 使用子查询筛选符合条件的UUID
|
||||
if req.Name != "" || req.ServiceType != 0 {
|
||||
subQuery := app.ModuleClients.BundleDB.Model(&model.ValueAddServiceLang{}).
|
||||
Select("uuid").
|
||||
Where("deleted_at = 0")
|
||||
|
||||
if req.Name != "" {
|
||||
subQuery = subQuery.Where("service_name LIKE ?", "%"+req.Name+"%")
|
||||
}
|
||||
if req.ServiceType != 0 {
|
||||
subQuery = subQuery.Where("service_type = ?", req.ServiceType)
|
||||
}
|
||||
|
||||
query = query.Where("uuid IN (?)", subQuery)
|
||||
}
|
||||
|
||||
// 预加载语言表数据
|
||||
query = query.Preload("ValueAddServiceLang", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("uuid,service_name,service_type,price_mode,original_price,unit,language,price_type,options,created_at,updated_at,quota_type,quota_value,is_expired")
|
||||
})
|
||||
|
||||
count := *query
|
||||
if req.PageSize != 0 && req.Page != 0 {
|
||||
@ -203,3 +221,78 @@ func BatchGetValueAddServiceLang(uuids []string, language string) (map[string]*m
|
||||
}
|
||||
return resultMap, nil
|
||||
}
|
||||
|
||||
// 判断套餐额度添加是否合理
|
||||
func ValidateQuotaCompatibility(benefitsQuota, optionalQuota model.QuotaInfo) bool {
|
||||
// 如果套餐权益是不限额度,则附加权益可以是任意额度
|
||||
if benefitsQuota.QuotaType == 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
// 如果附加权益是不限额度,则套餐权益可以是任意额度
|
||||
if optionalQuota.QuotaType == 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
// 如果都是限制额度,则额度值必须相同
|
||||
return benefitsQuota.QuotaValue == optionalQuota.QuotaValue
|
||||
}
|
||||
|
||||
// getServiceQuotaMap 获取服务类型的额度映射
|
||||
func GetServiceQuotaMap(services []*model.BundleToValueAddService, serviceDetails map[string]*model.ValueAddServiceLang) map[int32]model.QuotaInfo {
|
||||
quotaMap := make(map[int32]model.QuotaInfo)
|
||||
|
||||
for _, service := range services {
|
||||
if detail, exists := serviceDetails[service.ValueUid]; exists {
|
||||
quotaMap[int32(detail.ServiceType)] = model.QuotaInfo{
|
||||
QuotaType: detail.QuotaType,
|
||||
QuotaValue: detail.QuotaValue,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return quotaMap
|
||||
}
|
||||
|
||||
// 通过增值服务uuid列表批量检查对应增值服务是否有默认套餐数量
|
||||
func CheckDefaultServiceValueWithUid(uuids []string, language string) (uidList []string, unDefaultServiceNameList []string, err error) {
|
||||
//为空直接返回
|
||||
if len(uuids) == 0 {
|
||||
return []string{}, []string{}, nil
|
||||
}
|
||||
// 1. 批量查询所有增值服务
|
||||
var results []*model.ValueAddServiceLang
|
||||
err = app.ModuleClients.BundleDB.
|
||||
Where("uuid IN ? AND language = ? AND deleted_at = 0", uuids, language).
|
||||
Find(&results).Error
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("批量查询增值服务语言失败: %w", err)
|
||||
}
|
||||
// 2. 构建UUID到服务的映射
|
||||
serviceMap := make(map[string]*model.ValueAddServiceLang, len(results))
|
||||
for _, result := range results {
|
||||
serviceMap[result.UUID] = result
|
||||
}
|
||||
|
||||
uidList = make([]string, 0)
|
||||
unDefaultServiceNameList = make([]string, 0)
|
||||
//检查套餐中是否有默认值
|
||||
for _, uuid := range uuids {
|
||||
hasDefault := false
|
||||
service, exists := serviceMap[uuid]
|
||||
if !exists {
|
||||
return nil, nil, fmt.Errorf("查询增值服务存储失败: %w", err)
|
||||
}
|
||||
for _, option := range service.Options {
|
||||
if option.IsDefault {
|
||||
uidList = append(uidList, uuid)
|
||||
hasDefault = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !hasDefault {
|
||||
unDefaultServiceNameList = append(unDefaultServiceNameList, service.ServiceName)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"micro-bundle/internal/dao"
|
||||
"micro-bundle/internal/model"
|
||||
"micro-bundle/pb/bundle"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
||||
@ -17,13 +19,13 @@ func BundleExtend(req *bundle.BundleExtendRequest) (*bundle.BundleExtendResponse
|
||||
if err := copier.CopyWithOption(&data, req, copier.Option{DeepCopy: true}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := dao.AddBundleBalanceByUserId(model.BundleBalance{
|
||||
UserId: int(req.UserId),
|
||||
VideoNumber: int(req.VideoAdditional),
|
||||
ImageNumber: int(req.ImagesAdditional),
|
||||
DataAnalysisNumber: int(req.DataAdditional),
|
||||
AccountNumber: int(req.AccountAdditional),
|
||||
ExpansionPacksNumber: 1,
|
||||
if err := dao.ExtendBundleBalanceByUserId(model.BundleBalanceExtendPo{
|
||||
UserId: int(req.UserId),
|
||||
VideoNumber: int(req.VideoAdditional),
|
||||
ImageNumber: int(req.ImagesAdditional),
|
||||
DataAnalysisNumber: int(req.DataAdditional),
|
||||
AccountNumber: int(req.AccountAdditional),
|
||||
DurationNumber: int(req.DataAdditional),
|
||||
}); err != nil {
|
||||
return nil, errors.New("用户没有余量信息")
|
||||
}
|
||||
@ -60,17 +62,85 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (*bundle.GetBundl
|
||||
}
|
||||
resp := &bundle.GetBundleBalanceListResp{}
|
||||
resp.Total = total
|
||||
date, err := time.Parse("2006-01", req.Month)
|
||||
if err != nil {
|
||||
return nil, errors.New("请求时间有误")
|
||||
}
|
||||
resp.Data = lo.Map(data, func(m model.BundleBalancePo, _ int) *bundle.BundleBalanceItem {
|
||||
result := &bundle.BundleBalanceItem{}
|
||||
copier.Copy(result, &m)
|
||||
loc, _ := time.LoadLocation("Asia/Shanghai")
|
||||
t, _ := time.ParseInLocation(time.DateTime, m.ExpirationTime, loc)
|
||||
result := &bundle.BundleBalanceItem{
|
||||
UserId: int32(m.UserId),
|
||||
UserName: m.UserName,
|
||||
UserPhoneNumber: m.UserPhoneNumber,
|
||||
CustomerNum: m.CustomerNum,
|
||||
PayTime: m.PayTime,
|
||||
StartTime: m.StartAt.UnixMilli(),
|
||||
Status: int32(m.Status),
|
||||
BundleName: m.BundleName,
|
||||
Month: req.Month,
|
||||
ExpiredTime: m.ExpiredAt.UnixMilli(),
|
||||
// 账号类
|
||||
BundleAccountNumber: int32(m.BundleAccountNumber),
|
||||
IncreaseAccountNumber: int32(m.IncreaseAccountNumber),
|
||||
BundleAccountConsumptionNumber: int32(m.BundleAccountConsumptionNumber),
|
||||
IncreaseAccountConsumptionNumber: int32(m.IncreaseAccountConsumptionNumber),
|
||||
// 视频类
|
||||
BundleVideoNumber: int32(m.BundleVideoNumber) + int32(m.BundleLimitVideoNumber) + int32(m.BundleLimitVideoExpiredNumber),
|
||||
IncreaseVideoNumber: int32(m.IncreaseVideoNumber) + int32(m.IncreaseLimitVideoNumber) + int32(m.IncreaseLimitVideoExpiredNumber),
|
||||
BundleVideoConsumptionNumber: int32(m.BundleVideoConsumptionNumber) + int32(m.BundleLimitVideoConsumptionNumber) + int32(m.BundleLimitVideoExpiredConsumptionNumber),
|
||||
IncreaseVideoConsumptionNumber: int32(m.IncreaseVideoConsumptionNumber) + int32(m.IncreaseLimitVideoConsumptionNumber) + int32(m.IncreaseLimitVideoExpiredConsumptionNumber),
|
||||
InvalidBundleVideoNumber: int32(m.InvalidBundleVideoNumber),
|
||||
InvalidIncreaseVideoNumber: int32(m.InvalidIncreaseVideoNumber),
|
||||
MonthlyNewBundleVideoNumber: int32(cal(m.BundleBalance, m.BundleLimitVideoNumber, m.MonthlyLimitVideoQuotaNumber, date) + cal(m.BundleBalance, m.BundleLimitVideoExpiredNumber, m.MonthlyLimitVideoQuotaNumber, date)),
|
||||
MonthlyNewIncreaseVideoNumber: int32(cal(m.BundleBalance, m.IncreaseLimitVideoNumber, m.MonthlyLimitVideoQuotaNumber, date) + cal(m.BundleBalance, m.IncreaseLimitVideoExpiredNumber, m.MonthlyLimitVideoQuotaNumber, date)),
|
||||
MonthBundleVideoConsumptionNumber: int32(m.MonthlyBundleVideoConsumptionNumber),
|
||||
MonthIncreaseVideoConsumptionNumber: int32(m.MonthlyIncreaseVideoConsumptionNumber),
|
||||
MonthlyInvalidBundleVideoNumber: int32(m.MonthlyInvalidBundleVideoNumber),
|
||||
MonthlyInvalidIncreaseVideoNumber: int32(m.MonthlyInvalidIncreaseVideoNumber),
|
||||
// 图文类
|
||||
BundleImageNumber: int32(m.BundleImageNumber) + int32(m.BundleLimitImageNumber) + int32(m.BundleLimitImageExpiredNumber),
|
||||
IncreaseImageNumber: int32(m.IncreaseImageNumber) + int32(m.IncreaseLimitImageNumber) + int32(m.IncreaseLimitImageExpiredNumber),
|
||||
BundleImageConsumptionNumber: int32(m.BundleImageConsumptionNumber) + int32(m.BundleLimitImageConsumptionNumber) + int32(m.BundleLimitImageExpiredConsumptionNumber),
|
||||
IncreaseImageConsumptionNumber: int32(m.IncreaseImageConsumptionNumber) + int32(m.IncreaseLimitImageConsumptionNumber) + int32(m.IncreaseLimitImageExpiredConsumptionNumber),
|
||||
InvalidBundleImageNumber: int32(m.InvalidBundleImageNumber),
|
||||
InvalidIncreaseImageNumber: int32(m.InvalidIncreaseImageNumber),
|
||||
MonthlyNewBundleImageNumber: int32(cal(m.BundleBalance, m.BundleLimitImageNumber, m.MonthlyLimitImageQuotaNumber, date) + cal(m.BundleBalance, m.BundleLimitImageExpiredNumber, m.MonthlyLimitImageQuotaNumber, date)),
|
||||
MonthlyNewIncreaseImageNumber: int32(cal(m.BundleBalance, m.IncreaseLimitImageNumber, m.MonthlyLimitImageQuotaNumber, date) + cal(m.BundleBalance, m.IncreaseLimitImageExpiredNumber, m.MonthlyLimitImageQuotaNumber, date)),
|
||||
MonthBundleImageConsumptionNumber: int32(m.MonthlyBundleImageConsumptionNumber),
|
||||
MonthIncreaseImageConsumptionNumber: int32(m.MonthlyIncreaseImageConsumptionNumber),
|
||||
MonthlyInvalidBundleImageNumber: int32(m.MonthlyInvalidBundleImageNumber),
|
||||
MonthlyInvalidIncreaseImageNumber: int32(m.MonthlyInvalidIncreaseImageNumber),
|
||||
// 数据分析类
|
||||
BundleDataAnalysisNumber: int32(m.BundleDataAnalysisNumber) + int32(m.BundleLimitDataAnalysisNumber) + int32(m.BundleLimitDataAnalysisExpiredNumber),
|
||||
IncreaseDataAnalysisNumber: int32(m.IncreaseDataAnalysisNumber) + int32(m.IncreaseLimitDataAnalysisNumber) + int32(m.IncreaseLimitDataAnalysisExpiredNumber),
|
||||
BundleDataAnalysisConsumptionNumber: int32(m.BundleDataAnalysisConsumptionNumber) + int32(m.BundleLimitDataAnalysisConsumptionNumber) + int32(m.BundleLimitDataAnalysisExpiredConsumptionNumber),
|
||||
IncreaseDataAnalysisConsumptionNumber: int32(m.IncreaseDataAnalysisConsumptionNumber) + int32(m.IncreaseLimitDataAnalysisConsumptionNumber) + int32(m.IncreaseLimitDataAnalysisExpiredConsumptionNumber),
|
||||
InvalidBundleDataAnalysisNumber: int32(m.InvalidBundleDataAnalysisNumber),
|
||||
InvalidIncreaseDataAnalysisNumber: int32(m.InvalidIncreaseDataAnalysisNumber),
|
||||
MonthlyNewBundleDataAnalysisNumber: int32(cal(m.BundleBalance, m.BundleLimitDataAnalysisNumber, m.MonthlyLimitDataAnalysisQuotaNumber, date) + cal(m.BundleBalance, m.BundleLimitDataAnalysisExpiredNumber, m.MonthlyLimitDataAnalysisQuotaNumber, date)),
|
||||
MonthlyNewIncreaseDataAnalysisNumber: int32(cal(m.BundleBalance, m.IncreaseLimitDataAnalysisNumber, m.MonthlyLimitDataAnalysisQuotaNumber, date) + cal(m.BundleBalance, m.IncreaseLimitDataAnalysisExpiredNumber, m.MonthlyLimitDataAnalysisQuotaNumber, date)),
|
||||
MonthBundleDataAnalysisConsumptionNumber: int32(m.MonthlyBundleDataAnalysisConsumptionNumber),
|
||||
MonthIncreaseDataAnalysisConsumptionNumber: int32(m.MonthlyIncreaseDataAnalysisConsumptionNumber),
|
||||
MonthlyInvalidBundleDataAnalysisNumber: int32(m.MonthlyInvalidBundleDataAnalysisNumber),
|
||||
MonthlyInvalidIncreaseDataAnalysisNumber: int32(m.MonthlyInvalidIncreaseDataAnalysisNumber),
|
||||
// 手动扩展类
|
||||
MonthlyNewManualAccountNumber: int32(m.MonthlyNewAccountNumber),
|
||||
MonthlyNewManualVideoNumber: int32(m.MonthlyNewManualVideoNumber),
|
||||
MonthlyNewManualImageNumber: int32(m.MonthlyNewManualImageNumber),
|
||||
MonthlyNewManualDataAnalysisNumber: int32(m.MonthlyNewManualDataAnalysisNumber),
|
||||
MonthlyNewDurationNumber: int32(m.MonthlyNewDurationNumber),
|
||||
MonthlyManualAccountConsumptionNumber: int32(m.MonthlyManualAccountConsumptionNumber),
|
||||
MonthlyManualVideoConsumptionNumber: int32(m.MonthlyManualVideoConsumptionNumber),
|
||||
MonthlyManualImageConsumptionNumber: int32(m.MonthlyManualImageConsumptionNumber),
|
||||
MonthlyManualDataAnalysisConsumptionNumber: int32(m.MonthlyManualDataAnalysisConsumptionNumber),
|
||||
|
||||
Activate: int32(m.Activate),
|
||||
}
|
||||
|
||||
if m.OrderUUID != "" {
|
||||
result.Bought = 2
|
||||
} else {
|
||||
result.Bought = 1
|
||||
}
|
||||
result.ExpiredTime = t.UnixMilli()
|
||||
return result
|
||||
})
|
||||
return resp, nil
|
||||
@ -80,34 +150,188 @@ func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (*bundle.
|
||||
data, err := dao.GetBundleBalanceByUserId(req)
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
return nil, errors.New("查询失败")
|
||||
return nil, errors.New("无套餐数据")
|
||||
}
|
||||
if data.Activate != 2 {
|
||||
return nil, errors.New("套餐未激活")
|
||||
}
|
||||
result := &bundle.GetBundleBalanceByUserIdResp{
|
||||
OrderUUID: data.OrderUUID,
|
||||
BundleName: data.BundleName,
|
||||
PayTime: data.StartAt.UnixMilli(),
|
||||
ExpiredTime: data.ExpiredAt.UnixMilli(),
|
||||
PaymentAmount: data.PaymentAmount,
|
||||
PaymentType: data.PaymentType,
|
||||
AccountNumber: int32(data.BundleAccountNumber) + int32(data.IncreaseAccountNumber) + int32(data.ManualAccountNumber),
|
||||
AccountAdditional: int32(data.ManualAccountNumber),
|
||||
AccountConsumptionNumber: int32(data.BundleAccountConsumptionNumber) + int32(data.IncreaseAccountConsumptionNumber),
|
||||
VideoNumber: int32(data.BundleVideoNumber) + int32(data.BundleLimitVideoNumber) + int32(data.BundleLimitVideoExpiredNumber) + int32(data.IncreaseVideoNumber) + int32(data.IncreaseLimitVideoNumber) + int32(data.IncreaseLimitVideoExpiredNumber),
|
||||
VideoAdditional: int32(data.ManualVideoNumber),
|
||||
VideoConsumptionNumber: int32(data.BundleVideoConsumptionNumber) + int32(data.BundleLimitVideoConsumptionNumber) + int32(data.BundleLimitVideoExpiredConsumptionNumber) + int32(data.IncreaseVideoConsumptionNumber) + int32(data.IncreaseLimitVideoConsumptionNumber) + int32(data.IncreaseLimitVideoExpiredConsumptionNumber),
|
||||
ImageNumber: int32(data.BundleImageNumber) + int32(data.BundleLimitImageNumber) + int32(data.BundleLimitImageExpiredNumber) + int32(data.IncreaseImageNumber) + int32(data.IncreaseLimitImageNumber) + int32(data.IncreaseLimitImageExpiredNumber),
|
||||
ImageAdditional: int32(data.ManualImageNumber),
|
||||
ImageConsumptionNumber: int32(data.BundleImageConsumptionNumber) + int32(data.BundleLimitImageConsumptionNumber) + int32(data.BundleLimitImageExpiredConsumptionNumber) + int32(data.IncreaseImageConsumptionNumber) + int32(data.IncreaseLimitImageConsumptionNumber) + int32(data.IncreaseLimitImageExpiredConsumptionNumber),
|
||||
DataAnalysisNumber: int32(data.BundleDataAnalysisNumber) + int32(data.BundleLimitDataAnalysisNumber) + int32(data.BundleLimitDataAnalysisExpiredNumber) + int32(data.IncreaseDataAnalysisNumber) + int32(data.IncreaseLimitDataAnalysisNumber) + int32(data.IncreaseLimitDataAnalysisExpiredNumber),
|
||||
DataAnalysisAdditional: int32(data.ManualDataAnalysisNumber),
|
||||
DataAnalysisConsumptionNumber: int32(data.BundleDataAnalysisConsumptionNumber) + int32(data.BundleLimitDataAnalysisConsumptionNumber) + int32(data.BundleLimitDataAnalysisExpiredConsumptionNumber) + int32(data.IncreaseDataAnalysisConsumptionNumber) + int32(data.IncreaseLimitDataAnalysisConsumptionNumber) + int32(data.IncreaseLimitDataAnalysisExpiredConsumptionNumber),
|
||||
}
|
||||
result := &bundle.GetBundleBalanceByUserIdResp{}
|
||||
copier.Copy(result, &data)
|
||||
loc, _ := time.LoadLocation("Asia/Shanghai")
|
||||
t, _ := time.ParseInLocation(time.DateTime, data.ExpiredTime, loc)
|
||||
result.ExpiredTime = t.UnixMilli()
|
||||
t, _ = time.ParseInLocation(time.DateTime, data.PayTime, loc)
|
||||
result.PayTime = t.UnixMilli()
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func AddBundleBalance(req *bundle.AddBundleBalanceReq) (*bundle.AddBundleBalanceResp, error) {
|
||||
var data model.BundleBalance
|
||||
if err := copier.Copy(&data, req); err != nil {
|
||||
logger.Error(err)
|
||||
return nil, errors.New("操作失败")
|
||||
data := model.BundleBalanceUsePo{
|
||||
UserId: int(req.UserId),
|
||||
AccountNumber: int(req.AccountConsumptionNumber),
|
||||
ImageNumber: int(req.ImageConsumptionNumber),
|
||||
VideoNumber: int(req.VideoConsumptionNumber),
|
||||
DataAnalysisNumber: int(req.DataAnalysisConsumptionNumber),
|
||||
}
|
||||
return nil, dao.AddBundleBalanceByUserId(data)
|
||||
uesdType, err := dao.AddBundleBalanceByUserId(data)
|
||||
return &bundle.AddBundleBalanceResp{
|
||||
UsedType: uint32(uesdType),
|
||||
}, err
|
||||
}
|
||||
|
||||
// 计算本月发放的限制类型数量
|
||||
func cal(data model.BundleBalance, total, limit int, date time.Time) int {
|
||||
var released int // 已释放的次数
|
||||
if data.StartAt.Month() == date.Month() && data.StartAt.Year() == date.Year() {
|
||||
} else if data.StartAt.Day() >= 16 { //第一个月释放的
|
||||
released += limit/2 + 1
|
||||
} else {
|
||||
released += limit
|
||||
}
|
||||
interval := date.Year()*12 + int(date.Month()) - (data.StartAt.Year()*12 + int(data.StartAt.Month())) // 后续月份释放的
|
||||
released += interval * limit
|
||||
remaining := max(total-released, 0) // 还剩余多少次没有发放
|
||||
|
||||
if data.StartAt.Month() == date.Month() && data.StartAt.Year() == date.Year() && data.StartAt.Day() >= 16 { // 本月为第一个月并且16号后购买只给一半(向上取整)
|
||||
return min(limit/2+1, remaining)
|
||||
}
|
||||
if data.ExpiredAt.Month() == date.Month() && data.ExpiredAt.Year() == date.Year() && data.ExpiredAt.Day() < 16 { // 本月为最后一个月并且16号前到期只给一半(向下取整)
|
||||
return min(limit/2, remaining)
|
||||
}
|
||||
return min(limit, remaining)
|
||||
}
|
||||
|
||||
func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBundleBalanceResp, error) {
|
||||
var data model.BundleBalance
|
||||
if err := copier.Copy(&data, req); err != nil {
|
||||
logger.Error(err)
|
||||
return nil, errors.New("操作失败")
|
||||
|
||||
addValues, err := dao.GetValueAddByOrderUUID(req.OrderUUID)
|
||||
if err != nil || len(addValues) == 0 {
|
||||
return nil, errors.New("获取增值服务失败")
|
||||
}
|
||||
err := dao.CreateBundleBalance(data)
|
||||
data.StartAt = time.Now()
|
||||
data.ExpiredAt = time.Now()
|
||||
userId, err := strconv.Atoi(addValues[0].CustomerID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
data.Month = time.Now().Format("2006-01")
|
||||
data.UserId = userId
|
||||
data.OrderUUID = req.OrderUUID
|
||||
for _, v := range addValues {
|
||||
switch v.ServiceType {
|
||||
case 1: // 视频类型
|
||||
if v.EquityType == 1 { // 套餐权益
|
||||
if v.QuotaType == 2 { // 限制额度
|
||||
data.MonthlyLimitVideoQuotaNumber = int(v.QuotaValue)
|
||||
if v.IsExpired { // 会过期的限制类型
|
||||
data.BundleLimitVideoExpiredNumber += int(v.Num)
|
||||
} else {
|
||||
data.BundleLimitVideoNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
data.BundleVideoNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
if v.QuotaType == 2 { // 限制额度
|
||||
data.MonthlyLimitVideoQuotaNumber = int(v.QuotaValue)
|
||||
if v.IsExpired { // 会过期的限制类型
|
||||
data.IncreaseLimitVideoExpiredNumber += int(v.Num)
|
||||
} else {
|
||||
data.IncreaseLimitVideoNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
data.IncreaseVideoNumber += int(v.Num)
|
||||
}
|
||||
}
|
||||
case 2: // 图文类型
|
||||
if v.EquityType == 1 { // 套餐权益
|
||||
if v.QuotaType == 2 { // 限制额度
|
||||
data.MonthlyLimitImageQuotaNumber = int(v.QuotaValue)
|
||||
if v.IsExpired { // 会过期的限制类型
|
||||
data.BundleLimitImageExpiredNumber += int(v.Num)
|
||||
} else {
|
||||
data.BundleLimitImageNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
data.BundleImageNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
if v.QuotaType == 2 { // 限制额度
|
||||
data.MonthlyLimitImageQuotaNumber = int(v.QuotaValue)
|
||||
if v.IsExpired { // 会过期的限制类型
|
||||
data.IncreaseLimitImageExpiredNumber += int(v.Num)
|
||||
} else {
|
||||
data.IncreaseLimitImageNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
data.IncreaseImageNumber += int(v.Num)
|
||||
}
|
||||
}
|
||||
case 3: // 数据分析
|
||||
if v.EquityType == 1 { // 套餐权益
|
||||
if v.QuotaType == 2 { // 限制额度
|
||||
data.MonthlyLimitDataAnalysisQuotaNumber = int(v.QuotaValue)
|
||||
if v.IsExpired { // 会过期的限制类型
|
||||
data.BundleLimitDataAnalysisExpiredNumber += int(v.Num)
|
||||
} else {
|
||||
data.BundleLimitDataAnalysisNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
data.BundleDataAnalysisNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
if v.QuotaType == 2 { // 限制额度
|
||||
data.MonthlyLimitDataAnalysisQuotaNumber = int(v.QuotaValue)
|
||||
if v.IsExpired { // 会过期的限制类型
|
||||
data.IncreaseLimitDataAnalysisExpiredNumber += int(v.Num)
|
||||
} else {
|
||||
data.IncreaseLimitDataAnalysisNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
|
||||
data.IncreaseDataAnalysisNumber += int(v.Num)
|
||||
}
|
||||
}
|
||||
case 4: // 账号数
|
||||
if v.EquityType == 1 { // 套餐权益
|
||||
data.BundleAccountNumber += int(v.Num)
|
||||
} else {
|
||||
data.IncreaseAccountNumber += int(v.Num)
|
||||
}
|
||||
case 5: // 可用时长
|
||||
switch v.Unit {
|
||||
case "天":
|
||||
data.ExpiredAt = data.ExpiredAt.Add(time.Hour * 24 * time.Duration(v.Num))
|
||||
case "月":
|
||||
data.ExpiredAt = data.ExpiredAt.Add(time.Hour * 24 * 30 * time.Duration(v.Num))
|
||||
case "年":
|
||||
data.ExpiredAt = data.ExpiredAt.Add(time.Hour * 24 * 365 * time.Duration(v.Num))
|
||||
}
|
||||
}
|
||||
}
|
||||
now := time.Now()
|
||||
// 当月可用的限制类型数等于本月方法的套餐和增值两种类型的总和
|
||||
data.MonthlyLimitVideoExpireNumber = cal(data, data.BundleLimitVideoExpiredNumber, data.MonthlyLimitVideoQuotaNumber, now) + cal(data, data.IncreaseLimitVideoExpiredNumber, data.MonthlyLimitVideoQuotaNumber, now)
|
||||
data.MonthlyLimitVideoNumber = cal(data, data.BundleLimitVideoNumber, data.MonthlyLimitVideoQuotaNumber, now) + cal(data, data.IncreaseLimitVideoNumber, data.MonthlyLimitVideoQuotaNumber, now)
|
||||
data.MonthlyLimitImageExpireNumber = cal(data, data.BundleLimitImageExpiredNumber, data.MonthlyLimitImageQuotaNumber, now) + cal(data, data.IncreaseLimitImageExpiredNumber, data.MonthlyLimitImageQuotaNumber, now)
|
||||
data.MonthlyLimitImageNumber = cal(data, data.BundleLimitImageNumber, data.MonthlyLimitImageQuotaNumber, now) + cal(data, data.IncreaseLimitImageNumber, data.MonthlyLimitImageQuotaNumber, now)
|
||||
data.MonthlyLimitDataAnalysisExpireNumber = cal(data, data.BundleLimitDataAnalysisExpiredNumber, data.MonthlyLimitDataAnalysisQuotaNumber, now) + cal(data, data.IncreaseLimitDataAnalysisExpiredNumber, data.MonthlyLimitDataAnalysisQuotaNumber, now)
|
||||
data.MonthlyLimitDataAnalysisNumber = cal(data, data.BundleLimitDataAnalysisNumber, data.MonthlyLimitDataAnalysisQuotaNumber, now) + cal(data, data.IncreaseLimitDataAnalysisNumber, data.MonthlyLimitDataAnalysisQuotaNumber, now)
|
||||
|
||||
err = dao.CreateBundleBalance(data)
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
return nil, errors.New("创建余量信息失败")
|
||||
@ -174,3 +398,144 @@ func ToBeComfirmedWorks(req *bundle.ToBeComfirmedWorksReq) (*bundle.ToBeComfirme
|
||||
func ConfirmWork(req *bundle.ConfirmWorkReq) (*bundle.ConfirmWorkResp, error) {
|
||||
return nil, dao.ConfirmWork(req)
|
||||
}
|
||||
|
||||
func BundleActivate(req *bundle.BundleActivateReq) error {
|
||||
return dao.BundleActivate(req.Ids)
|
||||
}
|
||||
|
||||
func UpdateBundleBalance() {
|
||||
dao.UpdateBundleBalance()
|
||||
}
|
||||
|
||||
func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBalanceExportResp, error) {
|
||||
data, err := GetBundleBalanceList(&bundle.GetBundleBalanceListReq{
|
||||
Month: req.Month,
|
||||
Bought: 2,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
prefixData, err := dao.BalanceExportPrefix()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var prefixMap = map[int32]model.BundleExportDto{}
|
||||
for _, v := range prefixData {
|
||||
prefixMap[v.UserId] = v
|
||||
}
|
||||
|
||||
items := []*bundle.BundleBalanceExportItem{}
|
||||
|
||||
for _, v := range data.Data {
|
||||
prefixItem := prefixMap[v.UserId]
|
||||
item := &bundle.BundleBalanceExportItem{}
|
||||
copier.Copy(item, v)
|
||||
item.Month = req.Month
|
||||
item.CustomerNum = prefixItem.CustomerNum
|
||||
item.PayTime = prefixItem.PayTime
|
||||
item.BundleAmount = prefixItem.BundleAmount
|
||||
item.IncreaseAmount = prefixItem.TotalPayAmount - prefixItem.BundleAmount
|
||||
item.TotalPayAmount = prefixItem.TotalPayAmount
|
||||
item.Currency = "USD"
|
||||
item.Fee = prefixItem.Fee
|
||||
item.BundleVideoUnitPrice = float32(item.BundleAmount / float32(v.BundleVideoNumber))
|
||||
item.IncreaseVideoUnitPrice = float32(item.IncreaseAmount / float32(v.IncreaseVideoNumber))
|
||||
items = append(items, item)
|
||||
}
|
||||
return &bundle.BundleBalanceExportResp{Total: int64(len(items)), Data: items}, nil
|
||||
}
|
||||
|
||||
func GetBundleBalanceLayout(req *bundle.GetBundleBalanceLayoutReq) (*bundle.GetBundleBalanceLayoutResp, error) {
|
||||
data, err := dao.GetBundleBalanceLayout(req)
|
||||
if err != nil { // 返回默认值
|
||||
return &bundle.GetBundleBalanceLayoutResp{
|
||||
Data: buildDefaultBalanceLayout(),
|
||||
}, nil
|
||||
}
|
||||
return &bundle.GetBundleBalanceLayoutResp{
|
||||
Data: data,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func SetBundleBalanceLayout(req *bundle.SetBundleBalanceLayoutReq) (*bundle.SetBundleBalanceLayoutResp, error) {
|
||||
return nil, dao.SetBundleBalanceLayout(req)
|
||||
}
|
||||
|
||||
func buildDefaultBalanceLayout() string {
|
||||
m := map[string]string{
|
||||
"是否激活": "activate",
|
||||
"艺人": "userName",
|
||||
"艺人手机号": "userPhoneNumber",
|
||||
"用户编号": "customerNum",
|
||||
"套餐状态": "status",
|
||||
"最后购买的套餐": "bundleName",
|
||||
"下单时间": "payTime",
|
||||
"开始有效时间": "startTime",
|
||||
"过期时间": "expiredTime",
|
||||
"所属月份": "month",
|
||||
"购买状态": "bought",
|
||||
"当前可用套餐账号数": "bundleAccountNumber",
|
||||
"当前可用增值账号数": "increaseAccountNumber",
|
||||
"当前已用套餐账号数": "bundleAccountConsumptionNumber",
|
||||
"当前已用增值账号数": "increaseAccountConsumptionNumber",
|
||||
"当前可用套餐视频数": "bundleVideoNumber",
|
||||
"当前可用增值视频数": "increaseVideoNumber",
|
||||
"当前已用套餐视频数": "bundleVideoConsumptionNumber",
|
||||
"当前已用增值视频数": "increaseVideoConsumptionNumber",
|
||||
"当前作废套餐视频数": "invalidBundleVideoNumber",
|
||||
"当前作废增值视频数": "invalidIncreaseVideoNumber",
|
||||
"当月新增套餐视频数": "monthlyNewBundleVideoNumber",
|
||||
"当月新增增值视频数": "monthlyNewIncreaseVideoNumber",
|
||||
"当月使用套餐视频数": "monthBundleVideoConsumptionNumber",
|
||||
"当月使用增值视频数": "monthIncreaseVideoConsumptionNumber",
|
||||
"当月作废套餐视频数": "monthlyInvalidBundleVideoNumber",
|
||||
"当月作废增值视频数": "monthlyInvalidIncreaseVideoNumber",
|
||||
"当前可用套餐图文数": "bundleImageNumber",
|
||||
"当前可用增值图文数": "increaseImageNumber",
|
||||
"当前已用套餐图文数": "bundleImageConsumptionNumber",
|
||||
"当前已用增值图文数": "increaseImageConsumptionNumber",
|
||||
"当前作废套餐图文数": "invalidBundleImageNumber",
|
||||
"当前作废增值图文数": "invalidIncreaseImageNumber",
|
||||
"当月新增套餐图文数": "monthlyNewBundleImageNumber",
|
||||
"当月新增增值图文数": "monthlyNewIncreaseImageNumber",
|
||||
"当月使用套餐图文数": "monthBundleImageConsumptionNumber",
|
||||
"当月使用增值图文数": "monthIncreaseImageConsumptionNumber",
|
||||
"当月作废套餐图文数": "monthlyInvalidBundleImageNumber",
|
||||
"当月作废增值图文数": "monthlyInvalidIncreaseImageNumber",
|
||||
"当前可用套餐数据数": "bundleDataAnalysisNumber",
|
||||
"当前可用增值数据数": "increaseDataAnalysisNumber",
|
||||
"当前已用套餐数据数": "bundleDataAnalysisConsumptionNumber",
|
||||
"当前已用增值数据数": "increaseDataAnalysisConsumptionNumber",
|
||||
"当前作废套餐数据数": "invalidBundleDataAnalysisNumber",
|
||||
"当前作废增值数据数": "invalidIncreaseDataAnalysisNumber",
|
||||
"当月新增套餐数据数": "monthlyNewBundleDataAnalysisNumber",
|
||||
"当月新增增值数据数": "monthlyNewIncreaseDataAnalysisNumber",
|
||||
"当月使用套餐数据数": "monthBundleDataAnalysisConsumptionNumber",
|
||||
"当月使用增值数据数": "monthIncreaseDataAnalysisConsumptionNumber",
|
||||
"当月作废套餐数据数": "monthlyInvalidBundleDataAnalysisNumber",
|
||||
"当月作废增值数据数": "monthlyInvalidIncreaseDataAnalysisNumber",
|
||||
"当月新增手动扩展账号数": "monthlyNewManualAccountNumber",
|
||||
"当月新增手动扩展视频数": "monthlyNewManualVideoNumber",
|
||||
"当月新增手动扩展图文数": "monthlyNewManualImageNumber",
|
||||
"当月新增手动扩展数据数": "monthlyNewManualDataAnalysisNumber",
|
||||
"当月新增手动扩展时长(日)": "monthlyNewDurationNumber",
|
||||
"当月已用手动扩展账号数": "monthlyManualAccountConsumptionNumber",
|
||||
"当月已用手动扩展视频数": "monthlyManualVideoConsumptionNumber",
|
||||
"当月已用手动扩展图文数": "monthlyManualImageConsumptionNumber",
|
||||
"当月已用手动扩展数据数": "monthlyManualDataAnalysisConsumptionNumber",
|
||||
}
|
||||
jsonMap := []map[string]any{}
|
||||
for k, v := range m {
|
||||
jsonMap = append(jsonMap, map[string]any{
|
||||
"sort": 1,
|
||||
"fieldKey": v,
|
||||
"fieldValue": k,
|
||||
"sortOrNot": true,
|
||||
"status": 1,
|
||||
"width": 160,
|
||||
})
|
||||
}
|
||||
b, _ := json.Marshal(jsonMap)
|
||||
return string(b)
|
||||
}
|
||||
|
@ -3,18 +3,20 @@ package logic
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"micro-bundle/internal/dao"
|
||||
"micro-bundle/pb/bundle"
|
||||
"micro-bundle/pkg/app"
|
||||
"micro-bundle/pkg/msg"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"micro-bundle/internal/model"
|
||||
|
||||
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils"
|
||||
"github.com/jinzhu/copier"
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"micro-bundle/internal/model"
|
||||
)
|
||||
|
||||
func CreateBundle(req *bundle.BundleProfile) (res *bundle.CommonResponse, err error) {
|
||||
@ -64,6 +66,7 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
||||
if req.Sort <= 0 {
|
||||
return res, errors.New("排序参数需为正整数")
|
||||
}
|
||||
//套餐主表数据
|
||||
bundleProfile := &model.BundleProfile{
|
||||
Name: req.Name,
|
||||
Sort: req.Sort,
|
||||
@ -84,6 +87,7 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
||||
PriceType: req.PriceType,
|
||||
Language: req.Language,
|
||||
}
|
||||
//必须先创建中文版本
|
||||
if req.Uuid == "" && req.Language != msg.ZH_CN {
|
||||
return res, errors.New("请先创建中文版本套餐")
|
||||
}
|
||||
@ -99,28 +103,109 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//现需要区分类型 分为 1:套餐权益,该类型必须关联一个可用时长类型的权益 2:套餐可选附加权益,非必选可为空
|
||||
selectService := make([]*model.BundleToValueAddService, 0)
|
||||
var selectValueAddServiceCount = make(map[int]struct{}) //增值服务类型数量
|
||||
if req.Language == msg.ZH_CN && req.SelectValueAddService != nil && len(req.SelectValueAddService) > 0 {
|
||||
for _, v := range req.SelectValueAddService {
|
||||
detail, checkErr := dao.ValueAddServiceDetailByUuidAndLanguage(v.ValueAddUuid, req.Language)
|
||||
if checkErr != nil {
|
||||
if checkErr == gorm.ErrRecordNotFound {
|
||||
//搜集所有增值服务的uuid
|
||||
if req.Language == msg.ZH_CN {
|
||||
//符合条件的增值服务uuid
|
||||
var allValueUuids []string
|
||||
//批量查询得到的增值服务详情
|
||||
serviceDetails := make(map[string]*model.ValueAddServiceLang)
|
||||
//套餐权益增值服务类型数量
|
||||
var pkgBenefitsValueAddServiceCount = make(map[int]struct{})
|
||||
//套餐可选附加权益增值服务类型数量
|
||||
var pkgOptionalValueAddServiceCount = make(map[int]struct{})
|
||||
if req.SelectValueAddService != nil {
|
||||
for _, v := range req.SelectValueAddService {
|
||||
allValueUuids = append(allValueUuids, v.ValueAddUuid)
|
||||
}
|
||||
}
|
||||
if req.SelectValueAdditionalService != nil {
|
||||
for _, v := range req.SelectValueAdditionalService {
|
||||
allValueUuids = append(allValueUuids, v.ValueAddUuid)
|
||||
}
|
||||
}
|
||||
// 批量查询增值服务详情
|
||||
if len(allValueUuids) > 0 {
|
||||
//筛选uid对应的增值服务是否有默认值
|
||||
// _, unDefaultServiceNameList, err := dao.CheckDefaultServiceValueWithUid(allValueUuids, req.Language)
|
||||
// if err != nil {
|
||||
// return res, errors.New("筛选增值服务默认值失败")
|
||||
// }
|
||||
// if len(unDefaultServiceNameList) > 0 {
|
||||
// warningMsg := "增值服务没有默认套餐数量: " + strings.Join(unDefaultServiceNameList, ",") + "请选择默认套餐数量后重新添加"
|
||||
// res.Msg = warningMsg
|
||||
// return res, errors.New(warningMsg)
|
||||
// }
|
||||
//
|
||||
serviceDetails, err = dao.BatchGetValueAddServiceLang(allValueUuids, req.Language)
|
||||
if err != nil {
|
||||
return res, errors.New("批量查询增值服务失败")
|
||||
}
|
||||
}
|
||||
|
||||
if req.SelectValueAddService != nil && len(req.SelectValueAddService) > 0 {
|
||||
// 获取套餐权益的额度映射
|
||||
benefitsServices := make([]*model.BundleToValueAddService, 0)
|
||||
|
||||
for _, v := range req.SelectValueAddService {
|
||||
detail, exists := serviceDetails[v.ValueAddUuid]
|
||||
if !exists {
|
||||
return res, errors.New("增值服务不存在")
|
||||
} else {
|
||||
return res, errors.New("查询增值服务失败")
|
||||
}
|
||||
if _, exists := pkgBenefitsValueAddServiceCount[int(detail.ServiceType)]; exists {
|
||||
return res, errors.New("每种增值服务类型只可选择一个")
|
||||
}
|
||||
|
||||
benefitsServices = append(benefitsServices, &model.BundleToValueAddService{
|
||||
ValueUid: v.ValueAddUuid,
|
||||
})
|
||||
|
||||
pkgBenefitsValueAddServiceCount[int(detail.ServiceType)] = struct{}{}
|
||||
selectService = append(selectService, &model.BundleToValueAddService{
|
||||
ValueUid: v.ValueAddUuid,
|
||||
IsDisplay: v.IsDisplay,
|
||||
BenefitsType: msg.Benefits,
|
||||
})
|
||||
|
||||
}
|
||||
if req.SelectValueAdditionalService != nil && len(req.SelectValueAdditionalService) > 0 {
|
||||
|
||||
benefitsQuotaMap := dao.GetServiceQuotaMap(benefitsServices, serviceDetails)
|
||||
|
||||
for _, v := range req.SelectValueAdditionalService {
|
||||
detail, exists := serviceDetails[v.ValueAddUuid]
|
||||
if !exists {
|
||||
return res, errors.New("增值服务不存在")
|
||||
}
|
||||
if _, exists := pkgOptionalValueAddServiceCount[int(detail.ServiceType)]; exists {
|
||||
return res, errors.New("每种增值服务类型只可选择一个")
|
||||
}
|
||||
//额度兼容性验证
|
||||
if benefitsQuota, exists := benefitsQuotaMap[detail.ServiceType]; exists {
|
||||
optionalQuota := model.QuotaInfo{
|
||||
QuotaType: detail.QuotaType,
|
||||
QuotaValue: detail.QuotaValue,
|
||||
}
|
||||
|
||||
if !dao.ValidateQuotaCompatibility(benefitsQuota, optionalQuota) {
|
||||
return res, fmt.Errorf("服务类型%d的额度不兼容:套餐权益额度为%d,附加权益额度为%d",
|
||||
detail.ServiceType, benefitsQuota.QuotaValue, optionalQuota.QuotaValue)
|
||||
}
|
||||
}
|
||||
|
||||
pkgOptionalValueAddServiceCount[int(detail.ServiceType)] = struct{}{}
|
||||
selectService = append(selectService, &model.BundleToValueAddService{
|
||||
ValueUid: v.ValueAddUuid,
|
||||
IsDisplay: v.IsDisplay,
|
||||
BenefitsType: msg.OptionalBenefits,
|
||||
})
|
||||
}
|
||||
}
|
||||
if _, exists := selectValueAddServiceCount[int(detail.ServiceType)]; exists {
|
||||
return res, errors.New("每种增值服务类型只可选择一个")
|
||||
}
|
||||
selectValueAddServiceCount[int(detail.ServiceType)] = struct{}{}
|
||||
selectService = append(selectService, &model.BundleToValueAddService{
|
||||
ValueUid: v.ValueAddUuid,
|
||||
IsDisplay: v.IsDisplay,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
tx := app.ModuleClients.BundleDB.Begin()
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -235,8 +320,7 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
|
||||
func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailResponseV2, err error) {
|
||||
res = new(bundle.BundleDetailResponseV2)
|
||||
bundleProfile := &bundle.BundleProfile{}
|
||||
bundleProfileLangs := make([]*bundle.BundleProfileLang, 0)
|
||||
selectValueAddServices := make([]*bundle.SelectValueAddService, 0) //已选增值服务
|
||||
|
||||
if req.Uuid == "" {
|
||||
return res, errors.New("缺少套餐UUID")
|
||||
}
|
||||
@ -245,38 +329,85 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
|
||||
return res, errors.New("获取套餐信息失败")
|
||||
}
|
||||
if detail != nil {
|
||||
bundleProfile.Uuid = detail.UUID
|
||||
bundleProfile.Name = detail.Name
|
||||
bundleProfile.Content = detail.Content
|
||||
bundleProfile.Price = detail.Price
|
||||
bundleProfile.PriceType = detail.PriceType
|
||||
bundleProfile.ImgOption = int32(detail.ImgOption)
|
||||
bundleProfile.BgImg1 = detail.BgImg1
|
||||
bundleProfile.BgImg2 = detail.BgImg2
|
||||
bundleProfile.FontColor = detail.FontColor
|
||||
bundleProfile.Sort = detail.Sort
|
||||
bundleProfile.ShelfStatus = detail.ShelfStatus
|
||||
bundleProfile.CreatedAt = detail.CreatedAt.Format("2006-01-02 15:04:05")
|
||||
bundleProfile.UpdatedAt = detail.UpdatedAt.Format("2006-01-02 15:04:05")
|
||||
bundleProfile.Contract = detail.Contract
|
||||
bundleProfile = &bundle.BundleProfile{
|
||||
Uuid: detail.UUID,
|
||||
Name: detail.Name,
|
||||
Content: detail.Content,
|
||||
Price: detail.Price,
|
||||
PriceType: detail.PriceType,
|
||||
ImgOption: int32(detail.ImgOption),
|
||||
BgImg1: detail.BgImg1,
|
||||
BgImg2: detail.BgImg2,
|
||||
FontColor: detail.FontColor,
|
||||
Sort: detail.Sort,
|
||||
ShelfStatus: detail.ShelfStatus,
|
||||
CreatedAt: detail.CreatedAt.Format("2006-01-02 15:04:05"),
|
||||
UpdatedAt: detail.UpdatedAt.Format("2006-01-02 15:04:05"),
|
||||
Contract: detail.Contract,
|
||||
}
|
||||
if len(detail.BundleToValueAddService) > 0 {
|
||||
var valueUuids []string
|
||||
for _, service := range detail.BundleToValueAddService {
|
||||
valueUuids = append(valueUuids, service.ValueUid)
|
||||
}
|
||||
|
||||
// 批量查询增值服务详情
|
||||
valueAddServiceMap, err := dao.BatchGetValueAddServiceLang(valueUuids, req.Language)
|
||||
if err != nil {
|
||||
return res, errors.New("批量查询增值服务失败")
|
||||
}
|
||||
|
||||
selectValueAddServices := make([]*bundle.SelectValueAddService, 0) //已选套餐服务
|
||||
selectValueAdditionalServices := make([]*bundle.SelectValueAdditionalService, 0) //已选套餐可选附加服务
|
||||
|
||||
for _, valueAddService := range detail.BundleToValueAddService {
|
||||
valueAddDetail, err := dao.ValueAddServiceDetailByUuidAndLanguage(valueAddService.ValueUid, req.Language)
|
||||
if err != nil {
|
||||
valueAddDetail, exists := valueAddServiceMap[valueAddService.ValueUid]
|
||||
if !exists {
|
||||
return res, errors.New("查询增值服务失败")
|
||||
}
|
||||
selectValueAddService := &bundle.SelectValueAddService{
|
||||
ValueAddUuid: valueAddService.ValueUid,
|
||||
IsDisplay: valueAddService.IsDisplay,
|
||||
ServiceName: valueAddDetail.ServiceName,
|
||||
ServiceType: valueAddDetail.ServiceType,
|
||||
|
||||
// 查找默认选项
|
||||
var defaultServiceValue int32
|
||||
for _, option := range valueAddDetail.Options {
|
||||
if option.IsDefault {
|
||||
defaultServiceValue = option.Num
|
||||
break
|
||||
}
|
||||
}
|
||||
//根据权益类型不同进行分类存放
|
||||
switch valueAddService.BenefitsType {
|
||||
case msg.Benefits:
|
||||
selectValueAddServices = append(selectValueAddServices, &bundle.SelectValueAddService{
|
||||
ValueAddUuid: valueAddService.ValueUid,
|
||||
IsDisplay: valueAddService.IsDisplay,
|
||||
ServiceName: valueAddDetail.ServiceName,
|
||||
ServiceType: valueAddDetail.ServiceType,
|
||||
QuotaType: valueAddDetail.QuotaType,
|
||||
QuotaValue: valueAddDetail.QuotaValue,
|
||||
IsExpired: valueAddDetail.IsExpired,
|
||||
DefaultServiceValue: defaultServiceValue,
|
||||
})
|
||||
case msg.OptionalBenefits:
|
||||
selectValueAdditionalServices = append(selectValueAdditionalServices, &bundle.SelectValueAdditionalService{
|
||||
ValueAddUuid: valueAddService.ValueUid,
|
||||
IsDisplay: valueAddService.IsDisplay,
|
||||
ServiceName: valueAddDetail.ServiceName,
|
||||
ServiceType: valueAddDetail.ServiceType,
|
||||
QuotaType: valueAddDetail.QuotaType,
|
||||
QuotaValue: valueAddDetail.QuotaValue,
|
||||
IsExpired: valueAddDetail.IsExpired,
|
||||
DefaultServiceValue: defaultServiceValue,
|
||||
})
|
||||
}
|
||||
selectValueAddServices = append(selectValueAddServices, selectValueAddService)
|
||||
}
|
||||
|
||||
bundleProfile.SelectValueAddService = selectValueAddServices
|
||||
bundleProfile.SelectValueAdditionalService = selectValueAdditionalServices
|
||||
}
|
||||
if len(detail.BundleProfileLang) > 0 {
|
||||
bundleProfileLangs := make([]*bundle.BundleProfileLang, 0, len(detail.BundleProfileLang))
|
||||
for _, lang := range detail.BundleProfileLang {
|
||||
bundleProfileLang := &bundle.BundleProfileLang{
|
||||
bundleProfileLangs = append(bundleProfileLangs, &bundle.BundleProfileLang{
|
||||
Uuid: lang.UUID,
|
||||
Name: lang.Name,
|
||||
Price: lang.Price,
|
||||
@ -291,16 +422,11 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
|
||||
ShelfStatus: detail.ShelfStatus,
|
||||
CreatedAt: time.Unix(lang.CreatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
UpdatedAt: time.Unix(int64(lang.UpdatedAt), 0).Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
bundleProfileLangs = append(bundleProfileLangs, bundleProfileLang)
|
||||
})
|
||||
}
|
||||
bundleProfile.BundleProfileLang = bundleProfileLangs
|
||||
}
|
||||
}
|
||||
|
||||
if len(selectValueAddServices) > 0 {
|
||||
bundleProfile.SelectValueAddService = selectValueAddServices
|
||||
}
|
||||
bundleProfile.BundleProfileLang = bundleProfileLangs
|
||||
res.Bundle = bundleProfile
|
||||
return
|
||||
}
|
||||
@ -316,6 +442,7 @@ func BundleLangDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleProf
|
||||
if err != nil {
|
||||
return res, errors.New("获取套餐信息失败")
|
||||
}
|
||||
|
||||
lang, err := dao.BundleDetailByUuidAndLanguage(req.Uuid, req.Language)
|
||||
if err != nil {
|
||||
return res, errors.New("获取套餐信息失败")
|
||||
@ -329,6 +456,16 @@ func BundleLangDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleProf
|
||||
res.Sort = detail.Sort
|
||||
res.ShelfStatus = detail.ShelfStatus
|
||||
res.Contract = detail.Contract
|
||||
if len(detail.BundleToValueAddService) > 0 {
|
||||
var serviceLangInfos []*bundle.ServiceLangInfo
|
||||
for _, service := range detail.BundleToValueAddService {
|
||||
serviceLangInfos = append(serviceLangInfos, &bundle.ServiceLangInfo{
|
||||
ValueAddUuid: service.ValueUid,
|
||||
BenefitsType: service.BenefitsType,
|
||||
})
|
||||
}
|
||||
res.ServiceLangInfo = serviceLangInfos
|
||||
}
|
||||
}
|
||||
if lang != nil {
|
||||
res.Name = lang.Name
|
||||
@ -423,42 +560,64 @@ func HandleShelf(req *bundle.HandShelfRequest) (*bundle.CommonResponse, error) {
|
||||
|
||||
// 差异更新套餐与增值服务中间表
|
||||
func diffUpdateBundleToValueAddService(tx *gorm.DB, bundleUuid string, selectService []*model.BundleToValueAddService) error {
|
||||
oldUuids, err := dao.GetValueAddServiceUuidsByBundleUuid(bundleUuid)
|
||||
// 获取现有的关联记录(包含value_uid和benefits_type)
|
||||
oldRecords, err := dao.GetValueAddServiceUuidsByAndBenefitsBundleUuid(bundleUuid)
|
||||
if err != nil {
|
||||
return errors.New("查询套餐与增值服务关联失败")
|
||||
}
|
||||
newUuids := make(map[string]*model.BundleToValueAddService)
|
||||
|
||||
// 构建现有记录的复合键映射 (value_uid + benefits_type)
|
||||
oldMap := make(map[string]struct{})
|
||||
for _, record := range oldRecords {
|
||||
key := fmt.Sprintf("%s_%d", record.ValueUid, record.BenefitsType)
|
||||
oldMap[key] = struct{}{}
|
||||
}
|
||||
|
||||
// 构建新记录的复合键映射
|
||||
newMap := make(map[string]*model.BundleToValueAddService)
|
||||
for _, s := range selectService {
|
||||
newUuids[s.ValueUid] = s
|
||||
}
|
||||
oldSet := make(map[string]struct{})
|
||||
for _, uid := range oldUuids {
|
||||
oldSet[uid] = struct{}{}
|
||||
key := fmt.Sprintf("%s_%d", s.ValueUid, s.BenefitsType)
|
||||
s.BundleUuid = bundleUuid
|
||||
newMap[key] = s
|
||||
}
|
||||
|
||||
// 需要新增的
|
||||
toAdd := make([]*model.BundleToValueAddService, 0)
|
||||
toDel := make([]string, 0)
|
||||
toUpdate := make([]*model.BundleToValueAddService, 0)
|
||||
for uid, s := range newUuids {
|
||||
if _, exist := oldSet[uid]; !exist {
|
||||
s.BundleUuid = bundleUuid
|
||||
toAdd = append(toAdd, s)
|
||||
|
||||
for key, newRecord := range newMap {
|
||||
if _, exists := oldMap[key]; exists {
|
||||
// 记录存在,需要更新
|
||||
toUpdate = append(toUpdate, newRecord)
|
||||
} else {
|
||||
s.BundleUuid = bundleUuid
|
||||
toUpdate = append(toUpdate, s)
|
||||
// 记录不存在,需要新增
|
||||
toAdd = append(toAdd, newRecord)
|
||||
}
|
||||
}
|
||||
|
||||
// 需要删除的
|
||||
for _, uid := range oldUuids {
|
||||
if _, exist := newUuids[uid]; !exist {
|
||||
toDel = append(toDel, uid)
|
||||
for key := range oldMap {
|
||||
if _, exists := newMap[key]; !exists {
|
||||
// 旧记录在新数据中不存在,需要删除
|
||||
toDel = append(toDel, key)
|
||||
}
|
||||
}
|
||||
|
||||
if len(toDel) > 0 {
|
||||
if err = tx.Where("bundle_uuid = ? AND value_uid IN ?", bundleUuid, toDel).Delete(&model.BundleToValueAddService{}).Error; err != nil {
|
||||
return errors.New("删除套餐与增值服务关联失败")
|
||||
for _, key := range toDel {
|
||||
parts := strings.Split(key, "_")
|
||||
if len(parts) == 2 {
|
||||
valueUid := parts[0]
|
||||
benefitsType := parts[1]
|
||||
if err = tx.Where("bundle_uuid = ? AND value_uid = ? AND benefits_type = ? AND deleted_at = 0",
|
||||
bundleUuid, valueUid, benefitsType).Delete(&model.BundleToValueAddService{}).Error; err != nil {
|
||||
return errors.New("删除套餐与增值服务关联失败")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(toAdd) > 0 {
|
||||
if err = dao.CreateBundleToValueAddService(tx, toAdd); err != nil {
|
||||
return errors.New("保存套餐与增值服务关联失败")
|
||||
@ -477,6 +636,7 @@ func diffUpdateBundleToValueAddService(tx *gorm.DB, bundleUuid string, selectSer
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func saveBundleHistory(tx *gorm.DB, bundleUuid string, operator string, operatorId uint64) error {
|
||||
// 保存历史记录
|
||||
data, err := dao.GetBundleDetailByUuid(bundleUuid)
|
||||
|
@ -1,12 +1,13 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"github.com/jinzhu/copier"
|
||||
"micro-bundle/internal/dao"
|
||||
"micro-bundle/internal/model"
|
||||
"micro-bundle/pb/bundle"
|
||||
"micro-bundle/pkg/app"
|
||||
"micro-bundle/pkg/utils"
|
||||
|
||||
"github.com/jinzhu/copier"
|
||||
)
|
||||
|
||||
func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonResponse, err error) {
|
||||
@ -38,6 +39,10 @@ func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonRespons
|
||||
SignedTime: req.SignedTime,
|
||||
Snapshot: req.Snapshot,
|
||||
HandlingFee: i.HandlingFee,
|
||||
EquityType: i.EquityType,
|
||||
QuotaType: i.QuotaType,
|
||||
QuotaValue: i.QuotaValue,
|
||||
IsExpired: i.IsExpired,
|
||||
})
|
||||
}
|
||||
orderRecord := &model.BundleOrderRecords{
|
||||
|
314
internal/logic/taskLogic.go
Normal file
314
internal/logic/taskLogic.go
Normal file
@ -0,0 +1,314 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"micro-bundle/internal/dao"
|
||||
commonErr "micro-bundle/pkg/err"
|
||||
)
|
||||
|
||||
// GetValidArtistList 查询套餐状态为有效中的艺人列表
|
||||
// 调用dao层获取艺人详细信息
|
||||
func GetValidArtistList() ([]dao.ValidArtistInfo, error) {
|
||||
return dao.GetValidArtistList()
|
||||
}
|
||||
|
||||
// GetValidArtistIDs 查询套餐没有过期的艺人ID列表(保持向后兼容)
|
||||
// 根据BundleOrderRecords表查询过期时间大于当前时间且状态为已支付的艺人
|
||||
func GetValidArtistIDs() ([]string, error) {
|
||||
artistList, err := GetValidArtistList()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var artistIDs []string
|
||||
for _, artist := range artistList {
|
||||
if artist.CustomerNum != "" {
|
||||
artistIDs = append(artistIDs, artist.CustomerNum)
|
||||
}
|
||||
}
|
||||
|
||||
return artistIDs, nil
|
||||
}
|
||||
|
||||
// todo 目前暂时不做检验,后续需要做判断
|
||||
// GetValidEmployeeIDs 查询可以被指派任务的员工ID列表
|
||||
// 这里可以根据实际业务需求实现,比如查询员工表、权限表等
|
||||
// 目前先返回一个示例实现,实际项目中需要根据具体的员工管理逻辑来实现
|
||||
func GetValidEmployeeIDs() ([]string, error) {
|
||||
var employeeIDs []string
|
||||
|
||||
return employeeIDs, nil
|
||||
}
|
||||
|
||||
// ValidateEmployee 验证员工是否可以被指派任务
|
||||
func ValidateEmployee(employeeNum string) (bool, error) {
|
||||
validEmployees, err := GetValidEmployeeIDs()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
// 如果没有限制(返回空列表),则认为所有员工都可以被指派
|
||||
if len(validEmployees) == 0 {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
for _, validEmp := range validEmployees {
|
||||
if validEmp == employeeNum {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// GetPendingTaskList 查询待指派任务记录
|
||||
func GetPendingTaskList(req *dao.TaskQueryRequest) ([]*dao.TaskQueryResponse, int64, error) {
|
||||
// 1. 先查询套餐没有过期的艺人
|
||||
validArtist, err := GetValidArtistList()
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
// 2. 调用DAO层查询待指派任务记录
|
||||
record, total, err := dao.GetPendingTaskList(req, validArtist)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
// 3. 转换为响应结构体
|
||||
var recordResponse []*dao.TaskQueryResponse
|
||||
for _, record := range record {
|
||||
// 根据 SubNum 和 TelNum 查询对应的员工正在进行中的任务和已完成任务数量
|
||||
progressTaskCount, completeTaskCount, err := dao.GetTaskAssigneeInfo(record.TaskAssigneeNum)
|
||||
if err != nil {
|
||||
recordResponse = append(recordResponse, &dao.TaskQueryResponse{
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
ArtistName: record.ArtistName,
|
||||
TaskAssigneeNum: record.TaskAssigneeNum,
|
||||
PendingPostCount: record.PendingPostCount,
|
||||
PendingVideoCount: record.PendingVideoCount,
|
||||
PendingDataCount: record.PendingDataCount,
|
||||
ProgressTaskCount: 0,
|
||||
CompleteTaskCount: 0,
|
||||
LastTaskAssignee: record.LastTaskAssignee,
|
||||
})
|
||||
} else {
|
||||
recordResponse = append(recordResponse, &dao.TaskQueryResponse{
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
ArtistName: record.ArtistName,
|
||||
TaskAssigneeNum: record.TaskAssigneeNum,
|
||||
PendingPostCount: record.PendingPostCount,
|
||||
PendingVideoCount: record.PendingVideoCount,
|
||||
PendingDataCount: record.PendingDataCount,
|
||||
ProgressTaskCount: progressTaskCount,
|
||||
CompleteTaskCount: completeTaskCount,
|
||||
LastTaskAssignee: record.LastTaskAssignee,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return recordResponse, total, nil
|
||||
}
|
||||
|
||||
// AssignTask 指派某位员工完成某个艺人的任务
|
||||
func AssignTask(req *dao.TaskAssignRequest) error {
|
||||
// 1. 验证员工是否可以被指派任务
|
||||
isValid, err := ValidateEmployee(req.TaskAssigneeNum)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !isValid {
|
||||
return commonErr.ReturnError(nil, "员工不能被指派任务", "该员工不在可指派任务的员工列表中")
|
||||
}
|
||||
|
||||
progressTaskCount, completeTaskCount, err := dao.GetTaskAssigneeInfo(req.TaskAssigneeNum)
|
||||
if err != nil {
|
||||
// 查询不到的话,给一个默认值
|
||||
progressTaskCount, completeTaskCount = 1, 0
|
||||
}
|
||||
|
||||
// 2. 调用DAO层执行指派任务
|
||||
// 待完成任务数量需要+1,因为这个任务暂时还没有指派,所以+1
|
||||
return dao.AssignTask(req, progressTaskCount+1, completeTaskCount)
|
||||
}
|
||||
|
||||
// UpdatePendingCount 修改待发数量
|
||||
func UpdatePendingCount(req *dao.UpdatePendingCountRequest) error {
|
||||
// 1. 验证艺人是否有有效套餐
|
||||
validArtistIDs, err := GetValidArtistIDs()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 检查艺人是否在有效列表中
|
||||
isValidArtist := false
|
||||
for _, artistID := range validArtistIDs {
|
||||
if artistID == req.SubNum {
|
||||
isValidArtist = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !isValidArtist {
|
||||
return commonErr.ReturnError(nil, "艺人套餐已过期", "该艺人没有有效的套餐,无法修改待发数量")
|
||||
}
|
||||
|
||||
// todo 需要调用套餐的接口,判断艺人是否有那么数量可以修改
|
||||
|
||||
// 2. 调用DAO层更新待发数量
|
||||
return dao.UpdatePendingCount(req)
|
||||
}
|
||||
|
||||
// GetRecentAssignRecords 查询最近被指派记录
|
||||
func GetRecentAssignRecords(limit int) ([]string, error) {
|
||||
records, err := dao.GetRecentAssignRecords(limit)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var recordOperator []string
|
||||
for _, record := range records {
|
||||
recordOperator = append(recordOperator, record.TaskAssignee)
|
||||
}
|
||||
return recordOperator, nil
|
||||
}
|
||||
|
||||
// GetEmployeeAssignedTasks 根据登录人信息查询被指派给该员工的艺人任务
|
||||
func GetEmployeeAssignedTasks(req *dao.EmployeeTaskQueryRequest) ([]*dao.TaskAssignRecordsResponse, int64, error) {
|
||||
// 1. 调用DAO层查询被指派给该员工的艺人任务
|
||||
record, total, err := dao.GetEmployeeAssignedTasks(req)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
// 2. 转换为响应结构体
|
||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
||||
for _, record := range record {
|
||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
ArtistName: record.ArtistName,
|
||||
Status: record.Status,
|
||||
ActualStatus: record.ActualStatus,
|
||||
CompleteTime: record.CompleteTime,
|
||||
OperatorType: record.OperatorType,
|
||||
Operator: record.Operator,
|
||||
OperatorNum: record.OperatorNum,
|
||||
OperatorTime: record.OperatorTime,
|
||||
TaskAssignee: record.TaskAssignee,
|
||||
TaskAssigneeNum: record.TaskAssigneeNum,
|
||||
PendingVideoCount: record.PendingVideoCount,
|
||||
PendingPostCount: record.PendingPostCount,
|
||||
PendingDataCount: record.PendingDataCount,
|
||||
// todo: 将更新时间转换成人类可读的格式
|
||||
UpdatedAt: record.UpdatedAt,
|
||||
})
|
||||
}
|
||||
|
||||
return recordResponse, total, nil
|
||||
}
|
||||
|
||||
// CompleteTaskManually 员工手动点击完成任务
|
||||
func CompleteTaskManually(assignRecordsUUID string, taskAssigneeNum string) error {
|
||||
// 第一步,批量更新记录被指派的员工为taskAssigneeNum的待完成任务数量和已经完成任务的数量
|
||||
err := dao.UpdateTaskRecordsByAssigneeNum(taskAssigneeNum)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return dao.CompleteTaskManually(assignRecordsUUID)
|
||||
}
|
||||
|
||||
// UpdateTaskProgress 员工实际完成任务状态更新
|
||||
func UpdateTaskProgress(req *dao.CompleteTaskRequest) error {
|
||||
return dao.UpdateTaskProgress(req)
|
||||
}
|
||||
|
||||
// // GetArtistBundleInfo 获取艺人套餐信息(用于判断套餐多媒体数量)
|
||||
// func GetArtistBundleInfo(customerNum string) ([]*model.BundleOrderRecords, error) {
|
||||
// var orderRecords []*model.BundleOrderRecords
|
||||
// currentTime := time.Now().Format("2006-01-02 15:04:05")
|
||||
|
||||
// // 查询该艺人的有效套餐订单
|
||||
// err := app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).
|
||||
// Where("customer_num = ? AND expiration_time > ? AND status = ?",
|
||||
// customerNum, currentTime, 2). // 2:已签已支付
|
||||
// Preload("BundleOrderValueAdd").
|
||||
// Find(&orderRecords).Error
|
||||
|
||||
// if err != nil {
|
||||
// return nil, commonErr.ReturnError(err, "查询艺人套餐信息失败", "查询艺人套餐信息失败: ")
|
||||
// }
|
||||
|
||||
// return orderRecords, nil
|
||||
// }
|
||||
|
||||
// // CalculateArtistPendingCounts 计算艺人的待发数量
|
||||
// // 根据套餐信息计算艺人可以额外多发的多媒体内容数量
|
||||
// func CalculateArtistPendingCounts(customerNum string) (videoCount, postCount, dataCount int, err error) {
|
||||
// // 获取艺人套餐信息
|
||||
// orderRecords, err := GetArtistBundleInfo(customerNum)
|
||||
// if err != nil {
|
||||
// return 0, 0, 0, err
|
||||
// }
|
||||
|
||||
// // 计算总的可用数量
|
||||
// for _, record := range orderRecords {
|
||||
// // 从套餐基础数量计算
|
||||
// videoCount += int(record.Num) // 假设Num字段表示视频数量
|
||||
|
||||
// // 从增值服务计算
|
||||
// for _, valueAdd := range record.BundleOrderValueAdd {
|
||||
// switch valueAdd.ServiceType {
|
||||
// case 1: // 视频
|
||||
// videoCount += int(valueAdd.Num)
|
||||
// case 2: // 图文
|
||||
// postCount += int(valueAdd.Num)
|
||||
// case 3: // 数据报表
|
||||
// dataCount += int(valueAdd.Num)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// return videoCount, postCount, dataCount, nil
|
||||
// }
|
||||
|
||||
// GetTaskAssignRecordsList 多条件查询操作记录表
|
||||
func GetTaskAssignRecordsList(req *dao.TaskAssignRecordsQueryRequest) ([]*dao.TaskAssignRecordsResponse, int64, error) {
|
||||
record, total, err := dao.GetTaskAssignRecordsList(req)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
// 2. 转换为响应结构体
|
||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
||||
for _, record := range record {
|
||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
ArtistName: record.ArtistName,
|
||||
Status: record.Status,
|
||||
ActualStatus: record.ActualStatus,
|
||||
CompleteTime: record.CompleteTime,
|
||||
OperatorType: record.OperatorType,
|
||||
Operator: record.Operator,
|
||||
OperatorNum: record.OperatorNum,
|
||||
OperatorTime: record.OperatorTime,
|
||||
TaskAssignee: record.TaskAssignee,
|
||||
TaskAssigneeNum: record.TaskAssigneeNum,
|
||||
PendingVideoCount: record.PendingVideoCount,
|
||||
PendingPostCount: record.PendingPostCount,
|
||||
PendingDataCount: record.PendingDataCount,
|
||||
UpdatedAt: record.UpdatedAt,
|
||||
})
|
||||
}
|
||||
|
||||
return recordResponse, total, nil
|
||||
}
|
||||
|
||||
// GetArtistBundleBalance 查询艺人套餐剩余数量
|
||||
func GetArtistBundleBalance(req *dao.ArtistBundleBalanceRequest) (*dao.ArtistBundleBalanceResponse, error) {
|
||||
return dao.GetArtistBundleBalance(req)
|
||||
}
|
@ -169,7 +169,7 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
|
||||
}
|
||||
if option.TotalPrice == "" {
|
||||
if option.Symbol == "=" {
|
||||
return res, errors.New("总价不能为空")
|
||||
return res, errors.New("总价不能为空")
|
||||
}
|
||||
option.TotalPrice = "0"
|
||||
}
|
||||
@ -190,9 +190,20 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
|
||||
Symbol: option.Symbol,
|
||||
Price: float32(price),
|
||||
TotalPrice: float32(totalPrice),
|
||||
IsDefault: option.IsDefault,
|
||||
})
|
||||
index++
|
||||
}
|
||||
hasDefault := false
|
||||
for _, option := range options {
|
||||
if option.IsDefault {
|
||||
hasDefault = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !hasDefault {
|
||||
return res, errors.New("请选择默认套餐数量")
|
||||
}
|
||||
ok, err := model.ValidateOptions(options)
|
||||
if !ok {
|
||||
return res, err
|
||||
@ -210,6 +221,9 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
|
||||
Language: in.Language,
|
||||
PriceType: in.PriceType,
|
||||
Options: options,
|
||||
QuotaType: in.QuotaType,
|
||||
QuotaValue: in.QuotaValue,
|
||||
IsExpired: in.IsExpired,
|
||||
}
|
||||
if in.Uuid == "" && in.Language != msg.ZH_CN {
|
||||
return res, errors.New("请先创建中文版本增值服务")
|
||||
@ -271,6 +285,9 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
|
||||
Language: lang,
|
||||
PriceType: valueAddServiceLang.PriceType,
|
||||
Options: valueAddServiceLang.Options,
|
||||
QuotaType: valueAddServiceLang.QuotaType,
|
||||
QuotaValue: valueAddServiceLang.QuotaValue,
|
||||
IsExpired: valueAddServiceLang.IsExpired,
|
||||
}
|
||||
otherLang.Language = lang
|
||||
if err = dao.CreateValueAddServiceLang(tx, &otherLang); err != nil {
|
||||
@ -309,6 +326,9 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
|
||||
"price_type": in.PriceType,
|
||||
"options": options,
|
||||
"language": in.Language,
|
||||
"quota_type": in.QuotaType,
|
||||
"quota_value": in.QuotaValue,
|
||||
"is_expired": in.IsExpired,
|
||||
}
|
||||
if err := dao.UpdateValueAddServiceLang(tx, updateLangService); err != nil {
|
||||
return res, errors.New("更新增值服务失败")
|
||||
@ -349,6 +369,9 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
|
||||
ServiceType: valueAddService.ServiceType,
|
||||
}
|
||||
for _, serviceLang := range valueAddService.ValueAddServiceLang {
|
||||
if serviceLang.QuotaType == 0 && serviceInfo.ServiceType != 5 && serviceInfo.ServiceType != 4 {
|
||||
serviceLang.QuotaType = 1
|
||||
}
|
||||
serviceLangInfo := &bundle.ValueAddServiceLang{
|
||||
Uuid: valueAddService.UUID,
|
||||
ServiceName: serviceLang.ServiceName,
|
||||
@ -360,6 +383,14 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
|
||||
Language: serviceLang.Language,
|
||||
CreatedAt: time.Unix(serviceLang.CreatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
UpdatedAt: time.Unix(serviceLang.UpdatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
QuotaType: serviceLang.QuotaType,
|
||||
QuotaValue: serviceLang.QuotaValue,
|
||||
IsExpired: serviceLang.IsExpired,
|
||||
}
|
||||
if serviceLangInfo.Language == msg.ZH_CN && serviceInfo.ServiceType != 5 && serviceInfo.ServiceType != 4 {
|
||||
serviceInfo.QuotaType = serviceLangInfo.QuotaType
|
||||
serviceInfo.QuotaValue = serviceLangInfo.QuotaValue
|
||||
serviceInfo.IsExpired = serviceLangInfo.IsExpired
|
||||
}
|
||||
if len(serviceLang.Options) > 0 {
|
||||
var options []*bundle.ValueAddPriceOptions
|
||||
@ -383,6 +414,10 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
|
||||
default:
|
||||
return nil, errors.New("无效的价格模式")
|
||||
}
|
||||
//添加服务默认数量
|
||||
if option.IsDefault && serviceLangInfo.Language == msg.ZH_CN {
|
||||
serviceInfo.DefaultServiceValue = option.Num
|
||||
}
|
||||
options = append(options, &bundle.ValueAddPriceOptions{
|
||||
Id: int64(option.Id),
|
||||
Num: option.Num,
|
||||
@ -390,6 +425,7 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
|
||||
Price: fmt.Sprintf("%.2f", option.Price),
|
||||
TotalPrice: fmt.Sprintf("%.2f", option.TotalPrice),
|
||||
SaveAmount: saveAmount.StringFixed(2),
|
||||
IsDefault: option.IsDefault,
|
||||
})
|
||||
}
|
||||
serviceLangInfo.Options = options
|
||||
@ -454,6 +490,7 @@ func ValueAddServiceDetail(req *bundle.ValueAddServiceDetailRequest) (res *bundl
|
||||
Price: fmt.Sprintf("%.2f", opt.Price),
|
||||
TotalPrice: fmt.Sprintf("%.2f", opt.TotalPrice),
|
||||
SaveAmount: saveAmount.StringFixed(2),
|
||||
IsDefault: opt.IsDefault,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -469,6 +506,9 @@ func ValueAddServiceDetail(req *bundle.ValueAddServiceDetailRequest) (res *bundl
|
||||
Options: langOptions,
|
||||
CreatedAt: time.Unix(serviceLang.CreatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
UpdatedAt: time.Unix(serviceLang.UpdatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
QuotaType: serviceLang.QuotaType,
|
||||
QuotaValue: serviceLang.QuotaValue,
|
||||
IsExpired: serviceLang.IsExpired,
|
||||
}
|
||||
serviceLangs = append(serviceLangs, serviceLangInfo)
|
||||
}
|
||||
@ -543,6 +583,7 @@ func ValueAddServiceDetailByUuidAndLanguage(req *bundle.ValueAddServiceDetailReq
|
||||
Price: fmt.Sprintf("%.2f", opt.Price),
|
||||
TotalPrice: fmt.Sprintf("%.2f", opt.TotalPrice),
|
||||
SaveAmount: saveAmount.StringFixed(2),
|
||||
IsDefault: opt.IsDefault,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -558,6 +599,9 @@ func ValueAddServiceDetailByUuidAndLanguage(req *bundle.ValueAddServiceDetailReq
|
||||
Options: langOptions,
|
||||
CreatedAt: time.Unix(detail.CreatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
UpdatedAt: time.Unix(detail.UpdatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
QuotaType: detail.QuotaType,
|
||||
QuotaValue: detail.QuotaValue,
|
||||
IsExpired: detail.IsExpired,
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -636,6 +680,7 @@ func BatchGetValueAddServiceLang(req *bundle.BatchGetValueAddServiceLangRequest)
|
||||
Price: fmt.Sprintf("%.2f", opt.Price),
|
||||
TotalPrice: fmt.Sprintf("%.2f", opt.TotalPrice),
|
||||
SaveAmount: saveAmount.StringFixed(2),
|
||||
IsDefault: opt.IsDefault,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ type BundleToValueAddService struct {
|
||||
ValueUid string `json:"valueUid" gorm:"column:value_uid;type:varchar(1024);comment:增值服务UUID"`
|
||||
ValueAddService ValueAddService `gorm:"foreignKey:ValueUid;references:UUID" json:"valueAddService"`
|
||||
IsDisplay bool `json:"isDisplay" gorm:"column:is_display;type:tinyint(1);comment:是否显示"`
|
||||
BenefitsType int32 `json:"benefitsType" gorm:"column:benefits_type;type:int;comment:套餐权益类型 1:套餐权益 2:套餐可选附加权益"`
|
||||
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
|
||||
UpdatedAt int64 `gorm:"column:updated_at;autoCreateTime"`
|
||||
DeletedAt soft_delete.DeletedAt
|
||||
@ -143,64 +144,209 @@ type BundleExtendRecordItemDto struct {
|
||||
}
|
||||
|
||||
type BundleBalancePo struct {
|
||||
UserId int `gorm:"column:user_id"`
|
||||
UserName string `gorm:"column:user_name"`
|
||||
UserPhoneNumber string `gorm:"column:user_phone_number"`
|
||||
BundleName string `gorm:"column:bundle_name"`
|
||||
ExpirationTime string `gorm:"column:expired_time"`
|
||||
Status int `gorm:"column:status"`
|
||||
OrderUUID string `gorm:"column:order_uuid"`
|
||||
AccountNumber int `gorm:"column:account_number;not null"`
|
||||
AccountConsumptionNumber int `gorm:"column:account_consumption_number;not null"`
|
||||
VideoNumber int `gorm:"column:video_number;not null"`
|
||||
VideoConsumptionNumber int `gorm:"column:video_consumption_number;not null"`
|
||||
ImageNumber int `gorm:"column:image_number;not null"`
|
||||
ImageConsumptionNumber int `gorm:"column:image_consumption_number;not null"`
|
||||
DataAnalysisNumber int `gorm:"column:data_analysis_number;not null"`
|
||||
DataAnalysisConsumptionNumber int `gorm:"column:data_analysis_consumption_number;not null"`
|
||||
ExpansionPacksNumber int `gorm:"column:expansion_packs_number;not null"`
|
||||
UserId int `gorm:"column:user_id"`
|
||||
UserName string `gorm:"column:user_name"`
|
||||
UserPhoneNumber string `gorm:"column:user_phone_number"`
|
||||
BundleName string `gorm:"column:bundle_name"`
|
||||
Status int `gorm:"column:status"`
|
||||
OrderUUID string `gorm:"column:order_uuid"`
|
||||
Activate int `gorm:"column:activate"`
|
||||
CustomerNum string `gorm:"column:customer_num"`
|
||||
PayTime string `gorm:"column:pay_time"`
|
||||
BundleBalance
|
||||
}
|
||||
|
||||
type UserBundleBalancePo struct {
|
||||
OrderUUID string `json:"orderUUID" gorm:"column:order_uuid"`
|
||||
BundleUuid string `json:"bundleUuid" gorm:"column:bundle_uuid"`
|
||||
BundleName string `json:"bundleName" gorm:"column:bundle_name"`
|
||||
BundleStatus string `json:"bundleStatus" gorm:"column:bundle_status"`
|
||||
PayTime string `json:"payTime" gorm:"column:pay_time"`
|
||||
ExpiredTime string `json:"expiredTime" gorm:"column:expired_time"`
|
||||
PaymentAmount string `json:"paymentAmount" gorm:"column:payment_amount"`
|
||||
PaymentType int32 `json:"paymentType" gorm:"column:payment_type"`
|
||||
AccountNumber int32 `json:"accountNumber" gorm:"column:account_number"`
|
||||
AccountAdditional int32 `json:"accountAdditional" gorm:"column:account_additional"`
|
||||
AccountConsumptionNumber int32 `json:"accountConsumptionNumber" gorm:"column:account_consumption_number"`
|
||||
VideoNumber int32 `json:"videoNumber" gorm:"column:video_number"`
|
||||
VideoAdditional int32 `json:"videoAdditional" gorm:"column:video_additional"`
|
||||
VideoConsumptionNumber int32 `json:"videoConsumptionNumber" gorm:"column:video_consumption_number"`
|
||||
ImageNumber int32 `json:"imageNumber" gorm:"column:image_number"`
|
||||
ImageAdditional int32 `json:"imageAdditional" gorm:"column:image_additional"`
|
||||
ImageConsumptionNumber int32 `json:"imageConsumptionNumber" gorm:"column:image_consumption_number"`
|
||||
DataAnalysisNumber int32 `json:"dataAnalysisNumber" gorm:"column:data_analysis_number"`
|
||||
DataAnalysisAdditional int32 `json:"dataAnalysisAdditional" gorm:"column:data_analysis_additional"`
|
||||
DataAnalysisConsumptionNumber int32 `json:"dataAnalysisConsumptionNumber" gorm:"column:data_analysis_consumption_number"`
|
||||
ExpansionPacksNumber int32 `json:"expansionPacksNumber" gorm:"column:expansion_packs_number"`
|
||||
OrderUUID string `json:"orderUUID" gorm:"column:order_uuid"`
|
||||
BundleUuid string `json:"bundleUuid" gorm:"column:bundle_uuid"`
|
||||
BundleName string `json:"bundleName" gorm:"column:bundle_name"`
|
||||
BundleStatus string `json:"bundleStatus" gorm:"column:bundle_status"`
|
||||
PayTime string `json:"payTime" gorm:"column:pay_time"`
|
||||
ExpiredTime string `json:"expiredTime" gorm:"column:expired_time"`
|
||||
PaymentAmount string `json:"paymentAmount" gorm:"column:payment_amount"`
|
||||
PaymentType int32 `json:"paymentType" gorm:"column:payment_type"`
|
||||
Activate int `gorm:"column:activate"`
|
||||
BundleBalance
|
||||
}
|
||||
|
||||
type BundleBalance struct {
|
||||
gorm.Model
|
||||
UserId int `gorm:"column:user_id;not null"`
|
||||
OrderUUID string `gorm:"column:order_uuid;type:varchar(1024);not null"`
|
||||
AccountNumber int `gorm:"column:account_number;not null"`
|
||||
AccountConsumptionNumber int `gorm:"column:account_consumption_number;not null"`
|
||||
VideoNumber int `gorm:"column:video_number;not null"`
|
||||
VideoConsumptionNumber int `gorm:"column:video_consumption_number;not null"`
|
||||
ImageNumber int `gorm:"column:image_number;not null"`
|
||||
ImageConsumptionNumber int `gorm:"column:image_consumption_number;not null"`
|
||||
DataAnalysisNumber int `gorm:"column:data_analysis_number;not null"`
|
||||
DataAnalysisConsumptionNumber int `gorm:"column:data_analysis_consumption_number;not null"`
|
||||
ExpansionPacksNumber int `gorm:"column:expansion_packs_number;not null"`
|
||||
UserId int `gorm:"column:user_id;not null"`
|
||||
Month string `gorm:"column:month;type:varchar(32);not null"`
|
||||
OrderUUID string `gorm:"column:order_uuid;type:varchar(1024);not null"`
|
||||
ExpiredAt time.Time `gorm:"column:expired_at;type:datetime;comment:套餐过期时间"`
|
||||
StartAt time.Time `gorm:"column:start_at;type:datetime;comment:套餐开始时间"`
|
||||
|
||||
// 套餐与增值账号
|
||||
BundleAccountNumber int `gorm:"column:bundle_account_number;not null;comment:套餐账号总数"`
|
||||
IncreaseAccountNumber int `gorm:"column:increase_account_number;not null;comment:增值账号总数"`
|
||||
BundleAccountConsumptionNumber int `gorm:"column:bundle_account_consumption_number;not null;comment:套餐账号使用数"`
|
||||
IncreaseAccountConsumptionNumber int `gorm:"column:increase_account_consumption_number;not null;comment:增值账号使用数"`
|
||||
|
||||
// 手动账号扩展
|
||||
MonthlyNewAccountNumber int `gorm:"column:monthly_new_account_number;comment:当月手动扩展账号新增数"`
|
||||
MonthlyManualAccountConsumptionNumber int `gorm:"column:monthly_manual_account_consumption_number;comment:当月手动扩展账号使用数"`
|
||||
ManualAccountNumber int `gorm:"column:manual_account_number;comment:手动扩展账号总数"`
|
||||
ManualAccountConsumptionNumber int `gorm:"column:manual_account_consumption_number;comment:手动扩展账号使用数"`
|
||||
MonthlyNewManualAccountNumber int `gorm:"column:monthly_new_manual_account_number;comment:当月手动扩展账号新增数"`
|
||||
|
||||
// ===== 视频类 =====
|
||||
BundleVideoNumber int `gorm:"column:bundle_video_number;not null;comment:非限制类型套餐权益视频总数"`
|
||||
IncreaseVideoNumber int `gorm:"column:increase_video_number;not null;comment:非限制类型增值权益视频总数"`
|
||||
BundleLimitVideoNumber int `gorm:"column:bundle_limit_video_number;not null;comment:套餐权益限制类型非过期总数"`
|
||||
IncreaseLimitVideoNumber int `gorm:"column:increase_limit_video_number;not null;comment:增值权益限制类型非过期总数"`
|
||||
BundleLimitVideoExpiredNumber int `gorm:"column:bundle_limit_video_expired_number;not null;comment:套餐权益限制类型会过期总数"`
|
||||
IncreaseLimitVideoExpiredNumber int `gorm:"column:increase_limit_video_expired_number;not null;comment:增值权益限制类型会过期总数"`
|
||||
MonthlyInvalidBundleVideoNumber int `gorm:"column:monthly_invalid_bundle_video_number;not null;comment:当月失效的套餐权益视频总数"`
|
||||
InvalidBundleVideoNumber int `gorm:"column:invalid_bundle_video_number;not null;comment:历史失效的套餐权益视频总数"`
|
||||
MonthlyInvalidIncreaseVideoNumber int `gorm:"column:monthly_invalid_increase_video_number;not null;comment:当月失效的增值权益视频总数"`
|
||||
InvalidIncreaseVideoNumber int `gorm:"column:invalid_increase_video_number;not null;comment:历史失效的增值权益视频总数"`
|
||||
BundleVideoConsumptionNumber int `gorm:"column:bundle_video_consumption_number;not null;comment:非限制类型套餐权益视频使用数"`
|
||||
IncreaseVideoConsumptionNumber int `gorm:"column:increase_video_consumption_number;not null;comment:非限制类型增值权益视频使用数"`
|
||||
BundleLimitVideoConsumptionNumber int `gorm:"column:bundle_limit_video_consumption_number;not null;comment:套餐权益限制类型非过期使用数"`
|
||||
IncreaseLimitVideoConsumptionNumber int `gorm:"column:increase_limit_video_consumption_number;not null;comment:增值权益限制类型非过期使用数"`
|
||||
BundleLimitVideoExpiredConsumptionNumber int `gorm:"column:bundle_limit_video_expired_consumption_number;not null;comment:套餐权益限制类型会过期使用数"`
|
||||
IncreaseLimitVideoExpiredConsumptionNumber int `gorm:"column:increase_limit_video_expired_consumption_number;not null;comment:增值权益限制类型会过期使用数"`
|
||||
MonthlyLimitVideoNumber int `gorm:"column:monthly_limit_video_number;not null;comment:当月限制类型视频可用数"`
|
||||
MonthlyLimitVideoConsumptionNumber int `gorm:"column:monthly_limit_video_consumption_number;not null;comment:当月限制类型视频已使用额度"`
|
||||
MonthlyLimitVideoExpireNumber int `gorm:"column:monthly_limit_video_expired_number;not null;comment:当月限制类型视频会过期可用数"`
|
||||
MonthlyLimitVideoExpireConsumptionNumber int `gorm:"column:monthly_limit_video_expired_consumption_number;not null;comment:当月限制类型视频会过期已使用额度"`
|
||||
MonthlyBundleVideoConsumptionNumber int `gorm:"column:monthly_bundle_video_consumption_number;not null;comment:当月套餐类型总使用数"`
|
||||
MonthlyIncreaseVideoConsumptionNumber int `gorm:"column:monthly_increase_video_consumption_number;not null;comment:当月增值类型总使用数"`
|
||||
MonthlyLimitVideoQuotaNumber int `gorm:"column:monthly_limit_video_quota_number;not null;comment:当月限制类型视频额度"`
|
||||
ManualVideoNumber int `gorm:"column:manual_video_number;comment:手动扩展视频总数"`
|
||||
ManualVideoConsumptionNumber int `gorm:"column:manual_video_consumption_number;comment:手动扩展视频使用数"`
|
||||
MonthlyNewManualVideoNumber int `gorm:"column:monthly_new_manual_video_number;comment:当月手动扩展视频新增数"`
|
||||
MonthlyManualVideoConsumptionNumber int `gorm:"column:monthly_manual_video_consumption_number;comment:当月手动扩展视频使用数"`
|
||||
|
||||
// ===== 图片类 =====
|
||||
BundleImageNumber int `gorm:"column:bundle_image_number;not null;comment:非限制类型套餐权益图片总数"`
|
||||
IncreaseImageNumber int `gorm:"column:increase_image_number;not null;comment:非限制类型增值权益图片总数"`
|
||||
BundleLimitImageNumber int `gorm:"column:bundle_limit_image_number;not null;comment:套餐权益限制类型非过期总数"`
|
||||
IncreaseLimitImageNumber int `gorm:"column:increase_limit_image_number;not null;comment:增值权益限制类型非过期总数"`
|
||||
BundleLimitImageExpiredNumber int `gorm:"column:bundle_limit_image_expired_number;not null;comment:套餐权益限制类型会过期总数"`
|
||||
IncreaseLimitImageExpiredNumber int `gorm:"column:increase_limit_image_expired_number;not null;comment:增值权益限制类型会过期总数"`
|
||||
MonthlyInvalidBundleImageNumber int `gorm:"column:monthly_invalid_bundle_image_number;not null;comment:当月失效的套餐权益图片总数"`
|
||||
InvalidBundleImageNumber int `gorm:"column:invalid_bundle_image_number;not null;comment:历史失效的套餐权益图片总数"`
|
||||
MonthlyInvalidIncreaseImageNumber int `gorm:"column:monthly_invalid_increase_image_number;not null;comment:当月失效的增值权益图片总数"`
|
||||
InvalidIncreaseImageNumber int `gorm:"column:invalid_increase_image_number;not null;comment:历史失效的增值权益图片总数"`
|
||||
BundleImageConsumptionNumber int `gorm:"column:bundle_image_consumption_number;not null;comment:非限制类型套餐权益图片使用数"`
|
||||
IncreaseImageConsumptionNumber int `gorm:"column:increase_image_consumption_number;not null;comment:非限制类型增值权益图片使用数"`
|
||||
BundleLimitImageConsumptionNumber int `gorm:"column:bundle_limit_image_consumption_number;not null;comment:套餐权益限制类型非过期使用数"`
|
||||
IncreaseLimitImageConsumptionNumber int `gorm:"column:increase_limit_image_consumption_number;not null;comment:增值权益限制类型非过期使用数"`
|
||||
BundleLimitImageExpiredConsumptionNumber int `gorm:"column:bundle_limit_image_expired_consumption_number;not null;comment:套餐权益限制类型会过期使用数"`
|
||||
IncreaseLimitImageExpiredConsumptionNumber int `gorm:"column:increase_limit_image_expired_consumption_number;not null;comment:增值权益限制类型会过期使用数"`
|
||||
MonthlyLimitImageNumber int `gorm:"column:monthly_limit_image_number;not null;comment:当月限制类型图片可使用额度"`
|
||||
MonthlyLimitImageConsumptionNumber int `gorm:"column:monthly_limit_image_consumption_number;not null;comment:当月限制类型图片已使用额度"`
|
||||
MonthlyLimitImageExpireNumber int `gorm:"column:monthly_limit_image_expired_number;not null;comment:当月限制类型图片会过期可用数"`
|
||||
MonthlyLimitImageExpireConsumptionNumber int `gorm:"column:monthly_limit_image_expired_consumption_number;not null;comment:当月限制类型图片会过期已使用额度"`
|
||||
MonthlyBundleImageConsumptionNumber int `gorm:"column:monthly_bundle_image_consumption_number;not null;comment:当月套餐类型总使用数"`
|
||||
MonthlyIncreaseImageConsumptionNumber int `gorm:"column:monthly_increase_image_consumption_number;not null;comment:当月增值类型总使用数"`
|
||||
MonthlyLimitImageQuotaNumber int `gorm:"column:monthly_limit_image_quota_number;not null;comment:当月限制类型图片额度"`
|
||||
ManualImageNumber int `gorm:"column:manual_image_number;comment:手动扩展图片总数"`
|
||||
ManualImageConsumptionNumber int `gorm:"column:manual_image_consumption_number;comment:手动扩展图片使用数"`
|
||||
MonthlyNewManualImageNumber int `gorm:"column:monthly_new_manual_image_number;comment:当月手动扩展图片新增数"`
|
||||
MonthlyManualImageConsumptionNumber int `gorm:"column:monthly_manual_image_consumption_number;comment:当月手动扩展图片使用数"`
|
||||
|
||||
// ===== 数据分析类 =====
|
||||
BundleDataAnalysisNumber int `gorm:"column:bundle_data_analysis_number;not null;comment:非限制类型套餐权益数据分析总数"`
|
||||
IncreaseDataAnalysisNumber int `gorm:"column:increase_data_analysis_number;not null;comment:非限制类型增值权益数据分析总数"`
|
||||
BundleLimitDataAnalysisNumber int `gorm:"column:bundle_limit_data_analysis_number;not null;comment:套餐权益限制类型非过期总数"`
|
||||
IncreaseLimitDataAnalysisNumber int `gorm:"column:increase_limit_data_analysis_number;not null;comment:增值权益限制类型非过期总数"`
|
||||
BundleLimitDataAnalysisExpiredNumber int `gorm:"column:bundle_limit_data_analysis_expired_number;not null;comment:套餐权益限制类型会过期总数"`
|
||||
IncreaseLimitDataAnalysisExpiredNumber int `gorm:"column:increase_limit_data_analysis_expired_number;not null;comment:增值权益限制类型会过期总数"`
|
||||
MonthlyInvalidBundleDataAnalysisNumber int `gorm:"column:monthly_invalid_bundle_data_analysis_number;not null;comment:当月失效的套餐权益数据分析总数"`
|
||||
InvalidBundleDataAnalysisNumber int `gorm:"column:invalid_bundle_data_analysis_number;not null;comment:历史失效的套餐权益数据分析总数"`
|
||||
MonthlyInvalidIncreaseDataAnalysisNumber int `gorm:"column:monthly_invalid_increase_data_analysis_number;not null;comment:当月失效的增值权益数据分析总数"`
|
||||
InvalidIncreaseDataAnalysisNumber int `gorm:"column:invalid_increase_data_analysis_number;not null;comment:历史失效的增值权益数据分析总数"`
|
||||
BundleDataAnalysisConsumptionNumber int `gorm:"column:bundle_data_analysis_consumption_number;not null;comment:非限制类型套餐权益数据分析使用数"`
|
||||
IncreaseDataAnalysisConsumptionNumber int `gorm:"column:increase_data_analysis_consumption_number;not null;comment:非限制类型增值权益数据分析使用数"`
|
||||
BundleLimitDataAnalysisConsumptionNumber int `gorm:"column:bundle_limit_data_analysis_consumption_number;not null;comment:套餐权益限制类型非过期使用数"`
|
||||
IncreaseLimitDataAnalysisConsumptionNumber int `gorm:"column:increase_limit_data_analysis_consumption_number;not null;comment:增值权益限制类型非过期使用数"`
|
||||
BundleLimitDataAnalysisExpiredConsumptionNumber int `gorm:"column:bundle_limit_data_analysis_expired_consumption_number;not null;comment:套餐权益限制类型会过期使用数"`
|
||||
IncreaseLimitDataAnalysisExpiredConsumptionNumber int `gorm:"column:increase_limit_data_analysis_expired_consumption_number;not null;comment:增值权益限制类型会过期使用数"`
|
||||
MonthlyLimitDataAnalysisNumber int `gorm:"column:monthly_limit_data_analysis_number;not null;comment:当月限制类型数据分析可使用额度"`
|
||||
MonthlyLimitDataAnalysisConsumptionNumber int `gorm:"column:monthly_limit_data_analysis_consumption_number;not null;comment:当月限制类型数据分析已使用额度"`
|
||||
MonthlyLimitDataAnalysisExpireNumber int `gorm:"column:monthly_limit_data_analysis_expired_number;not null;comment:当月限制类型数据分析会过期可用数"`
|
||||
MonthlyLimitDataAnalysisExpireConsumptionNumber int `gorm:"column:monthly_limit_data_analysis_expired_consumption_number;not null;comment:当月限制类型数据分析会过期已使用额度"`
|
||||
MonthlyBundleDataAnalysisConsumptionNumber int `gorm:"column:monthly_bundle_data_analysis_consumption_number;not null;comment:当月套餐类型总使用数"`
|
||||
MonthlyIncreaseDataAnalysisConsumptionNumber int `gorm:"column:monthly_increase_data_analysis_consumption_number;not null;comment:当月增值类型总使用数"`
|
||||
MonthlyLimitDataAnalysisQuotaNumber int `gorm:"column:monthly_limit_data_analysis_quota_number;not null;comment:当月限制类型数据分析额度"`
|
||||
ManualDataAnalysisNumber int `gorm:"column:manual_data_analysis_number;comment:手动扩展数据分析总数"`
|
||||
ManualDataAnalysisConsumptionNumber int `gorm:"column:manual_data_analysis_consumption_number;comment:手动扩展数据分析使用数"`
|
||||
MonthlyNewManualDataAnalysisNumber int `gorm:"column:monthly_new_manual_data_analysis_number;comment:当月手动扩展数据分析新增数"`
|
||||
MonthlyManualDataAnalysisConsumptionNumber int `gorm:"column:monthly_manual_data_analysis_consumption_number;comment:当月手动扩展数据分析使用数"`
|
||||
|
||||
MonthlyNewDurationNumber int `gorm:"column:monthly_new_duration_number;comment:当月新增手动扩展时长(天)"`
|
||||
ExpansionPacksNumber int `gorm:"column:expansion_packs_number;not null;comment:扩展包数量"`
|
||||
}
|
||||
|
||||
// TableName 表名称
|
||||
func (*BundleBalance) TableName() string {
|
||||
return "bundle_balance"
|
||||
}
|
||||
|
||||
type BundleActivate struct {
|
||||
gorm.Model
|
||||
UserId int `gorm:"column:user_id;not null;unique"`
|
||||
Activate int `gorm:"column:activate"`
|
||||
}
|
||||
|
||||
// TableName 表名称
|
||||
func (*BundleActivate) TableName() string {
|
||||
return "bundle_activate"
|
||||
}
|
||||
|
||||
type BundleBalanceUsePo struct {
|
||||
UserId int
|
||||
AccountNumber int
|
||||
VideoNumber int
|
||||
ImageNumber int
|
||||
DataAnalysisNumber int
|
||||
}
|
||||
type BundleBalanceExtendPo struct {
|
||||
UserId int
|
||||
AccountNumber int
|
||||
VideoNumber int
|
||||
ImageNumber int
|
||||
DataAnalysisNumber int
|
||||
DurationNumber int
|
||||
}
|
||||
|
||||
type BundleUsedRecord struct {
|
||||
gorm.Model
|
||||
UserID uint64 `gorm:"column:user_id;not null"`
|
||||
Type string `gorm:"column:type;size:100"`
|
||||
OrderUUID string `gorm:"column:order_uuid;size:100"`
|
||||
IsIncrement int `gorm:"column:is_increment"`
|
||||
ConsumptionType int `gorm:"column:consumption_type"`
|
||||
}
|
||||
|
||||
// TableName 设置表名
|
||||
func (BundleUsedRecord) TableName() string {
|
||||
return "bundle_used_record"
|
||||
}
|
||||
|
||||
type BundleExportDto struct {
|
||||
UserId int32
|
||||
Month string
|
||||
CustomerNum string
|
||||
Name string
|
||||
PayTime string
|
||||
BundleAmount float32
|
||||
IncreaseAmount float32
|
||||
TotalPayAmount float32
|
||||
Currency string
|
||||
Fee string
|
||||
}
|
||||
|
||||
type BundleExport struct {
|
||||
BundleExportDto
|
||||
balance *BundleBalance
|
||||
}
|
||||
|
||||
type BundleBalanceLayout struct {
|
||||
gorm.Model
|
||||
UserId uint64 `gorm:"column:user_id;not null;unique"`
|
||||
Data string `gorm:"column:data;type:longtext;not null"`
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@ -66,6 +67,10 @@ type BundleOrderValueAdd struct {
|
||||
CheckoutSessionId string `json:"checkoutSessionId" gorm:"column:checkout_session_id;type:varchar(1024);default:null;comment:checkoutSessionId"`
|
||||
CheckoutSessionUrl string `json:"checkoutSessionUrl" gorm:"column:checkout_session_url;type:varchar(1024);default:null;comment:checkoutSessionUrl"`
|
||||
HandlingFee string `gorm:"column:handling_fee;comment:手续费" json:"handlingFee"`
|
||||
EquityType int32 `gorm:"column:equity_type;comment:权益类型 1:套餐权益 2:附加权益" json:"equityType"`
|
||||
QuotaType int32 `json:"quotaType" gorm:"column:quota_type;type:int;default:1;comment:额度类型 1:不限额度 2:每月限额度"`
|
||||
QuotaValue int32 `json:"quotaValue" gorm:"column:quota_value;type:int;comment:额度值"`
|
||||
IsExpired bool `json:"isExpired" gorm:"column:is_expired;default:false;comment:是否过期作废 false:不作废 true:作废"`
|
||||
}
|
||||
|
||||
// 财务确认状态
|
||||
|
@ -31,6 +31,18 @@ func (CostLog) TableName() string {
|
||||
return "cast_cost_log"
|
||||
}
|
||||
|
||||
type CastWorkExtra struct {
|
||||
WorkUuid string `gorm:"column:work_uuid;type:varchar(50);primary_key;comment:作品uuid" json:"work_uuid"`
|
||||
CreatedAt int `gorm:"column:created_at;type:int(11)" json:"created_at"`
|
||||
UpdatedAt int `gorm:"column:updated_at;type:int(11)" json:"updated_at"`
|
||||
DeletedAt uint64 `gorm:"column:deleted_at;type:bigint(20) unsigned" json:"deleted_at"`
|
||||
ArtistConfirmedTime int64 `gorm:"column:artist_confirmed_time;type:bigint(20);default:0;comment:艺人确认时间;NOT NULL" json:"artist_confirmed_time"`
|
||||
}
|
||||
|
||||
func (m *CastWorkExtra) TableName() string {
|
||||
return "cast_work_extra"
|
||||
}
|
||||
|
||||
type CastWorkImage struct {
|
||||
Uuid string `json:"uuid" gorm:"uuid"`
|
||||
WorkUuid string `json:"work_uuid" gorm:"work_uuid"` // 作品uuid
|
||||
|
62
internal/model/task.go
Normal file
62
internal/model/task.go
Normal file
@ -0,0 +1,62 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/plugin/soft_delete"
|
||||
)
|
||||
|
||||
type TaskManagement struct {
|
||||
ID int64 `gorm:"primarykey"`
|
||||
SubNum string `gorm:"column:sub_num;comment:用户编号;index:idx_sub_num;index:idx_sub_tel,priority:1" json:"subNum"`
|
||||
TelNum string `gorm:"column:tel_num;comment:手机号;index:idx_tel_num;index:idx_sub_tel,priority:2" json:"telNum"`
|
||||
ArtistName string `gorm:"column:artist_name;comment:艺人名称;index:idx_artist_name" json:"artistName"`
|
||||
PendingVideoCount int `gorm:"column:pending_video_count;comment:待发视频数量;index:idx_pending_video" json:"pendingVideoCount"`
|
||||
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
||||
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
||||
LastTaskAssignee string `gorm:"column:last_task_assignee;comment:最后一次的任务指派人" json:"lastTaskAssignee"`
|
||||
TaskAssigneeNum string `gorm:"column:task_assignee_num;comment:任务指派人账号" json:"taskAssigneeNum"`
|
||||
ProgressCount int `gorm:"column:progress_count;comment:进行中的任务数量" json:"progressCount"`
|
||||
CompleteCount int `gorm:"column:complete_count;comment:已完成的任务数量" json:"completeCount"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_deleted_at" json:"deletedAt"`
|
||||
}
|
||||
|
||||
func (t *TaskManagement) TableName() string {
|
||||
return "task_management"
|
||||
}
|
||||
|
||||
// 指派记录表
|
||||
type TaskAssignRecords struct {
|
||||
ID int64 `gorm:"primarykey"`
|
||||
AssignRecordsUUID string `gorm:"column:assign_records_uuid;comment:指派记录UUID;uniqueIndex:idx_assign_uuid" json:"assignRecordsUUID"`
|
||||
SubNum string `gorm:"column:sub_num;comment:艺人编号;index:idx_assign_sub_num;index:idx_assign_sub_tel,priority:1" json:"subNum"`
|
||||
TelNum string `gorm:"column:tel_num;comment:艺人手机号;index:idx_assign_tel_num;index:idx_assign_sub_tel,priority:2" json:"telNum"`
|
||||
ArtistName string `gorm:"column:artist_name;comment:艺人名称;index:idx_assign_artist_name" json:"artistName"`
|
||||
Status int `gorm:"column:status;comment:反馈完成状态 1:未完成 2:完成;index:idx_status;index:idx_status_assignee,priority:1" json:"status"`
|
||||
ActualStatus int `gorm:"column:actual_status;comment:实际完成状态 1:未完成 2:完成;index:idx_actual_status;index:idx_actual_assignee,priority:1" json:"actualStatus"`
|
||||
CompleteTime *time.Time `gorm:"column:complete_time;comment:反馈完成时间;index:idx_complete_time" json:"completeTime"`
|
||||
OperatorType int `gorm:"column:operator_type;comment:操作类型 1:修改待发数量 2:指派;index:idx_operator_type;index:idx_operator_type_time,priority:1" json:"operatorType"`
|
||||
Operator string `gorm:"column:operator;comment:操作人;index:idx_operator" json:"operator"`
|
||||
OperatorNum string `gorm:"column:operator_num;comment:操作人账号;index:idx_operator_num" json:"operatorNum"`
|
||||
OperatorTime time.Time `gorm:"column:operator_time;comment:操作时间;index:idx_operator_time;index:idx_operator_type_time,priority:2" json:"operatorTime"`
|
||||
TaskAssignee string `gorm:"column:task_assignee;comment:任务指派人;index:idx_task_assignee;index:idx_status_assignee,priority:2;index:idx_actual_assignee,priority:2" json:"taskAssignee"`
|
||||
TaskAssigneeNum string `gorm:"column:task_assignee_num;comment:任务指派人账号;index:idx_task_assignee_num" json:"taskAssigneeNum"`
|
||||
PendingVideoCount int `gorm:"column:pending_video_count;comment:待发视频数量" json:"pendingVideoCount"`
|
||||
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
||||
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
||||
AssignVideoCount int `gorm:"column:assign_video_count;comment:指派待发视频数" json:"assignVideoCount"`
|
||||
AssignPostCount int `gorm:"column:assign_post_count;comment:指派待发图文数" json:"assignPostCount"`
|
||||
AssignDataCount int `gorm:"column:assign_data_count;comment:指派待发数据数" json:"assignDataCount"`
|
||||
CompleteVideoCount int `gorm:"column:complete_video_count;comment:已完成视频数" json:"completeVideoCount"`
|
||||
CompletePostCount int `gorm:"column:complete_post_count;comment:已完成图文数" json:"completePostCount"`
|
||||
CompleteDataCount int `gorm:"column:complete_data_count;comment:已完成数据数" json:"completeDataCount"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;comment:创建时间" json:"createdAt"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间;index:idx_updated_at" json:"updatedAt"`
|
||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_assign_deleted_at" json:"deletedAt"`
|
||||
}
|
||||
|
||||
func (t *TaskAssignRecords) TableName() string {
|
||||
return "task_assign_records"
|
||||
}
|
@ -52,13 +52,16 @@ type ValueAddServiceLang struct {
|
||||
PriceMode int32 `json:"priceMode" gorm:"column:price_mode;type:int;comment:套餐价格类型 1:单价 2:总价"`
|
||||
OriginalPrice float32 `json:"originalPrice" gorm:"column:original_price;type:decimal(12,2);comment:原单价"`
|
||||
TotalPrice float32 `json:"totalPrice" gorm:"column:total_price;type:decimal(12,2);comment:增值服务总价"` //总价模式不合理,该字段暂时无用
|
||||
Unit string `json:"unit" gorm:"column:unit;type:varchar(50);comment:单位 1:个 2:条 3:天 4:月 5:年"`
|
||||
Unit string `json:"unit" gorm:"column:unit;type:varchar(50);comment:单位 1:个 2:条 3:天 4:月 5:年 6:自然月 7:自然季度 8:半年 9:自然年"`
|
||||
Language string `json:"language" gorm:"column:language;type:varchar(32);comment:套餐语言 zh-CN zh-TW EN de-DE ja-JP(中繁英德日)"`
|
||||
PriceType int64 `json:"priceType" gorm:"column:price_type;type:int;comment:币种 1:人民币 2:美元 3:日元 4:欧元"`
|
||||
Options PriceOptions `gorm:"column:options;type:json" json:"options"`
|
||||
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
|
||||
UpdatedAt int64 `gorm:"column:updated_at;autoCreateTime"`
|
||||
DeletedAt soft_delete.DeletedAt
|
||||
QuotaType int32 `json:"quotaType" gorm:"column:quota_type;type:int;default:1;comment:额度类型 1:不限额度 2:每月限额度"`
|
||||
QuotaValue int32 `json:"quotaValue" gorm:"column:quota_value;type:int;comment:额度值"`
|
||||
IsExpired bool `json:"isExpired" gorm:"column:is_expired;default:false;comment:是否过期作废 false:不作废 true:作废"`
|
||||
}
|
||||
|
||||
type ValueAddServiceHistory struct {
|
||||
@ -79,6 +82,12 @@ type PriceOption struct {
|
||||
Symbol string `json:"symbol"` // 符号> < = >= <=
|
||||
Price float32 `json:"price"` // 价格(根据priceMode决定是单价还是总价)
|
||||
TotalPrice float32 `json:"totalPrice"` // 总价-新加
|
||||
IsDefault bool `json:"isDefault"` // 是否为默认
|
||||
}
|
||||
|
||||
type ValueUidWithBenefits struct {
|
||||
ValueUid string `json:"valueUid"` //增值服务UUID
|
||||
BenefitsType int32 `json:"benefitsType"` //权益类型
|
||||
}
|
||||
|
||||
// 实现 driver.Valuer 接口
|
||||
@ -188,3 +197,9 @@ func (options PriceOptions) CalculatePrice(priceMode, target int32) (float32, er
|
||||
|
||||
return 0, fmt.Errorf("未找到匹配规则")
|
||||
}
|
||||
|
||||
// 额度信息
|
||||
type QuotaInfo struct {
|
||||
QuotaType int32 // 1:不限额度 2:每月限额度
|
||||
QuotaValue int32 // 额度值
|
||||
}
|
||||
|
450
pb/bundle.proto
450
pb/bundle.proto
@ -60,11 +60,15 @@ service Bundle {
|
||||
rpc GetBundleBalanceByUserId(GetBundleBalanceByUserIdReq) returns (GetBundleBalanceByUserIdResp) {} // 余量信息
|
||||
rpc CreateBundleBalance(CreateBundleBalanceReq) returns (CreateBundleBalanceResp) {} // 创建新的余量信息
|
||||
rpc AddBundleBalance(AddBundleBalanceReq) returns (AddBundleBalanceResp) {} // 修改余量信息
|
||||
rpc BundleActivate(BundleActivateReq) returns (BundleActivateResp) {} // 用户套餐激活
|
||||
rpc BundleBalanceExport(BundleBalanceExportReq) returns (BundleBalanceExportResp) {} // 套餐余量导出
|
||||
rpc GetBundleBalanceLayout(GetBundleBalanceLayoutReq) returns (GetBundleBalanceLayoutResp) {} // 余量布局
|
||||
rpc SetBundleBalanceLayout(SetBundleBalanceLayoutReq) returns (SetBundleBalanceLayoutResp) {} // 余量布局
|
||||
|
||||
// 使用记录
|
||||
rpc GetUsedRecordList(GetUsedRecordListReq) returns (GetUsedRecordListResp) {} // 获取套餐使用记录列表
|
||||
rpc GetImageWorkDetail(GetImageWorkDetailReq) returns (GetImageWorkDetailResp) {} // 获取图文作品详情
|
||||
rpc GetVedioWorkDetail(GetVedioWorkDetailReq) returns (GetVedioeWorkDetailResp) {} // 获取视频作品详情
|
||||
rpc GetVedioWorkDetail(GetVedioWorkDetailReq) returns (GetVedioeWorkDetailResp) {} // 获取数据分析作品详情
|
||||
|
||||
rpc ToBeComfirmedWorks(ToBeComfirmedWorksReq) returns (ToBeComfirmedWorksResp) {} // 待确认作品列表
|
||||
rpc ConfirmWork(ConfirmWorkReq) returns (ConfirmWorkResp) {} // 确认作品
|
||||
@ -78,6 +82,17 @@ service Bundle {
|
||||
// 查出没处理的数据
|
||||
rpc ListUnfinishedInfos(AutoCreateUserAndOrderRequest) returns (UnfinishedInfos) {} // 查出没处理的数据
|
||||
rpc SoftDeleteUnfinishedInfo(SoftDeleteUnfinishedInfoRequest) returns (CommonResponse) {} // 软删除
|
||||
|
||||
// 任务台
|
||||
rpc GetPendingTaskList(TaskQueryRequest) returns (TaskQueryResponse) {} // 查询待指派任务记录
|
||||
rpc AssignTask(TaskAssignRequest) returns (CommonResponse) {} // 指派某位员工完成某个艺人的任务
|
||||
rpc UpdatePendingCount(UpdatePendingCountRequest) returns (CommonResponse) {} // 修改待发数量
|
||||
rpc GetRecentAssignRecords(RecentAssignRecordsRequest) returns (RecentAssignRecordsResponse) {} // 查询最近被指派记录
|
||||
rpc GetEmployeeAssignedTasks(EmployeeTaskQueryRequest) returns (EmployeeTaskQueryResponse) {} // 根据登录人信息查询被指派给该员工的任务
|
||||
rpc CompleteTaskManually(CompleteTaskManuallyRequest) returns (CommonResponse) {} // 员工手动点击完成任务
|
||||
rpc UpdateTaskProgress(UpdateTaskProgressRequest) returns (CommonResponse) {} // 员工实际完成任务状态更新
|
||||
rpc GetTaskAssignRecordsList(TaskAssignRecordsQueryRequest) returns (TaskAssignRecordsQueryResponse) {} // 多条件查询操作记录表
|
||||
rpc GetArtistBundleBalance(ArtistBundleBalanceRequest) returns (ArtistBundleBalanceResponse) {} // 查询艺人套餐剩余数量
|
||||
}
|
||||
message DeleteValueAddServiceRequest{
|
||||
string orderNo = 1;
|
||||
@ -172,6 +187,10 @@ message OrderCreateAddRecord{
|
||||
int32 source = 7 [json_name = "source"];
|
||||
int32 paymentStatus = 8 [json_name = "paymentStatus"];
|
||||
string handlingFee = 9 [json_name = "handlingFee"];
|
||||
int32 equityType = 10 [json_name = "equityType"];
|
||||
int32 quotaType = 11 [json_name = "quotaType"];
|
||||
int32 quotaValue = 12 [json_name = "quotaValue"];
|
||||
bool isExpired = 13 [json_name = "isExpired"];
|
||||
}
|
||||
message OrderRecordsRequestV2{
|
||||
string customerName = 1;
|
||||
@ -254,9 +273,10 @@ message BundleProfile {
|
||||
string bgImg2 = 15 [json_name = "bgImg2"];
|
||||
int64 shelfStatus = 16 [json_name = "shelfStatus"]; // 1 上架 2 下架
|
||||
repeated SelectValueAddService selectValueAddService = 17 [json_name = "SelectValueAddService"];
|
||||
repeated BundleProfileLang bundleProfileLang = 18 [json_name = "bundleProfileLang"];
|
||||
int32 imgOption = 19 [json_name = "imgOption"];
|
||||
string fontColor = 20 [json_name = "fontColor"];
|
||||
repeated SelectValueAdditionalService selectValueAdditionalService = 18 [json_name = "SelectValueAdditionalService"];
|
||||
repeated BundleProfileLang bundleProfileLang = 19 [json_name = "bundleProfileLang"];
|
||||
int32 imgOption = 20 [json_name = "imgOption"];
|
||||
string fontColor = 21 [json_name = "fontColor"];
|
||||
}
|
||||
message BundleProfileLang {
|
||||
string uuid = 1 [json_name = "uuid"];
|
||||
@ -276,20 +296,45 @@ message BundleProfileLang {
|
||||
string bgImg2 = 15 [json_name = "bgImg2"];
|
||||
int64 shelfStatus = 16 [json_name = "shelfStatus"]; // 1 上架 2 下架
|
||||
int32 imgOption = 17 [json_name = "imgOption"];
|
||||
repeated ServiceLangInfo serviceLangInfo = 18 [json_name = "serviceLangInfo"];//增值服务信息
|
||||
//repeated ValueAddServiceLang valueAddServiceLang = 12 [json_name = "ValueAddServiceLang"];
|
||||
}
|
||||
|
||||
message ServiceLangInfo {
|
||||
string valueAddUuid = 1 [json_name = "valueAddUuid"];//增值服务uuid
|
||||
int32 benefitsType = 2 [json_name = "benefitsType"];//权益类型 1:套餐权益 2:可选附加权益
|
||||
}
|
||||
|
||||
|
||||
message SaveResponse {
|
||||
string msg = 1 [json_name = "msg"];
|
||||
string uuid = 2 [json_name = "uuid"];
|
||||
int64 cancelNum = 3 [json_name = "cancelNum"];
|
||||
}
|
||||
// 套餐权益
|
||||
message SelectValueAddService {
|
||||
string valueAddUuid = 1 [json_name = "valueAddUuid"];
|
||||
string serviceName= 2 [json_name = "serviceName"];
|
||||
bool isDisplay = 3 [json_name = "isDisplay"];
|
||||
int32 serviceType = 4 [json_name = "serviceType"];
|
||||
string serviceName= 2 [json_name = "serviceName"];// 服务名称
|
||||
bool isDisplay = 3 [json_name = "isDisplay"];// 是否显示
|
||||
int32 serviceType = 4 [json_name = "serviceType"];// 服务类型
|
||||
int32 quotaType = 5 [json_name = "quotaType"];// 额度类型 1;不限额度 2:每月限额度
|
||||
int32 quotaValue = 6 [json_name = "quotaValue"];// 额度值
|
||||
bool isExpired = 7 [json_name = "isExpired"];// 是否过期作废
|
||||
int32 defaultServiceValue = 8 [json_name = "defaultServiceValue"];// 默认服务值
|
||||
|
||||
}
|
||||
// 套餐可选附加权益
|
||||
message SelectValueAdditionalService {
|
||||
string valueAddUuid = 1 [json_name = "valueAddUuid"];
|
||||
string serviceName= 2 [json_name = "serviceName"];// 服务名称
|
||||
bool isDisplay = 3 [json_name = "isDisplay"];// 是否显示
|
||||
int32 serviceType = 4 [json_name = "serviceType"];// 服务类型
|
||||
int32 quotaType = 5 [json_name = "quotaType"];// 额度类型 1;不限额度 2:每月限额度
|
||||
int32 quotaValue = 6 [json_name = "quotaValue"];// 额度值
|
||||
bool isExpired = 7 [json_name = "isExpired"];// 是否过期作废
|
||||
int32 defaultServiceValue = 8 [json_name = "defaultServiceValue"];// 默认服务值
|
||||
}
|
||||
|
||||
message DelBundleRequest {
|
||||
string uuid = 1 [json_name = "uuid"];
|
||||
}
|
||||
@ -501,21 +546,28 @@ message FinancialConfirmationRequest {
|
||||
message ValueAddService {
|
||||
string uuid = 1 [json_name = "uuid"];
|
||||
string serviceName = 2 [json_name = "serviceName"]; //服务名称
|
||||
int32 serviceType = 3 [json_name = "serviceType"];
|
||||
repeated ValueAddServiceLang serviceLang = 4 [json_name = "serviceLang"];
|
||||
int32 serviceType = 3 [json_name = "serviceType"]; //服务类型
|
||||
repeated ValueAddServiceLang serviceLang = 4 [json_name = "serviceLang"]; //不太语言的服务详细
|
||||
int32 quotaType = 5 [json_name = "quotaType"];//额度类型 1;不限额度 2:每月限额度
|
||||
int32 quotaValue = 6 [json_name = "quotaValue"];//额度值
|
||||
bool isExpired = 7 [json_name = "isExpired"];//是否过期作废
|
||||
int32 defaultServiceValue = 8 [json_name = "defaultServiceValue"];//默认服务值
|
||||
}
|
||||
message ValueAddServiceLang {
|
||||
string uuid = 1 [json_name = "uuid"];
|
||||
string serviceName = 2 [json_name = "serviceName"]; //服务名称
|
||||
int32 serviceType = 3 [json_name = "serviceType"];
|
||||
int32 priceMode = 4 [json_name = "priceMode"];
|
||||
string originalPrice = 5 [json_name = "originalPrice"];
|
||||
string unit = 6 [json_name = "unit"];
|
||||
int64 priceType = 7 [json_name = "priceType"];
|
||||
string language = 8 [json_name = "language"];
|
||||
int32 serviceType = 3 [json_name = "serviceType"]; //服务类型 1:数据分析 2:图文 3:数据报表 4:账号数 5:可用时长
|
||||
int32 priceMode = 4 [json_name = "priceMode"]; //套餐价格类型 1:单价 2:总价
|
||||
string originalPrice = 5 [json_name = "originalPrice"];//原单价
|
||||
string unit = 6 [json_name = "unit"];//单位 1:个 2:条 3:天 4:月 5:年 6:自然月 7:自然季度 8:半年 9:自然年
|
||||
int64 priceType = 7 [json_name = "priceType"];//币种 1:人民币 2:美元 3:日元 4:欧元
|
||||
string language = 8 [json_name = "language"];//套餐语言 zh-CN zh-TW EN de-DE ja-JP(中繁英德日)
|
||||
string createdAt = 9 [json_name = "createdAt"];
|
||||
string updatedAt = 10 [json_name = "updatedAt"];
|
||||
repeated ValueAddPriceOptions options = 12 [json_name = "options"];
|
||||
repeated ValueAddPriceOptions options = 11 [json_name = "options"];
|
||||
int32 quotaType = 12 [json_name = "quotaType"]; //额度类型 1;不限额度 2:每月限额度
|
||||
int32 quotaValue = 13 [json_name = "quotaValue"]; //额度值
|
||||
bool isExpired = 14 [json_name = "isExpired"]; //是否过期作废 false:不作废 true:作废
|
||||
}
|
||||
//增值服务价格选项
|
||||
message ValueAddPriceOptions {
|
||||
@ -525,14 +577,15 @@ message ValueAddPriceOptions {
|
||||
string price = 4 [json_name = "price"];
|
||||
string saveAmount = 5 [json_name = "saveAmount"];
|
||||
string totalPrice = 6 [json_name = "totalPrice"];
|
||||
|
||||
bool isDefault = 7 [json_name = "isDefault"]; // 是否为默认
|
||||
}
|
||||
//增值服务列表
|
||||
message ValueAddServiceListRequest {
|
||||
int32 page = 1 [json_name = "page"];
|
||||
int32 pageSize = 2 [json_name = "pageSize"];
|
||||
string name = 3 [json_name = "name"];
|
||||
string language = 4 [json_name = "language"];
|
||||
string name = 3 [json_name = "name"]; // 服务名称
|
||||
int32 serviceType = 4 [json_name = "serviceType"]; // 服务类型
|
||||
string language = 5 [json_name = "language"]; // 语言(历史遗留,暂未使用)
|
||||
}
|
||||
message ValueAddServiceListResponse {
|
||||
int32 total = 1 [json_name = "total"];
|
||||
@ -628,6 +681,7 @@ message GetBundleBalanceListReq{
|
||||
int64 expiredTimeEnd = 6;
|
||||
int32 page = 7;
|
||||
int32 pageSize = 8;
|
||||
string month = 9;
|
||||
}
|
||||
|
||||
message GetBundleBalanceReq{
|
||||
@ -640,25 +694,163 @@ message GetBundleBalanceReq{
|
||||
int32 pageSize = 7;
|
||||
}
|
||||
|
||||
message BundleBalanceItem{
|
||||
message BundleBalanceItem {
|
||||
// 基本信息
|
||||
int32 userId = 1;
|
||||
string userName = 2;
|
||||
string userPhoneNumber = 3;
|
||||
int32 status = 4;
|
||||
string bundleName = 5;
|
||||
int64 expiredTime = 6;
|
||||
int32 accountNumber = 7;
|
||||
int32 accountConsumptionNumber = 8;
|
||||
int32 videoNumber = 9;
|
||||
int32 videoConsumptionNumber = 10;
|
||||
int32 imageNumber = 11;
|
||||
int32 imageConsumptionNumber = 12;
|
||||
int32 dataAnalysisNumber = 13;
|
||||
int32 dataAnalysisConsumptionNumber = 14;
|
||||
int32 expansionPacksNumber = 15;
|
||||
int32 bought = 16;
|
||||
int32 activate = 2; // 是否激活
|
||||
string userName = 3; // 艺人
|
||||
string userPhoneNumber = 4; // 艺人手机号
|
||||
string customerNum = 5; // 用户编号
|
||||
int32 status = 6; // 套餐状态
|
||||
string bundleName = 7; // 最后购买的套餐
|
||||
string payTime = 8; // 下单时间
|
||||
int64 startTime = 9; // 开始有效时间
|
||||
int64 expiredTime = 10; // 过期时间
|
||||
string month = 11; // 所属月份
|
||||
int32 bought = 12; // 购买状态
|
||||
|
||||
// 套餐账号数
|
||||
int32 bundleAccountNumber = 13; // 当前可用套餐账号数
|
||||
int32 increaseAccountNumber = 14; // 当前可用增值账号数
|
||||
int32 bundleAccountConsumptionNumber = 15; // 当前已用套餐账号数
|
||||
int32 increaseAccountConsumptionNumber = 16; // 当前已用增值账号数
|
||||
|
||||
// 视频类统计
|
||||
int32 bundleVideoNumber = 17; // 当前可用套餐视频数
|
||||
int32 increaseVideoNumber = 18; // 当前可用增值视频数
|
||||
int32 bundleVideoConsumptionNumber = 19; // 当前已用套餐视频数
|
||||
int32 increaseVideoConsumptionNumber = 20; // 当前已用增值视频数
|
||||
int32 invalidBundleVideoNumber = 21; // 当前作废套餐视频数
|
||||
int32 invalidIncreaseVideoNumber = 22; // 当前作废增值视频数
|
||||
int32 monthlyNewBundleVideoNumber = 23; // 当月新增套餐视频数
|
||||
int32 monthlyNewIncreaseVideoNumber = 24; // 当月新增增值视频数
|
||||
int32 monthBundleVideoConsumptionNumber = 25; // 当月使用套餐视频数
|
||||
int32 monthIncreaseVideoConsumptionNumber = 26; // 当月使用增值视频数
|
||||
int32 monthlyInvalidBundleVideoNumber = 27; // 当月作废套餐视频数
|
||||
int32 monthlyInvalidIncreaseVideoNumber = 28; // 当月作废增值视频数
|
||||
|
||||
// 图文类统计
|
||||
int32 bundleImageNumber = 29; // 当前可用套餐图文数
|
||||
int32 increaseImageNumber = 30; // 当前可用增值图文数
|
||||
int32 bundleImageConsumptionNumber = 31; // 当前已用套餐图文数
|
||||
int32 increaseImageConsumptionNumber = 32; // 当前已用增值图文数
|
||||
int32 invalidBundleImageNumber = 33; // 当前作废套餐图文数
|
||||
int32 invalidIncreaseImageNumber = 34; // 当前作废增值图文数
|
||||
int32 monthlyNewBundleImageNumber = 35; // 当月新增套餐图文数
|
||||
int32 monthlyNewIncreaseImageNumber = 36; // 当月新增增值图文数
|
||||
int32 monthBundleImageConsumptionNumber = 37; // 当月使用套餐图文数
|
||||
int32 monthIncreaseImageConsumptionNumber = 38; // 当月使用增值图文数
|
||||
int32 monthlyInvalidBundleImageNumber = 39; // 当月作废套餐图文数
|
||||
int32 monthlyInvalidIncreaseImageNumber = 40; // 当月作废增值图文数
|
||||
|
||||
// 数据分析类统计
|
||||
int32 bundleDataAnalysisNumber = 41; // 当前可用套餐数据数
|
||||
int32 increaseDataAnalysisNumber = 42; // 当前可用增值数据数
|
||||
int32 bundleDataAnalysisConsumptionNumber = 43; // 当前已用套餐数据数
|
||||
int32 increaseDataAnalysisConsumptionNumber = 44; // 当前已用增值数据数
|
||||
int32 invalidBundleDataAnalysisNumber = 45; // 当前作废套餐数据数
|
||||
int32 invalidIncreaseDataAnalysisNumber = 46; // 当前作废增值数据数
|
||||
int32 monthlyNewBundleDataAnalysisNumber = 47; // 当月新增套餐数据数
|
||||
int32 monthlyNewIncreaseDataAnalysisNumber = 48; // 当月新增增值数据数
|
||||
int32 monthBundleDataAnalysisConsumptionNumber = 49; // 当月使用套餐数据数
|
||||
int32 monthIncreaseDataAnalysisConsumptionNumber = 50; // 当月使用增值数据数
|
||||
int32 monthlyInvalidBundleDataAnalysisNumber = 51; // 当月作废套餐数据数
|
||||
int32 monthlyInvalidIncreaseDataAnalysisNumber = 52; // 当月作废增值数据数
|
||||
|
||||
// 手动扩展数据
|
||||
int32 monthlyNewManualAccountNumber = 53; // 当月新增手动扩展账号数
|
||||
int32 monthlyNewManualVideoNumber = 54; // 当月新增手动扩展视频数
|
||||
int32 monthlyNewManualImageNumber = 55; // 当月新增手动扩展图文数
|
||||
int32 monthlyNewManualDataAnalysisNumber = 56; // 当月新增手动扩展数据数
|
||||
int32 monthlyNewDurationNumber = 57; // 当月新增手动扩展时长(日)
|
||||
int32 monthlyManualAccountConsumptionNumber = 58; // 当月已用手动扩展账号数
|
||||
int32 monthlyManualVideoConsumptionNumber = 59; // 当月已用手动扩展视频数
|
||||
int32 monthlyManualImageConsumptionNumber = 60; // 当月已用手动扩展图文数
|
||||
int32 monthlyManualDataAnalysisConsumptionNumber = 61; // 当月已用手动扩展数据数
|
||||
}
|
||||
|
||||
|
||||
message BundleBalanceExportItem {
|
||||
// 基本信息
|
||||
string month = 1; // 所属月份
|
||||
string customerNum = 2; // 用户编号
|
||||
string userName = 3; // 名字
|
||||
string userPhoneNumber = 4; // 手机号
|
||||
string payTime = 5; // 支付时间
|
||||
float bundleAmount = 6; // 套餐金额
|
||||
float increaseAmount = 7; // 增值服务金额
|
||||
float totalPayAmount = 8; // 支付金额
|
||||
string currency = 9; // 币种
|
||||
string fee = 10; // 手续费
|
||||
|
||||
float bundleVideoUnitPrice = 11; // 套餐视频单价
|
||||
float increaseVideoUnitPrice = 12; // 增值视频单价
|
||||
|
||||
// 账号类
|
||||
int32 bundleAccountNumber = 13; // 套餐账号总数
|
||||
int32 increaseAccountNumber = 14; // 增值账号总数
|
||||
int32 bundleAccountConsumptionNumber = 15; // 套餐账号使用数
|
||||
int32 increaseAccountConsumptionNumber = 16; // 增值账号使用数
|
||||
|
||||
// 视频类
|
||||
int32 bundleVideoNumber = 17; // 当前可用套餐视频数
|
||||
int32 increaseVideoNumber = 18; // 当前可用增值视频数
|
||||
int32 bundleVideoConsumptionNumber = 19; // 当前已用套餐视频数
|
||||
int32 increaseVideoConsumptionNumber = 20; // 当前已用增值视频数
|
||||
int32 invalidBundleVideoNumber = 21; // 当前作废套餐视频数
|
||||
int32 invalidIncreaseVideoNumber = 22; // 当前作废增值视频数
|
||||
int32 monthlyNewBundleVideoNumber = 23; // 当月新增套餐视频数
|
||||
int32 monthlyNewIncreaseVideoNumber = 24; // 当月新增增值视频数
|
||||
int32 monthlyInvalidBundleVideoNumber = 25; // 当月作废套餐视频数
|
||||
int32 monthlyInvalidIncreaseVideoNumber = 26; // 当月作废增值视频数
|
||||
|
||||
// 图文类
|
||||
int32 bundleImageNumber = 27; // 当前可用套餐图文数
|
||||
int32 increaseImageNumber = 28; // 当前可用增值图文数
|
||||
int32 bundleImageConsumptionNumber = 29; // 当前已用套餐图文数
|
||||
int32 increaseImageConsumptionNumber = 30; // 当前已用增值图文数
|
||||
int32 invalidBundleImageNumber = 31; // 当前作废套餐图文数
|
||||
int32 invalidIncreaseImageNumber = 32; // 当前作废增值图文数
|
||||
int32 monthlyNewBundleImageNumber = 33; // 当月新增套餐图文数
|
||||
int32 monthlyNewIncreaseImageNumber = 34; // 当月新增增值图文数
|
||||
int32 monthlyInvalidBundleImageNumber = 35; // 当月作废套餐图文数
|
||||
int32 monthlyInvalidIncreaseImageNumber = 36; // 当月作废增值图文数
|
||||
|
||||
// 数据分析类
|
||||
int32 bundleDataAnalysisNumber = 37; // 当前可用套餐数据分析数
|
||||
int32 increaseDataAnalysisNumber = 38; // 当前可用增值数据分析数
|
||||
int32 bundleDataAnalysisConsumptionNumber = 39; // 当前已用套餐数据分析数
|
||||
int32 increaseDataAnalysisConsumptionNumber = 40; // 当前已用增值数据分析数
|
||||
int32 invalidBundleDataAnalysisNumber = 41; // 当前作废套餐数据分析数
|
||||
int32 invalidIncreaseDataAnalysisNumber = 42; // 当前作废增值数据分析数
|
||||
int32 monthlyNewBundleDataAnalysisNumber = 43; // 当月新增套餐数据分析数
|
||||
int32 monthlyNewIncreaseDataAnalysisNumber = 44; // 当月新增增值数据分析数
|
||||
int32 monthlyInvalidBundleDataAnalysisNumber = 45; // 当月作废套餐数据分析数
|
||||
int32 monthlyInvalidIncreaseDataAnalysisNumber = 46; // 当月作废增值数据分析数
|
||||
|
||||
// 手动扩展类
|
||||
int32 monthlyNewManualAccountNumber = 47; // 当月手动扩展账号新增数
|
||||
int32 monthlyNewManualVideoNumber = 48; // 当月手动扩展视频新增数
|
||||
int32 monthlyNewManualImageNumber = 49; // 当月手动扩展图文新增数
|
||||
int32 monthlyNewManualDataAnalysisNumber = 50; // 当月手动扩展数据分析新增数
|
||||
int32 monthlyNewDurationNumber = 51; // 当月新增手动扩展时长(天)
|
||||
int32 monthlyManualAccountConsumptionNumber = 52; // 当月手动扩展账号使用数
|
||||
int32 monthlyManualVideoConsumptionNumber = 53; // 当月手动扩展视频使用数
|
||||
int32 monthlyManualImageConsumptionNumber = 54; // 当月手动扩展图文使用数
|
||||
int32 monthlyManualDataAnalysisConsumptionNumber = 55; // 当月手动扩展数据分析使用数
|
||||
}
|
||||
|
||||
|
||||
message BundleBalanceExportReq{
|
||||
string month = 1;
|
||||
}
|
||||
|
||||
message BundleBalanceExportResp{
|
||||
int64 total = 1;
|
||||
repeated BundleBalanceExportItem data =2;
|
||||
}
|
||||
|
||||
|
||||
message GetBundleBalanceListResp{
|
||||
int64 total = 1;
|
||||
repeated BundleBalanceItem data = 2;
|
||||
@ -698,7 +890,7 @@ message AddBundleBalanceReq{
|
||||
}
|
||||
|
||||
message AddBundleBalanceResp{
|
||||
|
||||
uint32 usedType = 1; // 0 套餐内 1 增值 2 手动
|
||||
}
|
||||
|
||||
message GetUsedRecordListReq{
|
||||
@ -725,7 +917,7 @@ message WorkCastItem{
|
||||
string artistName = 2; // 艺人名称
|
||||
string artistPhone = 3; // 艺人手机号
|
||||
string workUuid = 4; // 作品uuid
|
||||
uint32 workCategory = 5; // 1 图文 2 视频
|
||||
uint32 workCategory = 5; // 1 图文 2 数据分析
|
||||
string bundleUuid = 6; // 套餐ID uuid
|
||||
string bundleName = 7; // 套餐名称
|
||||
string platformIds = 8; // 发布平台ID集合 (json 格式字符串)
|
||||
@ -880,3 +1072,187 @@ message UnfinishedInfo {
|
||||
message SoftDeleteUnfinishedInfoRequest {
|
||||
uint32 ID = 1;
|
||||
}
|
||||
|
||||
|
||||
message BundleActivateReq{
|
||||
repeated uint32 ids = 1; // 激活用户的id
|
||||
}
|
||||
|
||||
message BundleActivateResp{
|
||||
|
||||
}
|
||||
|
||||
// 任务管理台相关消息定义
|
||||
|
||||
// 查询待指派任务记录
|
||||
message TaskQueryRequest {
|
||||
string keyword = 1 [json_name = "keyword"]; // 艺人姓名、编号、手机号搜索关键词
|
||||
int32 page = 2 [json_name = "page"]; // 页码
|
||||
int32 pageSize = 3 [json_name = "pageSize"]; // 每页数量
|
||||
string sortBy = 4 [json_name = "sortBy"]; // 排序字段
|
||||
string sortType = 5 [json_name = "sortType"]; // 排序类型 asc/desc
|
||||
}
|
||||
|
||||
message TaskQueryResponse {
|
||||
repeated TaskManagementInfo tasks = 1 [json_name = "tasks"];
|
||||
int64 total = 2 [json_name = "total"];
|
||||
int32 page = 3 [json_name = "page"];
|
||||
int32 pageSize = 4 [json_name = "pageSize"];
|
||||
}
|
||||
|
||||
message TaskManagementInfo {
|
||||
string subNum = 1 [json_name = "subNum"]; // 艺人编号
|
||||
string telNum = 2 [json_name = "telNum"]; // 手机号
|
||||
string artistName = 3 [json_name = "artistName"]; // 艺人姓名
|
||||
int32 pendingVideoCount = 4 [json_name = "pendingVideoCount"]; // 待发数据分析数量
|
||||
int32 pendingPostCount = 5 [json_name = "pendingPostCount"]; // 待发图文数量
|
||||
int32 pendingDataCount = 6 [json_name = "pendingDataCount"]; // 待发数据数量
|
||||
int32 progressTaskCount = 7 [json_name = "progressTaskCount"]; // 进行中任务数量
|
||||
int32 completeTaskCount = 8 [json_name = "completeTaskCount"]; // 已完成任务数量
|
||||
string lastTaskAssignee = 9 [json_name = "lastTaskAssignee"]; // 最后一次任务指派人
|
||||
string taskAssigneeNum = 10 [json_name = "taskAssigneeNum"]; // 任务指派人账号
|
||||
}
|
||||
|
||||
// 指派任务
|
||||
message TaskAssignRequest {
|
||||
string subNum = 1 [json_name = "subNum"]; // 艺人编号
|
||||
string telNum = 2 [json_name = "telNum"]; // 艺人手机号
|
||||
string artistName = 3 [json_name = "artistName"]; // 艺人姓名
|
||||
string taskAssignee = 4 [json_name = "taskAssignee"]; // 任务指派人
|
||||
string taskAssigneeNum = 5 [json_name = "taskAssigneeNum"]; // 任务指派人账号
|
||||
string operator = 6 [json_name = "operator"]; // 操作人
|
||||
string operatorNum = 7 [json_name = "operatorNum"]; // 操作人账号
|
||||
int32 assignVideoCount = 8 [json_name = "assignVideoCount"]; // 指派数据分析数
|
||||
int32 assignPostCount = 9 [json_name = "assignPostCount"]; // 指派图文数
|
||||
int32 assignDataCount = 10 [json_name = "assignDataCount"]; // 指派数据数
|
||||
}
|
||||
|
||||
// 修改待发数量
|
||||
message UpdatePendingCountRequest {
|
||||
string subNum = 1 [json_name = "subNum"]; // 艺人编号
|
||||
string telNum = 2 [json_name = "telNum"]; // 艺人手机号
|
||||
string artistName = 3 [json_name = "artistName"]; // 艺人姓名
|
||||
int32 pendingVideoCount = 4 [json_name = "pendingVideoCount"]; // 待发数据分析数量
|
||||
int32 pendingPostCount = 5 [json_name = "pendingPostCount"]; // 待发图文数量
|
||||
int32 pendingDataCount = 6 [json_name = "pendingDataCount"]; // 待发数据数量
|
||||
string operator = 7 [json_name = "operator"]; // 操作人
|
||||
string operatorNum = 8 [json_name = "operatorNum"]; // 操作人账号
|
||||
}
|
||||
|
||||
// 查询最近被指派记录
|
||||
message RecentAssignRecordsRequest {
|
||||
int32 limit = 1 [json_name = "limit"]; // 查询数量限制
|
||||
}
|
||||
|
||||
message RecentAssignRecordsResponse {
|
||||
repeated string operatorList = 1 [json_name = "operatorList"];
|
||||
}
|
||||
|
||||
// 员工任务查询
|
||||
message EmployeeTaskQueryRequest {
|
||||
string taskAssigneeNum = 1 [json_name = "taskAssigneeNum"]; // 被指派人账号
|
||||
string keyword = 2 [json_name = "keyword"]; // 艺人姓名、编号、手机号搜索关键词
|
||||
string operator = 3 [json_name = "operator"]; // 操作人
|
||||
string sortBy = 4 [json_name = "sortBy"]; // 排序字段
|
||||
string startTime = 5 [json_name = "startTime"]; // 指派开始时间
|
||||
string endTime = 6 [json_name = "endTime"]; // 指派结束时间
|
||||
string startCompleteTime = 7 [json_name = "startCompleteTime"]; // 开始完成时间
|
||||
string endCompleteTime = 8 [json_name = "endCompleteTime"]; // 结束完成时间
|
||||
int32 status = 9 [json_name = "status"]; // 反馈完成状态
|
||||
int32 page = 10 [json_name = "page"]; // 页码
|
||||
int32 pageSize = 11 [json_name = "pageSize"]; // 每页数量
|
||||
}
|
||||
|
||||
message EmployeeTaskQueryResponse {
|
||||
repeated TaskAssignRecordInfo records = 1 [json_name = "records"];
|
||||
int64 total = 2 [json_name = "total"];
|
||||
int32 page = 3 [json_name = "page"];
|
||||
int32 pageSize = 4 [json_name = "pageSize"];
|
||||
}
|
||||
|
||||
// 任务指派记录信息
|
||||
message TaskAssignRecordInfo {
|
||||
string assignRecordsUUID = 1 [json_name = "assignRecordsUUID"]; // 指派记录UUID
|
||||
string subNum = 2 [json_name = "subNum"]; // 艺人编号
|
||||
string telNum = 3 [json_name = "telNum"]; // 艺人手机号
|
||||
string artistName = 4 [json_name = "artistName"]; // 艺人姓名
|
||||
int32 status = 5 [json_name = "status"]; // 反馈完成状态
|
||||
int32 actualStatus = 6 [json_name = "actualStatus"]; // 实际完成状态
|
||||
string completeTime = 7 [json_name = "completeTime"]; // 反馈完成时间
|
||||
int32 operatorType = 8 [json_name = "operatorType"]; // 操作类型
|
||||
string operator = 9 [json_name = "operator"]; // 操作人
|
||||
string operatorNum = 10 [json_name = "operatorNum"]; // 操作人账号
|
||||
string operatorTime = 11 [json_name = "operatorTime"]; // 操作时间
|
||||
string taskAssignee = 12 [json_name = "taskAssignee"]; // 任务指派人
|
||||
string taskAssigneeNum = 13 [json_name = "taskAssigneeNum"]; // 任务指派人账号
|
||||
int32 pendingVideoCount = 14 [json_name = "pendingVideoCount"]; // 待发数据分析数量
|
||||
int32 pendingPostCount = 15 [json_name = "pendingPostCount"]; // 待发图文数量
|
||||
int32 pendingDataCount = 16 [json_name = "pendingDataCount"]; // 待发数据数量
|
||||
string updatedAt = 24 [json_name = "updatedAt"]; // 更新时间
|
||||
}
|
||||
|
||||
// 手动完成任务
|
||||
message CompleteTaskManuallyRequest {
|
||||
string assignRecordsUUID = 1 [json_name = "assignRecordsUUID"]; // 指派记录UUID
|
||||
string taskAssigneeNum = 2 [json_name = "taskAssigneeNum"]; // 被指派完成该任务人的账号
|
||||
}
|
||||
|
||||
// 更新任务进度
|
||||
message UpdateTaskProgressRequest {
|
||||
string assignRecordsUUID = 1 [json_name = "assignRecordsUUID"]; // 指派记录UUID(可选)
|
||||
string employeeName = 2 [json_name = "employeeName"]; // 员工姓名(必要)
|
||||
string employeeNum = 3 [json_name = "employeeNum"]; // 员工工号(必要)
|
||||
string taskType = 4 [json_name = "taskType"]; // 任务类型: video/post/data
|
||||
int32 completeCount = 5 [json_name = "completeCount"]; // 完成数量
|
||||
}
|
||||
|
||||
// 多条件查询操作记录表
|
||||
message TaskAssignRecordsQueryRequest {
|
||||
string keyword = 1 [json_name = "keyword"]; // 艺人姓名、编号、手机号搜索关键词
|
||||
string taskAssignee = 2 [json_name = "taskAssignee"]; // 指派人姓名
|
||||
string operator = 3 [json_name = "operator"]; // 操作人姓名
|
||||
string operatorNum = 4 [json_name = "operatorNum"]; // 操作人手机号
|
||||
string startTime = 5 [json_name = "startTime"]; // 操作开始时间
|
||||
string endTime = 6 [json_name = "endTime"]; // 操作结束时间
|
||||
int32 status = 7 [json_name = "status"]; // 反馈完成状态
|
||||
int32 actualStatus = 8 [json_name = "actualStatus"]; // 实际完成状态
|
||||
int32 page = 9 [json_name = "page"]; // 页码
|
||||
int32 pageSize = 10 [json_name = "pageSize"]; // 每页数量
|
||||
}
|
||||
|
||||
message TaskAssignRecordsQueryResponse {
|
||||
repeated TaskAssignRecordInfo records = 1 [json_name = "records"];
|
||||
int64 total = 2 [json_name = "total"];
|
||||
int32 page = 3 [json_name = "page"];
|
||||
int32 pageSize = 4 [json_name = "pageSize"];
|
||||
}
|
||||
|
||||
// 查询艺人套餐剩余数量请求
|
||||
message ArtistBundleBalanceRequest {
|
||||
string customerNum = 1 [json_name = "customerNum"]; // 艺人编号(推荐使用)
|
||||
string telNum = 2 [json_name = "telNum"]; // 艺人手机号(备选)
|
||||
}
|
||||
|
||||
// 艺人套餐剩余数量响应
|
||||
message ArtistBundleBalanceResponse {
|
||||
int32 remainingVideoCount = 1 [json_name = "remainingVideoCount"]; // 剩余数据分析数量
|
||||
int32 remainingImageCount = 2 [json_name = "remainingImageCount"]; // 剩余图片数量
|
||||
int32 remainingDataAnalysisCount = 3 [json_name = "remainingDataAnalysisCount"]; // 剩余数据分析数量
|
||||
}
|
||||
|
||||
message SetBundleBalanceLayoutReq{
|
||||
uint32 userId = 1;
|
||||
string data = 2;
|
||||
}
|
||||
|
||||
message SetBundleBalanceLayoutResp{
|
||||
|
||||
}
|
||||
|
||||
message GetBundleBalanceLayoutReq{
|
||||
uint32 userId = 1;
|
||||
}
|
||||
|
||||
message GetBundleBalanceLayoutResp{
|
||||
string data = 1;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -95,6 +95,13 @@ func (this *BundleProfile) Validate() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.SelectValueAdditionalService {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("SelectValueAdditionalService", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.BundleProfileLang {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
@ -105,6 +112,16 @@ func (this *BundleProfile) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleProfileLang) Validate() error {
|
||||
for _, item := range this.ServiceLangInfo {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ServiceLangInfo", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ServiceLangInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SaveResponse) Validate() error {
|
||||
@ -113,6 +130,9 @@ func (this *SaveResponse) Validate() error {
|
||||
func (this *SelectValueAddService) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SelectValueAdditionalService) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *DelBundleRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
@ -350,6 +370,22 @@ func (this *GetBundleBalanceReq) Validate() error {
|
||||
func (this *BundleBalanceItem) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleBalanceExportItem) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleBalanceExportReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleBalanceExportResp) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GetBundleBalanceListResp) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
@ -466,3 +502,90 @@ func (this *UnfinishedInfo) Validate() error {
|
||||
func (this *SoftDeleteUnfinishedInfoRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleActivateReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *BundleActivateResp) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TaskQueryRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TaskQueryResponse) Validate() error {
|
||||
for _, item := range this.Tasks {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Tasks", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *TaskManagementInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TaskAssignRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdatePendingCountRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RecentAssignRecordsRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RecentAssignRecordsResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *EmployeeTaskQueryRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *EmployeeTaskQueryResponse) Validate() error {
|
||||
for _, item := range this.Records {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Records", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *TaskAssignRecordInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CompleteTaskManuallyRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateTaskProgressRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TaskAssignRecordsQueryRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TaskAssignRecordsQueryResponse) Validate() error {
|
||||
for _, item := range this.Records {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Records", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ArtistBundleBalanceRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ArtistBundleBalanceResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SetBundleBalanceLayoutReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SetBundleBalanceLayoutResp) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetBundleBalanceLayoutReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetBundleBalanceLayoutResp) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
@ -69,6 +69,10 @@ type BundleClient interface {
|
||||
GetBundleBalanceByUserId(ctx context.Context, in *GetBundleBalanceByUserIdReq, opts ...grpc_go.CallOption) (*GetBundleBalanceByUserIdResp, common.ErrorWithAttachment)
|
||||
CreateBundleBalance(ctx context.Context, in *CreateBundleBalanceReq, opts ...grpc_go.CallOption) (*CreateBundleBalanceResp, common.ErrorWithAttachment)
|
||||
AddBundleBalance(ctx context.Context, in *AddBundleBalanceReq, opts ...grpc_go.CallOption) (*AddBundleBalanceResp, common.ErrorWithAttachment)
|
||||
BundleActivate(ctx context.Context, in *BundleActivateReq, opts ...grpc_go.CallOption) (*BundleActivateResp, common.ErrorWithAttachment)
|
||||
BundleBalanceExport(ctx context.Context, in *BundleBalanceExportReq, opts ...grpc_go.CallOption) (*BundleBalanceExportResp, common.ErrorWithAttachment)
|
||||
GetBundleBalanceLayout(ctx context.Context, in *GetBundleBalanceLayoutReq, opts ...grpc_go.CallOption) (*GetBundleBalanceLayoutResp, common.ErrorWithAttachment)
|
||||
SetBundleBalanceLayout(ctx context.Context, in *SetBundleBalanceLayoutReq, opts ...grpc_go.CallOption) (*SetBundleBalanceLayoutResp, common.ErrorWithAttachment)
|
||||
// 使用记录
|
||||
GetUsedRecordList(ctx context.Context, in *GetUsedRecordListReq, opts ...grpc_go.CallOption) (*GetUsedRecordListResp, common.ErrorWithAttachment)
|
||||
GetImageWorkDetail(ctx context.Context, in *GetImageWorkDetailReq, opts ...grpc_go.CallOption) (*GetImageWorkDetailResp, common.ErrorWithAttachment)
|
||||
@ -83,6 +87,16 @@ type BundleClient interface {
|
||||
// 查出没处理的数据
|
||||
ListUnfinishedInfos(ctx context.Context, in *AutoCreateUserAndOrderRequest, opts ...grpc_go.CallOption) (*UnfinishedInfos, common.ErrorWithAttachment)
|
||||
SoftDeleteUnfinishedInfo(ctx context.Context, in *SoftDeleteUnfinishedInfoRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
// 任务台
|
||||
GetPendingTaskList(ctx context.Context, in *TaskQueryRequest, opts ...grpc_go.CallOption) (*TaskQueryResponse, common.ErrorWithAttachment)
|
||||
AssignTask(ctx context.Context, in *TaskAssignRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
UpdatePendingCount(ctx context.Context, in *UpdatePendingCountRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
GetRecentAssignRecords(ctx context.Context, in *RecentAssignRecordsRequest, opts ...grpc_go.CallOption) (*RecentAssignRecordsResponse, common.ErrorWithAttachment)
|
||||
GetEmployeeAssignedTasks(ctx context.Context, in *EmployeeTaskQueryRequest, opts ...grpc_go.CallOption) (*EmployeeTaskQueryResponse, common.ErrorWithAttachment)
|
||||
CompleteTaskManually(ctx context.Context, in *CompleteTaskManuallyRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
UpdateTaskProgress(ctx context.Context, in *UpdateTaskProgressRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
GetTaskAssignRecordsList(ctx context.Context, in *TaskAssignRecordsQueryRequest, opts ...grpc_go.CallOption) (*TaskAssignRecordsQueryResponse, common.ErrorWithAttachment)
|
||||
GetArtistBundleBalance(ctx context.Context, in *ArtistBundleBalanceRequest, opts ...grpc_go.CallOption) (*ArtistBundleBalanceResponse, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type bundleClient struct {
|
||||
@ -128,6 +142,10 @@ type BundleClientImpl struct {
|
||||
GetBundleBalanceByUserId func(ctx context.Context, in *GetBundleBalanceByUserIdReq) (*GetBundleBalanceByUserIdResp, error)
|
||||
CreateBundleBalance func(ctx context.Context, in *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
|
||||
AddBundleBalance func(ctx context.Context, in *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
|
||||
BundleActivate func(ctx context.Context, in *BundleActivateReq) (*BundleActivateResp, error)
|
||||
BundleBalanceExport func(ctx context.Context, in *BundleBalanceExportReq) (*BundleBalanceExportResp, error)
|
||||
GetBundleBalanceLayout func(ctx context.Context, in *GetBundleBalanceLayoutReq) (*GetBundleBalanceLayoutResp, error)
|
||||
SetBundleBalanceLayout func(ctx context.Context, in *SetBundleBalanceLayoutReq) (*SetBundleBalanceLayoutResp, error)
|
||||
GetUsedRecordList func(ctx context.Context, in *GetUsedRecordListReq) (*GetUsedRecordListResp, error)
|
||||
GetImageWorkDetail func(ctx context.Context, in *GetImageWorkDetailReq) (*GetImageWorkDetailResp, error)
|
||||
GetVedioWorkDetail func(ctx context.Context, in *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
|
||||
@ -139,6 +157,15 @@ type BundleClientImpl struct {
|
||||
UpdateReconciliationStatusBySerialNumber func(ctx context.Context, in *UpdateStatusAndPayTimeBySerialNumber) (*CommonResponse, error)
|
||||
ListUnfinishedInfos func(ctx context.Context, in *AutoCreateUserAndOrderRequest) (*UnfinishedInfos, error)
|
||||
SoftDeleteUnfinishedInfo func(ctx context.Context, in *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error)
|
||||
GetPendingTaskList func(ctx context.Context, in *TaskQueryRequest) (*TaskQueryResponse, error)
|
||||
AssignTask func(ctx context.Context, in *TaskAssignRequest) (*CommonResponse, error)
|
||||
UpdatePendingCount func(ctx context.Context, in *UpdatePendingCountRequest) (*CommonResponse, error)
|
||||
GetRecentAssignRecords func(ctx context.Context, in *RecentAssignRecordsRequest) (*RecentAssignRecordsResponse, error)
|
||||
GetEmployeeAssignedTasks func(ctx context.Context, in *EmployeeTaskQueryRequest) (*EmployeeTaskQueryResponse, error)
|
||||
CompleteTaskManually func(ctx context.Context, in *CompleteTaskManuallyRequest) (*CommonResponse, error)
|
||||
UpdateTaskProgress func(ctx context.Context, in *UpdateTaskProgressRequest) (*CommonResponse, error)
|
||||
GetTaskAssignRecordsList func(ctx context.Context, in *TaskAssignRecordsQueryRequest) (*TaskAssignRecordsQueryResponse, error)
|
||||
GetArtistBundleBalance func(ctx context.Context, in *ArtistBundleBalanceRequest) (*ArtistBundleBalanceResponse, error)
|
||||
}
|
||||
|
||||
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
||||
@ -381,6 +408,30 @@ func (c *bundleClient) AddBundleBalance(ctx context.Context, in *AddBundleBalanc
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/AddBundleBalance", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) BundleActivate(ctx context.Context, in *BundleActivateReq, opts ...grpc_go.CallOption) (*BundleActivateResp, common.ErrorWithAttachment) {
|
||||
out := new(BundleActivateResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleActivate", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) BundleBalanceExport(ctx context.Context, in *BundleBalanceExportReq, opts ...grpc_go.CallOption) (*BundleBalanceExportResp, common.ErrorWithAttachment) {
|
||||
out := new(BundleBalanceExportResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/BundleBalanceExport", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetBundleBalanceLayout(ctx context.Context, in *GetBundleBalanceLayoutReq, opts ...grpc_go.CallOption) (*GetBundleBalanceLayoutResp, common.ErrorWithAttachment) {
|
||||
out := new(GetBundleBalanceLayoutResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetBundleBalanceLayout", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) SetBundleBalanceLayout(ctx context.Context, in *SetBundleBalanceLayoutReq, opts ...grpc_go.CallOption) (*SetBundleBalanceLayoutResp, common.ErrorWithAttachment) {
|
||||
out := new(SetBundleBalanceLayoutResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SetBundleBalanceLayout", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetUsedRecordList(ctx context.Context, in *GetUsedRecordListReq, opts ...grpc_go.CallOption) (*GetUsedRecordListResp, common.ErrorWithAttachment) {
|
||||
out := new(GetUsedRecordListResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -447,6 +498,60 @@ func (c *bundleClient) SoftDeleteUnfinishedInfo(ctx context.Context, in *SoftDel
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SoftDeleteUnfinishedInfo", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetPendingTaskList(ctx context.Context, in *TaskQueryRequest, opts ...grpc_go.CallOption) (*TaskQueryResponse, common.ErrorWithAttachment) {
|
||||
out := new(TaskQueryResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetPendingTaskList", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) AssignTask(ctx context.Context, in *TaskAssignRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/AssignTask", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) UpdatePendingCount(ctx context.Context, in *UpdatePendingCountRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdatePendingCount", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetRecentAssignRecords(ctx context.Context, in *RecentAssignRecordsRequest, opts ...grpc_go.CallOption) (*RecentAssignRecordsResponse, common.ErrorWithAttachment) {
|
||||
out := new(RecentAssignRecordsResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetRecentAssignRecords", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetEmployeeAssignedTasks(ctx context.Context, in *EmployeeTaskQueryRequest, opts ...grpc_go.CallOption) (*EmployeeTaskQueryResponse, common.ErrorWithAttachment) {
|
||||
out := new(EmployeeTaskQueryResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetEmployeeAssignedTasks", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) CompleteTaskManually(ctx context.Context, in *CompleteTaskManuallyRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CompleteTaskManually", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) UpdateTaskProgress(ctx context.Context, in *UpdateTaskProgressRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateTaskProgress", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetTaskAssignRecordsList(ctx context.Context, in *TaskAssignRecordsQueryRequest, opts ...grpc_go.CallOption) (*TaskAssignRecordsQueryResponse, common.ErrorWithAttachment) {
|
||||
out := new(TaskAssignRecordsQueryResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetTaskAssignRecordsList", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetArtistBundleBalance(ctx context.Context, in *ArtistBundleBalanceRequest, opts ...grpc_go.CallOption) (*ArtistBundleBalanceResponse, common.ErrorWithAttachment) {
|
||||
out := new(ArtistBundleBalanceResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetArtistBundleBalance", in, out)
|
||||
}
|
||||
|
||||
// BundleServer is the server API for Bundle service.
|
||||
// All implementations must embed UnimplementedBundleServer
|
||||
// for forward compatibility
|
||||
@ -492,6 +597,10 @@ type BundleServer interface {
|
||||
GetBundleBalanceByUserId(context.Context, *GetBundleBalanceByUserIdReq) (*GetBundleBalanceByUserIdResp, error)
|
||||
CreateBundleBalance(context.Context, *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
|
||||
AddBundleBalance(context.Context, *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
|
||||
BundleActivate(context.Context, *BundleActivateReq) (*BundleActivateResp, error)
|
||||
BundleBalanceExport(context.Context, *BundleBalanceExportReq) (*BundleBalanceExportResp, error)
|
||||
GetBundleBalanceLayout(context.Context, *GetBundleBalanceLayoutReq) (*GetBundleBalanceLayoutResp, error)
|
||||
SetBundleBalanceLayout(context.Context, *SetBundleBalanceLayoutReq) (*SetBundleBalanceLayoutResp, error)
|
||||
// 使用记录
|
||||
GetUsedRecordList(context.Context, *GetUsedRecordListReq) (*GetUsedRecordListResp, error)
|
||||
GetImageWorkDetail(context.Context, *GetImageWorkDetailReq) (*GetImageWorkDetailResp, error)
|
||||
@ -506,6 +615,16 @@ type BundleServer interface {
|
||||
// 查出没处理的数据
|
||||
ListUnfinishedInfos(context.Context, *AutoCreateUserAndOrderRequest) (*UnfinishedInfos, error)
|
||||
SoftDeleteUnfinishedInfo(context.Context, *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error)
|
||||
// 任务台
|
||||
GetPendingTaskList(context.Context, *TaskQueryRequest) (*TaskQueryResponse, error)
|
||||
AssignTask(context.Context, *TaskAssignRequest) (*CommonResponse, error)
|
||||
UpdatePendingCount(context.Context, *UpdatePendingCountRequest) (*CommonResponse, error)
|
||||
GetRecentAssignRecords(context.Context, *RecentAssignRecordsRequest) (*RecentAssignRecordsResponse, error)
|
||||
GetEmployeeAssignedTasks(context.Context, *EmployeeTaskQueryRequest) (*EmployeeTaskQueryResponse, error)
|
||||
CompleteTaskManually(context.Context, *CompleteTaskManuallyRequest) (*CommonResponse, error)
|
||||
UpdateTaskProgress(context.Context, *UpdateTaskProgressRequest) (*CommonResponse, error)
|
||||
GetTaskAssignRecordsList(context.Context, *TaskAssignRecordsQueryRequest) (*TaskAssignRecordsQueryResponse, error)
|
||||
GetArtistBundleBalance(context.Context, *ArtistBundleBalanceRequest) (*ArtistBundleBalanceResponse, error)
|
||||
mustEmbedUnimplementedBundleServer()
|
||||
}
|
||||
|
||||
@ -628,6 +747,18 @@ func (UnimplementedBundleServer) CreateBundleBalance(context.Context, *CreateBun
|
||||
func (UnimplementedBundleServer) AddBundleBalance(context.Context, *AddBundleBalanceReq) (*AddBundleBalanceResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AddBundleBalance not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) BundleActivate(context.Context, *BundleActivateReq) (*BundleActivateResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleActivate not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) BundleBalanceExport(context.Context, *BundleBalanceExportReq) (*BundleBalanceExportResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BundleBalanceExport not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetBundleBalanceLayout(context.Context, *GetBundleBalanceLayoutReq) (*GetBundleBalanceLayoutResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetBundleBalanceLayout not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) SetBundleBalanceLayout(context.Context, *SetBundleBalanceLayoutReq) (*SetBundleBalanceLayoutResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetBundleBalanceLayout not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetUsedRecordList(context.Context, *GetUsedRecordListReq) (*GetUsedRecordListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUsedRecordList not implemented")
|
||||
}
|
||||
@ -661,6 +792,33 @@ func (UnimplementedBundleServer) ListUnfinishedInfos(context.Context, *AutoCreat
|
||||
func (UnimplementedBundleServer) SoftDeleteUnfinishedInfo(context.Context, *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SoftDeleteUnfinishedInfo not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetPendingTaskList(context.Context, *TaskQueryRequest) (*TaskQueryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPendingTaskList not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) AssignTask(context.Context, *TaskAssignRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AssignTask not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) UpdatePendingCount(context.Context, *UpdatePendingCountRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdatePendingCount not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetRecentAssignRecords(context.Context, *RecentAssignRecordsRequest) (*RecentAssignRecordsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRecentAssignRecords not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetEmployeeAssignedTasks(context.Context, *EmployeeTaskQueryRequest) (*EmployeeTaskQueryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetEmployeeAssignedTasks not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) CompleteTaskManually(context.Context, *CompleteTaskManuallyRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CompleteTaskManually not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) UpdateTaskProgress(context.Context, *UpdateTaskProgressRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateTaskProgress not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetTaskAssignRecordsList(context.Context, *TaskAssignRecordsQueryRequest) (*TaskAssignRecordsQueryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetTaskAssignRecordsList not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetArtistBundleBalance(context.Context, *ArtistBundleBalanceRequest) (*ArtistBundleBalanceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetArtistBundleBalance not implemented")
|
||||
}
|
||||
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
@ -1791,6 +1949,122 @@ func _Bundle_AddBundleBalance_Handler(srv interface{}, ctx context.Context, dec
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_BundleActivate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BundleActivateReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("BundleActivate", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_BundleBalanceExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BundleBalanceExportReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("BundleBalanceExport", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetBundleBalanceLayout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetBundleBalanceLayoutReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetBundleBalanceLayout", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_SetBundleBalanceLayout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetBundleBalanceLayoutReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("SetBundleBalanceLayout", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetUsedRecordList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetUsedRecordListReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -2110,6 +2384,267 @@ func _Bundle_SoftDeleteUnfinishedInfo_Handler(srv interface{}, ctx context.Conte
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetPendingTaskList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TaskQueryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetPendingTaskList", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_AssignTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TaskAssignRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("AssignTask", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_UpdatePendingCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdatePendingCountRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("UpdatePendingCount", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetRecentAssignRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RecentAssignRecordsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetRecentAssignRecords", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetEmployeeAssignedTasks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(EmployeeTaskQueryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetEmployeeAssignedTasks", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_CompleteTaskManually_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CompleteTaskManuallyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("CompleteTaskManually", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_UpdateTaskProgress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateTaskProgressRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("UpdateTaskProgress", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetTaskAssignRecordsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TaskAssignRecordsQueryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetTaskAssignRecordsList", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetArtistBundleBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ArtistBundleBalanceRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetArtistBundleBalance", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Bundle_ServiceDesc is the grpc_go.ServiceDesc for Bundle service.
|
||||
// It's only intended for direct use with grpc_go.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -2269,6 +2804,22 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "AddBundleBalance",
|
||||
Handler: _Bundle_AddBundleBalance_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BundleActivate",
|
||||
Handler: _Bundle_BundleActivate_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BundleBalanceExport",
|
||||
Handler: _Bundle_BundleBalanceExport_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetBundleBalanceLayout",
|
||||
Handler: _Bundle_GetBundleBalanceLayout_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SetBundleBalanceLayout",
|
||||
Handler: _Bundle_SetBundleBalanceLayout_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUsedRecordList",
|
||||
Handler: _Bundle_GetUsedRecordList_Handler,
|
||||
@ -2313,6 +2864,42 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "SoftDeleteUnfinishedInfo",
|
||||
Handler: _Bundle_SoftDeleteUnfinishedInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPendingTaskList",
|
||||
Handler: _Bundle_GetPendingTaskList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AssignTask",
|
||||
Handler: _Bundle_AssignTask_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdatePendingCount",
|
||||
Handler: _Bundle_UpdatePendingCount_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRecentAssignRecords",
|
||||
Handler: _Bundle_GetRecentAssignRecords_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetEmployeeAssignedTasks",
|
||||
Handler: _Bundle_GetEmployeeAssignedTasks_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CompleteTaskManually",
|
||||
Handler: _Bundle_CompleteTaskManually_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateTaskProgress",
|
||||
Handler: _Bundle_UpdateTaskProgress_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetTaskAssignRecordsList",
|
||||
Handler: _Bundle_GetTaskAssignRecordsList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetArtistBundleBalance",
|
||||
Handler: _Bundle_GetArtistBundleBalance_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "pb/bundle.proto",
|
||||
|
@ -3,7 +3,7 @@ package app
|
||||
import (
|
||||
"github.com/bwmarrin/snowflake"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
"micro-bundle/pkg/db"
|
||||
"micro-bundle/pkg/tracing"
|
||||
)
|
||||
|
||||
@ -13,6 +13,7 @@ type App struct {
|
||||
Lg *zap.Logger
|
||||
//RedisClient *redis.Client
|
||||
JaegerTracer *tracing.JaegerProvider
|
||||
BundleDB *gorm.DB
|
||||
SfNode *snowflake.Node
|
||||
BundleDB *db.BundleDB
|
||||
TaskBenchDB *db.TaskBenchDB
|
||||
}
|
||||
|
25
pkg/cron/cron.go
Normal file
25
pkg/cron/cron.go
Normal file
@ -0,0 +1,25 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"log"
|
||||
"micro-bundle/internal/logic"
|
||||
|
||||
"github.com/robfig/cron/v3"
|
||||
)
|
||||
|
||||
func InitCronJob() {
|
||||
c := cron.New(cron.WithSeconds())
|
||||
|
||||
spec := "0 0 0 1 * *"
|
||||
|
||||
_, err := c.AddFunc(spec, func() {
|
||||
log.Printf("执行余量每月数据更新")
|
||||
logic.UpdateBundleBalance()
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c.Start()
|
||||
|
||||
}
|
@ -8,12 +8,17 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// 定义一个新的类型来区分BundleDB
|
||||
type BundleDB struct {
|
||||
*gorm.DB
|
||||
}
|
||||
|
||||
var Provider = wire.NewSet(NewBundleDB)
|
||||
|
||||
func NewBundleDB() *gorm.DB {
|
||||
func NewBundleDB() *BundleDB {
|
||||
connBundleDB := strings.Join([]string{bundleConfig.Data.BundleDB.User, ":", bundleConfig.Data.BundleDB.Password,
|
||||
"@tcp(", bundleConfig.Data.BundleDB.Host, ":", bundleConfig.Data.BundleDB.Port, ")/",
|
||||
bundleConfig.Data.BundleDB.DbName, "?charset=utf8mb4&parseTime=true&loc=Local"}, "")
|
||||
DciDB := loadMysqlConn(connBundleDB)
|
||||
return DciDB
|
||||
db := loadMysqlConn(connBundleDB)
|
||||
return &BundleDB{DB: db}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -36,10 +38,13 @@ func loadMysqlConn(conn string) *gorm.DB {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("[BundleDB] 数据库连接成功, 连接字符串: %s", conn)
|
||||
sqlDB, _ := db.DB()
|
||||
sqlDB.SetMaxIdleConns(20) //设置连接池,空闲
|
||||
sqlDB.SetMaxOpenConns(100) //打开
|
||||
sqlDB.SetConnMaxLifetime(time.Second * 30)
|
||||
|
||||
// Bundle数据库的自动迁移
|
||||
err = db.AutoMigrate(
|
||||
&model.BundleProfile{},
|
||||
&model.BundleOrderRecords{},
|
||||
@ -55,18 +60,65 @@ func loadMysqlConn(conn string) *gorm.DB {
|
||||
&model.BundleExtensionRecords{},
|
||||
&model.BundleBalance{},
|
||||
&model.Reconciliation{},
|
||||
&model.BundleActivate{},
|
||||
&model.BundleBalanceLayout{},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil
|
||||
// return nil
|
||||
panic(err)
|
||||
}
|
||||
return db
|
||||
}
|
||||
|
||||
// TaskBench数据库的自动迁移函数
|
||||
func loadTaskBenchMysqlConn(conn string) *gorm.DB {
|
||||
var ormLogger logger.Interface
|
||||
if gin.Mode() == "debug" {
|
||||
ormLogger = logger.Default.LogMode(logger.Info)
|
||||
} else {
|
||||
ormLogger = logger.Default
|
||||
}
|
||||
db, err := gorm.Open(mysql.New(mysql.Config{
|
||||
DSN: conn,
|
||||
DefaultStringSize: 256,
|
||||
DisableDatetimePrecision: true,
|
||||
DontSupportRenameIndex: true,
|
||||
DontSupportRenameColumn: true,
|
||||
SkipInitializeWithVersion: false,
|
||||
}), &gorm.Config{
|
||||
Logger: ormLogger,
|
||||
NamingStrategy: schema.NamingStrategy{
|
||||
SingularTable: true,
|
||||
},
|
||||
DisableForeignKeyConstraintWhenMigrating: true,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
sqlDB, _ := db.DB()
|
||||
sqlDB.SetMaxIdleConns(20)
|
||||
sqlDB.SetMaxOpenConns(100)
|
||||
sqlDB.SetConnMaxLifetime(time.Second * 30)
|
||||
|
||||
// 自动迁移任务管理台相关数据库表
|
||||
err = db.AutoMigrate(
|
||||
&model.TaskManagement{},
|
||||
&model.TaskAssignRecords{},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("[TaskBenchDB] 数据库迁移失败: %v", err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
log.Printf("[TaskBenchDB] 数据库迁移成功,已创建表: task_management, task_assign_records")
|
||||
return db
|
||||
}
|
||||
|
||||
func DBMigration() {
|
||||
}
|
||||
|
||||
func addColumn(dst interface{}, column string) {
|
||||
|
||||
return
|
||||
}
|
||||
|
24
pkg/db/taskBenchDB.go
Normal file
24
pkg/db/taskBenchDB.go
Normal file
@ -0,0 +1,24 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
bundleConfig "micro-bundle/config"
|
||||
"strings"
|
||||
|
||||
"github.com/google/wire"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// 定义一个新的类型来区分TaskBenchDB
|
||||
type TaskBenchDB struct {
|
||||
*gorm.DB
|
||||
}
|
||||
|
||||
var TaskBenchProvider = wire.NewSet(NewTaskBenchDB)
|
||||
|
||||
func NewTaskBenchDB() *TaskBenchDB {
|
||||
connTaskBenchDB := strings.Join([]string{bundleConfig.Data.TaskBenchDB.User, ":", bundleConfig.Data.TaskBenchDB.Password,
|
||||
"@tcp(", bundleConfig.Data.TaskBenchDB.Host, ":", bundleConfig.Data.TaskBenchDB.Port, ")/",
|
||||
bundleConfig.Data.TaskBenchDB.DbName, "?charset=utf8mb4&parseTime=true&loc=Local"}, "")
|
||||
db := loadTaskBenchMysqlConn(connTaskBenchDB)
|
||||
return &TaskBenchDB{DB: db}
|
||||
}
|
@ -18,6 +18,11 @@ const (
|
||||
JA_JP = "ja-JP" //日语
|
||||
)
|
||||
|
||||
const (
|
||||
Benefits = 1 //套餐权益
|
||||
OptionalBenefits = 2 //套餐可选附加权益
|
||||
)
|
||||
|
||||
const (
|
||||
Http = 200
|
||||
OriginalPrice = 3500 // 注意!!!这边是原始价格如果发生更改,则默认增值套餐需要停用,并且新增新的增值套餐(功能未做)
|
||||
|
3
protocBundle.bat
Normal file
3
protocBundle.bat
Normal file
@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
protoc -I . -I ./pb --proto_path=./pb --go_out=./pb --go-triple_out=./pb --govalidators_out=./pb ./pb/bundle.proto
|
||||
.\clear.sh
|
Loading…
Reference in New Issue
Block a user