Compare commits

..

No commits in common. "main" and "sxy" have entirely different histories.
main ... sxy

28 changed files with 1496 additions and 4083 deletions

36
.gitignore vendored
View File

@ -1,36 +0,0 @@
# local env files
.env.local
.env.*.local
# Log files
*.log
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.iml
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
/cmd/runtime
/cmd/logs/*.log
/cmd/runtime/log/*.log
/build/*
.vscode
.idea/*
/.idea/*

View File

@ -1,4 +1,2 @@
protoc --proto_path=. --go_out=./pb --go-triple_out=./pb --govalidators_out=./pb ./pb/bundle.proto
ls pb/bundle/*.pb.go | xargs -n1 -IX bash -c 'sed s/,omitempty// X > X.tmp && mv X{.tmp,}';

View File

@ -1,18 +1,17 @@
package main
import (
bundleConfig "micro-bundle/config"
"micro-bundle/internal/controller"
_ "micro-bundle/internal/handler"
"micro-bundle/pkg/app"
"micro-bundle/pkg/tracing"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/filter/tps/strategy"
_ "dubbo.apache.org/dubbo-go/v3/imports"
"github.com/bwmarrin/snowflake"
"go.uber.org/zap"
"gorm.io/gorm"
bundleConfig "micro-bundle/config"
"micro-bundle/internal/controller"
_ "micro-bundle/internal/handler"
"micro-bundle/pkg/app"
"micro-bundle/pkg/tracing"
)
func NewApp(Lg *zap.Logger, JaegerTracer *tracing.JaegerProvider, SfNode *snowflake.Node, BundleDB *gorm.DB) *app.App {
@ -31,6 +30,7 @@ func main() {
if err != nil {
panic(err)
}
//l, err := net.Listen("tcp", ":8883")
//if err != nil {
// fmt.Printf("failed to listen: %v", err)
@ -47,17 +47,4 @@ func main() {
panic(err)
}
select {}
// dao.AddBundleExtendRecord(model.BundleExtensionRecords{
// UserId: 57,
// OperatorId: 87,
// AccountAdditional: 1,
// VideoAdditional: 1,
// AvailableDurationAdditional: 1,
// ImagesAdditional: 1,
// DataAdditional: 1,
// AssociatedOrderNumber: "asda",
// Type: 1,
// Remark: "test",
// CreatedAt: time.Now(),
// })
}

View File

@ -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&param.sign=&pid=32300&registry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=tracing&side=provider&timestamp=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&param.sign=&pid=32300&registry=zookeeper&registry.role=3&release=dubbo-golang-3.0.0&retries=0&serialization=&service.filter=tps%2Ctracing&side=provider&timestamp=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&param.sign=&pid=32300&registry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider&timestamp=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&param.sign=&pid=32300&registry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider&timestamp=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&param.sign=&pid=32300&registry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=tracing&side=provider&timestamp=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&param.sign=&pid=32300&registry=zookeeper&registry.role=3&release=dubbo-golang-3.0.0&retries=0&serialization=&service.filter=tps%2Ctracing&side=provider&timestamp=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&param.sign=&pid=46056&registry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=tracing&side=provider&timestamp=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&param.sign=&pid=46056&registry=zookeeper&registry.role=3&release=dubbo-golang-3.0.0&retries=0&serialization=&service.filter=tps%2Ctracing&side=provider&timestamp=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&param.sign=&pid=46056&registry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider&timestamp=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&param.sign=&pid=46056&registry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider&timestamp=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&param.sign=&pid=46056&registry=zookeeper&registry.role=3&release=dubbo-golang-3.0.0&retries=0&serialization=&service.filter=tps%2Ctracing&side=provider&timestamp=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&param.sign=&pid=46056&registry.role=3&release=dubbo-golang-3.0.0&retries=&serialization=&service.filter=tracing&side=provider&timestamp=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."}

10
go.mod
View File

@ -1,6 +1,6 @@
module micro-bundle
go 1.23.3
go 1.18
require (
dubbo.apache.org/dubbo-go/v3 v3.0.2
@ -8,7 +8,6 @@ require (
github.com/bwmarrin/snowflake v0.3.0
github.com/dubbogo/grpc-go v1.42.9
github.com/dubbogo/triple v1.1.8
github.com/duke-git/lancet/v2 v2.3.6
github.com/getsentry/sentry-go v0.28.1
github.com/gin-gonic/gin v1.9.0
github.com/go-redis/redis v6.15.9+incompatible
@ -18,13 +17,11 @@ require (
github.com/mwitkow/go-proto-validators v0.3.2
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/opentracing/opentracing-go v1.2.0
github.com/samber/lo v1.51.0
github.com/shopspring/decimal v1.4.0
github.com/spf13/viper v1.7.1
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271
github.com/uber/jaeger-client-go v2.30.0+incompatible
go.uber.org/zap v1.24.0
google.golang.org/grpc v1.54.0
google.golang.org/protobuf v1.29.1
gorm.io/datatypes v1.2.5
gorm.io/driver/mysql v1.5.6
@ -149,11 +146,12 @@ require (
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/grpc v1.54.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect

10
go.sum
View File

@ -210,8 +210,6 @@ github.com/dubbogo/net v0.0.4/go.mod h1:1CGOnM7X3he+qgGNqjeADuE5vKZQx/eMSeUkpU3u
github.com/dubbogo/triple v1.0.9/go.mod h1:1t9me4j4CTvNDcsMZy6/OGarbRyAUSY0tFXGXHCp7Iw=
github.com/dubbogo/triple v1.1.8 h1:yE+J3W1NTZCEPa1FoX+VWZH6UF1c0+A2MGfERlU2zbI=
github.com/dubbogo/triple v1.1.8/go.mod h1:9pgEahtmsY/avYJp3dzUQE8CMMVe1NtGBmUhfICKLJk=
github.com/duke-git/lancet/v2 v2.3.6 h1:NKxSSh+dlgp37funvxLCf3xLBeUYa7VW1thYQP6j3Y8=
github.com/duke-git/lancet/v2 v2.3.6/go.mod h1:zGa2R4xswg6EG9I6WnyubDbFO/+A/RROxIbXcwryTsc=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
@ -795,8 +793,6 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
github.com/samber/lo v1.51.0 h1:kysRYLbHy/MB7kQZf5DSN50JHmMsNEdeY24VzJFu7wI=
github.com/samber/lo v1.51.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b h1:gQZ0qzfKHQIybLANtM3mBXNUtOfsCFXeTsnBqCsx1KM=
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
@ -1128,9 +1124,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -1241,9 +1236,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

View File

@ -34,7 +34,7 @@ func (b *BundleProvider) BundleDetail(_ context.Context, req *bundle.BundleDetai
}
// 订单相关
func (b *BundleProvider) CreateOrderRecord(_ context.Context, req *bundle.OrderCreateRecord) (res *bundle.CommonResponse, err error) {
func (b *BundleProvider) CreateOrderRecord(_ context.Context, req *bundle.OrderRecord) (res *bundle.CommonResponse, err error) {
return logic.CreateOrderRecord(req)
}
@ -77,53 +77,3 @@ func (b *BundleProvider) ValueAddBundleDetail(_ context.Context, req *bundle.Val
func (b *BundleProvider) UpdateFinancialConfirmationStatus(_ context.Context, req *bundle.FinancialConfirmationRequest) (res *bundle.CommonResponse, err error) {
return logic.UpdateFinancialConfirmationStatus(req)
}
func (b *BundleProvider) PackagePriceAndTime(_ context.Context, req *bundle.OrderRecord) (res *bundle.PackagePriceAndTimeResponse, err error) {
return logic.PackagePriceAndTime(req)
}
// 创建增值服务订单
func (b *BundleProvider) CreateOrderAddRecord(_ context.Context, req *bundle.OrderAddRecord) (res *bundle.CommonResponse, err error) {
return logic.CreateOrderAddRecord(req)
}
func (b *BundleProvider) OrderRecordsListV2(_ context.Context, req *bundle.OrderRecordsRequestV2) (res *bundle.OrderRecordsResponseV2, err error) {
return logic.OrderRecordsListV2(req)
}
func (b *BundleProvider) OrderListByOrderNo(_ context.Context, req *bundle.OrderInfoByOrderNoRequest) (res *bundle.OrderInfoByOrderNoResp, err error) {
return logic.OrderListByOrderNo(req)
}
// 对账单
func (b *BundleProvider) GetReconciliationList(_ context.Context, req *bundle.GetReconciliationListReq) (res *bundle.GetReconciliationListResp, err error) {
return logic.GetReconciliationList(req)
}
func (b *BundleProvider) CreateReconciliation(_ context.Context, req *bundle.ReconciliationInfo) (res *bundle.CommonResponse, err error) {
return logic.CreateReconciliation(req)
}
func (b *BundleProvider) UpdateReconciliation(_ context.Context, req *bundle.ReconciliationInfo) (res *bundle.CommonResponse, err error) {
return logic.UpdateReconciliation(req)
}
func (b *BundleProvider) OnlyAddValueListByOrderNo(_ context.Context, req *bundle.OnlyAddValueListByOrderNoRequest) (res *bundle.OnlyAddValueListByOrderNoResp, err error) {
return logic.OnlyAddValueListByOrderNo(req)
}
func (b *BundleProvider) UpdateReconciliationStatusBySerialNumber(_ context.Context, req *bundle.UpdateStatusAndPayTimeBySerialNumber) (res *bundle.CommonResponse, err error) {
return logic.UpdateReconciliationStatusBySerialNumber(req)
}
// 删除订单
func (b *BundleProvider) DeleteValueAddService(_ context.Context, req *bundle.DeleteValueAddServiceRequest) (res *bundle.CommonResponse, err error) {
return logic.DeleteValueAddService(req)
}
// 自动创建用户且实名且下订单
func (b *BundleProvider) ListUnfinishedInfos(_ context.Context, req *bundle.AutoCreateUserAndOrderRequest) (res *bundle.UnfinishedInfos, err error) {
return logic.ListUnfinishedInfos(req)
}
// 自动创建用户且实名且下订单
func (b *BundleProvider) SoftDeleteUnfinishedInfo(_ context.Context, req *bundle.SoftDeleteUnfinishedInfoRequest) (res *bundle.CommonResponse, err error) {
return logic.SoftDeleteUnfinishedInfo(req)
}

View File

@ -1,51 +0,0 @@
package controller
import (
"context"
"micro-bundle/internal/logic"
"micro-bundle/pb/bundle"
)
func (b *BundleProvider) BundleExtend(_ context.Context, req *bundle.BundleExtendRequest) (*bundle.BundleExtendResponse, error) {
return logic.BundleExtend(req)
}
func (b *BundleProvider) BundleExtendRecordsList(_ context.Context, req *bundle.BundleExtendRecordsListRequest) (*bundle.BundleExtendRecordsListResponse, error) {
return logic.BundleExtendRecordsList(req)
}
func (b *BundleProvider) GetBundleBalanceList(_ context.Context, req *bundle.GetBundleBalanceListReq) (*bundle.GetBundleBalanceListResp, error) {
return logic.GetBundleBalanceList(req)
}
func (b *BundleProvider) GetBundleBalanceByUserId(_ context.Context, req *bundle.GetBundleBalanceByUserIdReq) (*bundle.GetBundleBalanceByUserIdResp, error) {
return logic.GetBundleBalanceByUserId(req)
}
func (b *BundleProvider) CreateBundleBalance(_ context.Context, req *bundle.CreateBundleBalanceReq) (*bundle.CreateBundleBalanceResp, error) {
return logic.CreateBundleBalance(req)
}
func (b *BundleProvider) AddBundleBalance(_ context.Context, req *bundle.AddBundleBalanceReq) (*bundle.AddBundleBalanceResp, error) {
return logic.AddBundleBalance(req)
}
func (b *BundleProvider) GetUsedRecordList(_ context.Context, req *bundle.GetUsedRecordListReq) (*bundle.GetUsedRecordListResp, error) {
return logic.GetUsedRecord(req)
}
func (b *BundleProvider) GetImageWorkDetail(_ context.Context, req *bundle.GetImageWorkDetailReq) (*bundle.GetImageWorkDetailResp, error) {
return logic.GetImageWorkDetail(req)
}
func (b *BundleProvider) GetVedioWorkDetail(_ context.Context, req *bundle.GetVedioWorkDetailReq) (*bundle.GetVedioeWorkDetailResp, error) {
return logic.GetVedioWorkDetail(req)
}
func (b *BundleProvider) ToBeComfirmedWorks(_ context.Context, req *bundle.ToBeComfirmedWorksReq) (*bundle.ToBeComfirmedWorksResp, error) {
return logic.ToBeComfirmedWorks(req)
}
func (b *BundleProvider) ConfirmWork(_ context.Context, req *bundle.ConfirmWorkReq) (*bundle.ConfirmWorkResp, error) {
return logic.ConfirmWork(req)
}

View File

@ -1,316 +0,0 @@
package dao
import (
"errors"
"fmt"
"micro-bundle/internal/model"
"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"
)
func AddBundleExtendRecord(data model.BundleExtensionRecords) error {
return app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {
if err := tx.Create(&data).Error; err != nil {
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 {
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
}
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").
Select(`
ber.*,
rn.name as user_name,
u.tel_num as user_phone_number
`).Joins("LEFT JOIN `micro-account`.`user` u on u.id = user_id").
Joins("LEFT JOIN `micro-account`.`real_name` rn on u.real_name_id = rn.id").
Order("created_at desc")
if req.User != "" {
if utils.IsPhoneNumber(req.User) {
session = session.Where("u.tel_num = ?", req.User)
} else {
session = session.Where("rn.name like ?", "%"+req.User+"%")
}
}
if req.Operator != "" {
if utils.IsPhoneNumber(req.Operator) {
session = session.Where("ber.operator_phone_number = ?", req.Operator)
} else {
session = session.Where("ber.operator_name like ?", "%"+req.Operator+"%")
}
}
if req.Type != 0 {
session = session.Where("ber.`type` = ?", req.Type)
}
if req.StartTime != 0 {
session = session.Where("ber.created_at >= ?", time.UnixMilli(int64(req.StartTime)))
}
if req.EndTime != 0 {
session = session.Where("ber.created_at <= ?", time.UnixMilli(int64(req.EndTime)))
}
if req.AssociatedOrderNumber != "" {
session = session.Where("ber.associated_order_number like ?", "%"+req.AssociatedOrderNumber+"%")
}
if err = session.Count(&total).Error; err != nil {
return
}
if req.Page != 0 && req.PageSize != 0 {
session = session.Limit(int(req.PageSize)).Offset(int(req.Page-1) * int(req.PageSize))
}
err = session.Find(&data).Error
return
}
func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.BundleBalancePo, total int64, err 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(`bb.*, bor.expiration_time as expired_time, bor.bundle_name, bor.status,
bor.uuid as order_uuid, rn.name as user_name,
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").
Where("rn.name IS NOT NULL").
Where("u.deleted_at = 0").
Order("bor.expiration_time desc")
if req.UserName != "" {
if utils.IsPhoneNumber(req.UserName) {
session = session.Where("u.tel_num = ?", req.UserName)
} else {
session = session.Where("rn.name like ?", "%"+req.UserName+"%")
}
}
if req.Status != 0 {
session = session.Where("bor.status = ?", req.Status)
}
if req.BundleName != "" {
session = session.Where("bor.bundle_name like ?", "%"+req.BundleName+"%")
}
if req.ExpiredTimeEnd != 0 {
session = session.Where("bor.expiration_time <= ?", time.UnixMilli(req.ExpiredTimeEnd))
}
if req.ExpiredTimeStart != 0 {
session = session.Where("bor.expiration_time >= ?", time.UnixMilli(req.ExpiredTimeStart))
}
if req.Bought == 2 {
session = session.Where("bor.uuid IS NOT NULL")
}
if req.Bought == 1 {
session = session.Where("bor.uuid IS NULL")
}
err = session.Count(&total).Error
if err != nil {
return
}
if req.Page != 0 && req.PageSize != 0 {
session = session.Limit(int(req.PageSize)).Offset(int(req.Page-1) * int(req.PageSize))
}
err = session.Find(&data).Error
return
}
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
return
}
func AddBundleBalanceByUserId(data model.BundleBalance) 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
})
}
func CreateBundleBalance(data model.BundleBalance) error {
return app.ModuleClients.BundleDB.Create(&data).Error
}
func GetUsedRecord(req *bundle.GetUsedRecordListReq) (data []model.CostLogPo, total int64, err error) {
session := app.ModuleClients.BundleDB.
Table("cast_cost_log ccl").
Select("ccl.*,cwl.cost_type").
Joins("left join cast_work_log cwl on cwl.work_uuid = ccl.work_uuid").
Where("cwl.work_status = 1 and cwl.deleted_at = 0 and ccl.deleted_at = 0")
if req.WorkTitle != "" {
session = session.Where("ccl.work_title like ?", "%"+req.WorkTitle+"%")
}
if req.Platform != 0 {
session = session.Where(fmt.Sprintf("JSON_CONTAINS(ccl.platform_ids,'%d')", req.Platform))
}
if req.Account != "" {
session = session.Where(fmt.Sprintf(`JSON_CONTAINS(ccl.media_names,'"%s"')`, req.Account))
}
if req.SubmitTimeEnd != 0 {
session = session.Where("ccl.submit_time <= ?", time.UnixMilli(req.SubmitTimeEnd))
}
if req.SubmitTimeStart != 0 {
session = session.Where("ccl.submit_time >= ?", time.UnixMilli(req.SubmitTimeStart))
}
if req.CostType != 0 {
session = session.Where("cwl.cost_type = ?", req.CostType)
}
if req.User != "" {
if utils.IsPhoneNumber(req.User) {
session = session.Where("ccl.artist_phone = ?", req.User)
} else {
session = session.Where("ccl.artist_name like ?", "%"+req.User+"%")
}
}
if req.Operator != "" {
if utils.IsPhoneNumber(req.Operator) {
session = session.Where("ccl.operator_phone = ?", req.Operator)
} else {
session = session.Where("ccl.operator_name like ?", "%"+req.Operator+"%")
}
}
if req.Type != 0 {
session = session.Where("ccl.work_category = ?", req.Type)
}
if err = session.Count(&total).Error; err != nil {
return
}
if req.Page != 0 && req.PageSize != 0 {
session = session.Offset(int(req.Page-1) * int(req.PageSize)).Limit(int(req.PageSize))
}
err = session.Order("ccl.updated_at desc").Find(&data).Error
return
}
func GetImageWorkDetail(req *bundle.GetImageWorkDetailReq) (data model.CastWorkImage, err error) {
err = app.ModuleClients.BundleDB.Where(&model.CastWorkImage{WorkUuid: req.WorkId}).First(&data).Error
return
}
func GetVedioWorkDetail(req *bundle.GetVedioWorkDetailReq) (data model.CastWorkVideo, err error) {
err = app.ModuleClients.BundleDB.Where(&model.CastWorkVideo{WorkUuid: req.WorkId}).First(&data).Error
return
}
func ToBeComfirmedWorks(req *bundle.ToBeComfirmedWorksReq) (data []model.CastWorkLog, total int64, unconfirmed int64, err error) {
unConfirmSubQuery := app.ModuleClients.BundleDB.
Table("cast_work_log").
Select("work_uuid, MAX(update_time) AS max_update_time").
Group("work_uuid").Where("work_status = ?", 4)
err = app.ModuleClients.BundleDB.
Table("cast_work_log AS cwl").
Joins("INNER JOIN (?) AS t ON cwl.work_uuid = t.work_uuid AND cwl.update_time = t.max_update_time", unConfirmSubQuery).
Where("artist_uuid = ?", req.ArtistUuid).Where("confirmed_at = ?", 0).Count(&unconfirmed).Error
if err != nil {
return
}
subQuery := app.ModuleClients.BundleDB.
Table("cast_work_log").
Select("work_uuid, MAX(update_time) AS max_update_time").
Group("work_uuid").Where("work_status in ?", []int{4, 5, 6, 7})
session := app.ModuleClients.BundleDB.
Table("cast_work_log AS cwl").
Joins("INNER JOIN (?) AS t ON cwl.work_uuid = t.work_uuid AND cwl.update_time = t.max_update_time", subQuery).
Where("artist_uuid = ?", req.ArtistUuid)
err = session.Count(&total).Error
if err != nil {
return
}
if req.Page != 0 && req.PageSize != 0 {
session.Limit(int(req.PageSize)).Offset(int(req.Page-1) * int(req.PageSize))
}
err = session.Order("created_at desc").Find(&data).Error
return
}
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
}

View File

@ -1,94 +1,46 @@
package dao
import (
"encoding/json"
"errors"
"fmt"
"github.com/jinzhu/copier"
"gorm.io/gorm"
"micro-bundle/internal/model"
"micro-bundle/pb/bundle"
"micro-bundle/pkg/app"
commonErr "micro-bundle/pkg/err"
"micro-bundle/pkg/msg"
"micro-bundle/pkg/utils"
"strconv"
"time"
)
func CreateOrderRecord(orderRecord *model.BundleOrderRecords) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
var bundleInfo model.BundleProfile
// 查询套餐主表并预加载
err = app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).
Where("uuid = ?", orderRecord.BundleUUID).
Preload("BundleToValueAddService").
Preload("BundleProfileLang", "language = ?", orderRecord.Language).
First(&bundleInfo).Error
if err != nil {
res.Msg = msg.ErrorBundleNotFound
return res, commonErr.ReturnError(err, msg.ErrorBundleNotFound, "查询Bundle信息失败: ")
}
// 填充BundleCommonJson字段
if bundleJson, e := json.Marshal(bundleInfo); e == nil {
orderRecord.BundleCommonJson = bundleJson
} else {
res.Msg = msg.ErrorDataConvert
return res, commonErr.ReturnError(e, msg.ErrorDataConvert, "Bundle信息转换失败: ")
}
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).Create(orderRecord).Error
if err != nil {
orderRecord.UUID = app.ModuleClients.SfNode.Generate().Base64()
orderRecord.OrderNo = utils.GetOrderNo()
// 开启事务
tx := app.ModuleClients.BundleDB.Begin()
defer func() {
if r := recover(); r != nil {
tx.Rollback()
}
}()
// 创建主订单
if err = tx.Model(&model.BundleOrderRecords{}).Create(&orderRecord).Error; err != nil {
tx.Rollback()
res.Msg = msg.ErrorCreateOrderInfo
return res, commonErr.ReturnError(err, msg.ErrorCreateOrderInfo, "创建订单信息失败: ")
}
// 提交事务
if err = tx.Commit().Error; err != nil {
res.Msg = msg.ErrorCommitTransaction
return res, commonErr.ReturnError(err, msg.ErrorCommitTransaction, "提交事务失败: ")
}
res.Uuid = orderRecord.UUID
res.OrderNo = orderRecord.OrderNo
res.Msg = msg.SuccessCreateOrderInfo
return
}
// calculateAmount 计算子订单金额
func calculateAmount(valueUid string, req *bundle.OrderRecord) (amount float64, valueAddServiceLang *model.ValueAddServiceLang, num int32, expirationDay string, err error) {
err = app.ModuleClients.BundleDB.
Where("uuid = ? AND language = ?", valueUid, req.Language).
First(&valueAddServiceLang).Error
if err != nil {
return
}
for _, opt := range valueAddServiceLang.Options {
for _, p := range req.PriceOptionsInfo {
if p.ValueUid == valueUid && opt.Id == p.Id {
num = opt.Num
if valueAddServiceLang.PriceMode == 1 {
amount = float64(float32(opt.Num) * opt.Price)
} else if valueAddServiceLang.PriceMode == 2 {
amount = float64(opt.Price)
}
}
}
// 计算过期时间
if valueAddServiceLang.ServiceType == 5 {
expirationDay = calculateExpirationDay(opt.Num, valueAddServiceLang.Unit)
}
}
return
}
// calculateExpirationDay 计算到期日
func calculateExpirationDay(num int32, unit string) string {
now := time.Now()
switch unit {
case "天":
return now.AddDate(0, 0, int(num)).Format("2006-01-02")
case "月":
return now.AddDate(0, int(num), 0).Format("2006-01-02")
case "年":
return now.AddDate(int(num), 0, 0).Format("2006-01-02")
default:
return ""
}
}
func UpdateOrderRecord(orderRecord *model.BundleOrderRecords) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).Where("uuid = ?", orderRecord.UUID).Updates(orderRecord).Error
@ -103,46 +55,14 @@ func UpdateOrderRecord(orderRecord *model.BundleOrderRecords) (res *bundle.Commo
func UpdateOrderRecordByOrderNO(orderRecord *model.BundleOrderRecords) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
// Step 1: 先更新子订单(增值服务)的支付状态
valueAdd := &model.BundleOrderValueAdd{
PaymentStatus: int(orderRecord.Status),
PaymentTime: orderRecord.PayTime,
}
if orderRecord.CheckoutSessionId != "" {
valueAdd.CheckoutSessionId = orderRecord.CheckoutSessionId
valueAdd.CheckoutSessionUrl = orderRecord.CheckoutSessionUrl
}
if orderRecord.Status == 2 {
tempValues := make([]*model.BundleOrderValueAdd, 0)
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderValueAdd{}).
Where("order_no = ?", orderRecord.OrderNo).
Find(&tempValues).Error
if len(tempValues) > 0 {
for _, value := range tempValues {
if value.PaymentStatus == 2 {
fmt.Println("====================已经付过了")
return nil, errors.New("已付款了")
}
}
}
}
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderValueAdd{}).
Where("order_no = ?", orderRecord.OrderNo).
Updates(valueAdd).Error
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).Where("order_no = ?", orderRecord.OrderNo).Updates(orderRecord).Error
if err != nil {
res.Msg = msg.ErrorUpdateOrderInfo
return res, commonErr.ReturnError(err, msg.ErrorUpdateOrderInfo, "更新增值服务支付状态失败: ")
return res, commonErr.ReturnError(err, msg.ErrorUpdateOrderInfo, "更新订单信息失败: ")
}
// Step 2: 再更新主订单信息(如果存在)
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).
Where("order_no = ?", orderRecord.OrderNo).
Updates(orderRecord).Error
// Step 3: 返回结果(即使主订单更新失败,也视为成功)
res.Uuid = orderRecord.UUID
res.Msg = msg.SuccessUpdateOrderInfo
return res, nil
return
}
func OrderRecordsList(req *bundle.OrderRecordsRequest) (res *bundle.OrderRecordsResponse, err error) {
@ -179,7 +99,7 @@ func OrderRecordsList(req *bundle.OrderRecordsRequest) (res *bundle.OrderRecords
}
if req.Status != 0 {
query = query.Where("`bundle_order_records`.status = ?", req.Status)
query = query.Where("status = ?", req.Status)
}
if req.StartSignedTime != "" {
@ -256,7 +176,6 @@ func OrderRecordsList(req *bundle.OrderRecordsRequest) (res *bundle.OrderRecords
BundleCommonUid: record.BundleCommonUid,
AddBundleCommonUid: record.AddBundleCommonUid,
FinancialConfirmation: record.FinancialConfirmation,
ExpirationTime: record.ExpirationTime,
})
}
@ -286,36 +205,13 @@ func OrderRecordDetail(req *bundle.OrderRecordsDetailRequest) (res *bundle.Order
if req.CustomerID != "" {
query = query.Where("customer_id = ?", req.CustomerID)
}
if req.BundleUUID != "" {
query = query.Where("bundle_uuid = ?", req.BundleUUID)
}
if req.Status != 0 {
query = query.Where("status = ?", req.Status)
}
err = query.Order("created_at desc").First(&orderRecord).Error
err = query.First(&orderRecord).Error
if err != nil {
return res, commonErr.ReturnError(err, msg.ErrorGetOrderInfo, "获取订单信息失败: ")
}
//_ = copier.CopyWithOption(&res, orderRecord, copier.Option{DeepCopy: true})
addBundles := make([]model.BundleOrderValueAdd, 0)
addInfos := make([]*bundle.AddInfo, 0)
if req.OrderNo == "" {
req.OrderNo = orderRecord.OrderNo
err = app.ModuleClients.BundleDB.Model(model.BundleOrderValueAdd{}).Where("deleted_at is null and source = 1 and order_no = ?", req.OrderNo).Find(&addBundles).Error
if err != nil {
return res, commonErr.ReturnError(err, "增值订单信息", "获取增值订单信息失败: ")
}
for _, addBundle := range addBundles {
addInfo := &bundle.AddInfo{
OrderNo: addBundle.OrderNo,
Num: addBundle.Num,
ValueAddUUID: addBundle.ValueAddUUID,
}
addInfos = append(addInfos, addInfo)
}
}
res = &bundle.OrderRecord{
Uuid: orderRecord.UUID,
OrderNo: orderRecord.OrderNo,
@ -338,518 +234,6 @@ func OrderRecordDetail(req *bundle.OrderRecordsDetailRequest) (res *bundle.Order
ValueAddBundleUuid: orderRecord.ValueAddBundleUUID,
ValueAddBundleAmount: orderRecord.ValueAddBundleAmount,
TotalAmount: orderRecord.TotalAmount,
ExpirationTime: orderRecord.ExpirationTime,
}
res.AddInfos = make([]*bundle.AddInfo, 0)
res.AddInfos = addInfos
return
}
func PackagePriceAndTime(orderRecord *bundle.OrderRecord) (res *bundle.PackagePriceAndTimeResponse, err error) {
res = new(bundle.PackagePriceAndTimeResponse)
bundleInfo := new(model.BundleProfile)
// 查询套餐主表并预加载
err = app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).
Where("uuid = ?", orderRecord.BundleUuid).
Preload("BundleToValueAddService").
Preload("BundleProfileLang", "language = ?", orderRecord.Language).
First(&bundleInfo).Error
if err != nil {
return res, commonErr.ReturnError(err, msg.ErrorBundleNotFound, "查询Bundle信息失败: ")
}
var (
valueAddAmount float64
expirationTime = "9999-12-31"
)
for _, service := range bundleInfo.BundleToValueAddService {
amount, _, _, day, e := calculateAmount(service.ValueUid, orderRecord)
if e != nil {
return res, commonErr.ReturnError(e, msg.ErrorDataConvert, "子订单金额计算失败: ")
}
if day != "" {
expirationTime = day
}
valueAddAmount = valueAddAmount + amount
}
res = &bundle.PackagePriceAndTimeResponse{
Price: float32(valueAddAmount),
Time: expirationTime,
}
return
}
func CreateOrderAddRecord(req *bundle.OrderAddRecord) (res *bundle.CommonResponse, err error) {
tx := app.ModuleClients.BundleDB.Begin()
defer func() {
if r := recover(); r != nil {
tx.Rollback()
}
}()
orderNo := utils.GetOrderNo()
var childOrders []*model.BundleOrderValueAdd
for _, i := range req.AddPriceOptionsList {
childOrder := &model.BundleOrderValueAdd{
UUID: app.ModuleClients.SfNode.Generate().Base64(),
OrderUUID: req.OrderUUID, // 修正: 这里应使用主订单UUID
CustomerID: req.CustomerID,
CustomerNum: req.CustomerNum,
CustomerName: req.CustomerName,
ServiceType: i.ServiceType,
CurrencyType: i.CurrencyType,
Amount: float64(i.Amount),
OrderNo: orderNo,
Num: i.Num,
Unit: i.Unit,
ValueAddUUID: i.ValueUid,
Source: 2,
PaymentStatus: 1,
SignContract: req.SignContract,
Signature: req.Signature,
SignedTime: req.SignedTime,
Snapshot: req.Snapshot,
}
childOrders = append(childOrders, childOrder)
// 如果是类型5服务更新主订单的过期时间
if i.ServiceType == 5 && req.ExpirationDate != "" {
if err := tx.Model(&model.BundleOrderRecords{}).
Where("uuid = ?", req.BundleUuid).
Update("expiration_time", req.ExpirationDate).Error; err != nil {
tx.Rollback()
return nil, commonErr.ReturnError(err, msg.ErrorCreateOrderInfo, "更新主订单过期时间失败: ")
}
}
}
// 批量创建子订单(提高性能)
if err = tx.Model(&model.BundleOrderValueAdd{}).Create(childOrders).Error; err != nil {
tx.Rollback()
return res, commonErr.ReturnError(err, msg.ErrorCreateOrderInfo, "批量创建子订单失败")
}
// 提交事务
if err := tx.Commit().Error; err != nil {
tx.Rollback()
return nil, commonErr.ReturnError(err, msg.ErrorCreateOrderInfo, "提交事务失败: ")
}
return &bundle.CommonResponse{
Uuid: req.BundleUuid,
OrderNo: orderNo,
Msg: msg.SuccessCreateOrderInfo,
}, nil
}
func OrderRecordsListV2(req *bundle.OrderRecordsRequestV2) (res *bundle.OrderRecordsResponseV2, err error) {
res = new(bundle.OrderRecordsResponseV2)
var count int64
modelObj := app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).
Select("bundle_order_records.*,a.name as bundle_name").
Preload("BundleOrderValueAdd").
Joins("left join bundle_profile a on bundle_order_records.bundle_uuid = a.uuid")
//Joins("left join bundle_order_value_add on bundle_order_records.uuid = bundle_order_value_add.order_uuid")
if len(req.UserIds) != 0 {
modelObj = modelObj.Where("bundle_order_records.customer_id in ?", req.UserIds)
}
if req.BundleName != "" {
modelObj = modelObj.Where("a.name like ?", "%"+req.BundleName+"%")
}
if req.PayStatus != 0 {
modelObj = modelObj.Where("bundle_order_records.status = ?", req.PayStatus)
}
if req.AddPayStatus != 0 {
modelObj = modelObj.Where("exists (select 1 from bundle_order_value_add where bundle_order_value_add.order_uuid = bundle_order_records.uuid and bundle_order_value_add.payment_status = ?)", req.AddPayStatus)
}
if req.OrderNo != "" {
modelObj = modelObj.Where("bundle_order_records.order_no = ?", req.OrderNo)
}
if req.OrderAddNo != "" {
modelObj = modelObj.Where("exists (select 1 from bundle_order_value_add where bundle_order_value_add.order_uuid = bundle_order_records.uuid and bundle_order_value_add.order_no = ?)", req.OrderAddNo)
}
if req.BundleCreateAtStart != "" && req.BundleCreateAtEnd != "" {
modelObj = modelObj.Where("bundle_order_records.created_at between ? and ?", req.BundleCreateAtStart, req.BundleCreateAtEnd)
}
if req.OrderAddCreateAtStart != "" && req.OrderAddCreateAtEnd != "" {
modelObj = modelObj.Where("bundle_order_records.created_at between ? and ?", req.OrderAddCreateAtStart, req.OrderAddCreateAtEnd)
}
if req.BundlePayStart != "" && req.BundlePayEnd != "" {
modelObj = modelObj.Where("bundle_order_records.pay_time between ? and ?", req.BundlePayStart, req.BundlePayEnd)
}
err = modelObj.Count(&count).Error
if req.PageSize != 0 && req.Page != 0 {
modelObj = modelObj.Limit(int(req.PageSize)).Offset(int(req.Page-1) * int(req.PageSize))
}
type OrderRecords struct {
model.BundleOrderRecords
BundleName string `json:"bundleName"`
}
var records []OrderRecords
err = modelObj.Order("bundle_order_records.created_at desc").Find(&records).Error
if err != nil {
return nil, err
}
for _, record := range records {
customerID, _ := strconv.ParseInt(record.CustomerID, 10, 64)
orderItem := &bundle.OrderBundleRecordInfo{
OrderNo: record.OrderNo,
BundleName: record.BundleName,
PayStatus: int32(record.Status),
TelNum: "",
CustomerName: record.CustomerName,
BundleCreateAt: record.CreatedAt.Format("2006-01-02 15:04:05"),
Amount: record.Amount,
CustomerId: customerID,
PayTime: record.PayTime,
}
// 聚合子订单
addMap := make(map[string]*bundle.OrderAddBundleRecordInfo)
for _, sub := range record.BundleOrderValueAdd {
orderAddNo := sub.OrderNo
amount := float32(sub.Amount)
if existing, ok := addMap[orderAddNo]; ok {
existing.Amount += amount
// 仅当 VideoNum 尚未设置且当前是 ServiceType == 1 时赋值
if existing.VideoNum == 0 && sub.ServiceType == 1 {
existing.VideoNum = sub.Num
}
} else {
var videoNum int32
if sub.ServiceType == 1 {
videoNum = sub.Num
}
addMap[orderAddNo] = &bundle.OrderAddBundleRecordInfo{
OrderAddNo: orderAddNo,
Amount: amount,
CurrencyType: int32(sub.CurrencyType),
HandlingFee: sub.HandlingFee, //手续费
OrderAddCreateAt: sub.CreatedAt.Format("2006-01-02 15:04:05"),
AddPayStatus: int32(sub.PaymentStatus),
Contract: sub.SignContract,
Snapshot: sub.Snapshot,
CheckoutSessionId: sub.CheckoutSessionId,
CustomerID: sub.CustomerID,
VideoNum: videoNum,
}
}
}
// 设置 SettlementAmount 并追加到主订单中
for orderAddNo, addInfo := range addMap {
if orderAddNo == record.OrderNo {
addInfo.SettlementAmount = record.TotalAmount
} else {
addInfo.SettlementAmount = addInfo.Amount
}
orderItem.AddBundleInfo = append(orderItem.AddBundleInfo, addInfo)
}
res.BundleInfo = append(res.BundleInfo, orderItem)
}
res.Total = int32(count)
res.Page = req.Page
res.PageSize = req.PageSize
return res, nil
}
func OrderListByOrderNo(req *bundle.OrderInfoByOrderNoRequest) (*bundle.OrderInfoByOrderNoResp, error) {
if req == nil || req.OrderNo == "" {
return nil, errors.New("invalid request")
}
var addOrder []*model.BundleOrderValueAdd
if err := app.ModuleClients.BundleDB.Model(&model.BundleOrderValueAdd{}).
Where("order_no = ?", req.OrderNo).
Find(&addOrder).Error; err != nil {
return nil, err
}
if len(addOrder) == 0 {
return &bundle.OrderInfoByOrderNoResp{}, nil
}
//订单类型 1:套餐 2:单独购买
userID, err := strconv.ParseInt(addOrder[0].CustomerID, 10, 64)
if err != nil {
return nil, err
}
res := &bundle.OrderInfoByOrderNoResp{
Type: int32(addOrder[0].Source),
UserId: uint64(userID),
OrderUUID: addOrder[0].OrderUUID,
UserName: addOrder[0].CustomerName,
}
for _, item := range addOrder {
switch item.ServiceType {
case 1:
res.VideoNumber += item.Num // 使用 += 而不是直接赋值
case 2:
res.ImageNumber += item.Num
case 3:
res.DataNumber += item.Num
case 4:
res.AccountNumber += item.Num
case 5:
res.Duration += item.Num
res.Unit = item.Unit // 如果有多个duration记录最后一个unit会覆盖前面的
}
}
return res, nil
}
// 对账单
func GetReconciliationList(req *bundle.GetReconciliationListReq) (*bundle.GetReconciliationListResp, error) {
var records []*model.Reconciliation
res := &bundle.GetReconciliationListResp{
Page: req.Page,
PageSize: req.PageSize,
}
modelObj := app.ModuleClients.BundleDB.Model(&model.Reconciliation{})
if len(req.UserIDS) != 0 {
modelObj = modelObj.Where("user_id in (?)", req.UserIDS)
}
if req.UserName != "" {
modelObj = modelObj.Where("user_name like ?", "%"+req.UserName+"%")
}
if req.BundleName != "" {
modelObj = modelObj.Where("bundle_name like ?", "%"+req.BundleName+"%")
}
if req.PayStatus != 0 {
modelObj = modelObj.Where("pay_status = ?", req.PayStatus)
}
if req.PayChannel != 0 {
modelObj = modelObj.Where("pay_channel = ?", req.PayChannel)
}
if req.BundleOrderOn != "" {
modelObj = modelObj.Where("bundle_order_on like ?", "%"+req.BundleOrderOn+"%")
}
if req.BundleAddOrderOn != "" {
modelObj = modelObj.Where("bundle_add_order_on like ?", "%"+req.BundleAddOrderOn+"%")
}
if req.CreatedStart != "" && req.CreatedEnd != "" {
modelObj = modelObj.Where("created_at between ? and ?", req.CreatedStart, req.CreatedEnd)
}
if req.PayTimeStart != "" && req.PayTimeEnd != "" {
modelObj = modelObj.Where("pay_time between ? and ?", req.PayTimeStart, req.PayTimeEnd)
}
if req.SerialNumber != "" {
modelObj = modelObj.Where("serial_number like ?", "%"+req.SerialNumber+"%")
}
if err := modelObj.Count(&res.Total).Error; err != nil {
return nil, fmt.Errorf("查询总数失败: %v", err)
}
// 无数据时提前返回
if res.Total == 0 {
return res, nil
}
offset := (req.Page - 1) * req.PageSize
if err := modelObj.Offset(int(offset)).Limit(int(req.PageSize)).Order("created_at desc").Find(&records).Error; err != nil {
return nil, fmt.Errorf("查询记录失败: %v", err)
}
// 转换结果
if err := copier.Copy(&res.List, records); err != nil {
return nil, fmt.Errorf("数据转换失败: %v", err)
}
return res, nil
}
func CreateReconciliation(req *bundle.ReconciliationInfo) (res *bundle.CommonResponse, err error) {
if req.SerialNumber != "" {
var existing model.Reconciliation
err = app.ModuleClients.BundleDB.Where("serial_number = ?", req.SerialNumber).First(&existing).Error
if err == nil {
// 说明这笔流水存在对账单
return &bundle.CommonResponse{Msg: "创建对账单成功"}, nil
}
}
record := &model.Reconciliation{
BundleOrderOn: req.BundleOrderOn,
BundleAddOrderOn: req.BundleAddOrderOn,
UserID: req.UserID,
UserName: req.UserName,
UserTel: req.UserTel,
BundleName: req.BundleName,
PayAmount: req.PayAmount,
CurrencyType: int(req.CurrencyType),
PayChannel: int(req.PayChannel),
PayTime: req.PayTime,
PayStatus: int(req.PayStatus),
SerialNumber: req.SerialNumber,
CreationTime: time.Now().Format("2006-01-02 15:04:05"),
HandlingFee: req.HandlingFee,
}
// 创建记录
if err := app.ModuleClients.BundleDB.Create(record).Error; err != nil {
return nil, fmt.Errorf("创建对账单失败: %v", err)
}
// 返回成功响应
return &bundle.CommonResponse{Msg: "创建对账单成功"}, nil
}
func UpdateReconciliation(req *bundle.ReconciliationInfo) (res *bundle.CommonResponse, err error) {
var existing model.Reconciliation
if err := app.ModuleClients.BundleDB.Where("id = ?", req.ID).First(&existing).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, errors.New("对账单记录不存在")
}
return nil, fmt.Errorf("查询对账单失败: %v", err)
}
updates := model.Reconciliation{
BundleOrderOn: req.BundleOrderOn,
BundleAddOrderOn: req.BundleAddOrderOn,
UserName: req.UserName,
UserTel: req.UserTel,
BundleName: req.BundleName,
PayAmount: req.PayAmount,
CurrencyType: int(req.CurrencyType),
PayChannel: int(req.PayChannel),
PayTime: req.PayTime,
PayStatus: int(req.PayStatus),
SerialNumber: req.SerialNumber,
HandlingFee: req.HandlingFee,
}
if err := app.ModuleClients.BundleDB.Model(&existing).Updates(updates).Error; err != nil {
return nil, fmt.Errorf("更新对账单失败: %v", err)
}
// 返回成功响应
return &bundle.CommonResponse{Msg: "更新成功"}, nil
}
func OnlyAddValueListByOrderNo(req *bundle.OnlyAddValueListByOrderNoRequest) (res *bundle.OnlyAddValueListByOrderNoResp, err error) {
response := new(bundle.OnlyAddValueListByOrderNoResp)
response.AddBundleInfos = make([]*bundle.AddBundleInfo, 0)
addBundles := make([]model.BundleOrderValueAdd, 0)
err = app.ModuleClients.BundleDB.Model(model.BundleOrderValueAdd{}).Where("deleted_at is null and source = 2 and order_no = ?", req.OrderNo).Find(&addBundles).Error
if err != nil {
return res, commonErr.ReturnError(err, "增值订单信息", "获取增值订单信息失败: ")
}
for _, addBundle := range addBundles {
response.AddBundleInfos = append(response.AddBundleInfos, &bundle.AddBundleInfo{
CheckOutSessionId: addBundle.CheckoutSessionId,
Amount: float32(addBundle.Amount),
OrderNo: addBundle.OrderNo,
PaymentStatus: int32(addBundle.PaymentStatus),
CustomerID: addBundle.CustomerID,
})
}
// 返回成功响应
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
if err = app.ModuleClients.BundleDB.Model(&model.BundleOrderValueAdd{}).
Where("order_no = ? AND payment_status = 2 and customer_id = ?", req.OrderNo, req.UserID).
Find(&paidServices).Error; err != nil {
res.Msg = msg.ErrorUpdateOrderInfo
return res, commonErr.ReturnError(err, msg.ErrorUpdateOrderInfo, "查询增值服务支付状态失败: ")
}
if len(paidServices) > 0 {
res.Msg = "订单已支付,无法删除"
return res, nil
}
if err = app.ModuleClients.BundleDB.Where("order_no = ?", req.OrderNo).
Delete(&model.BundleOrderValueAdd{}).Error; err != nil {
res.Msg = msg.ErrorDeleteOrderInfo
return res, commonErr.ReturnError(err, msg.ErrorDeleteOrderInfo, "删除增值服务失败: ")
}
var order model.BundleOrderRecords
if err = app.ModuleClients.BundleDB.Model(&model.BundleOrderRecords{}).
Where("order_no = ? and customer_id = ?", req.OrderNo, req.UserID).
First(&order).Error; err != nil {
if !errors.Is(err, gorm.ErrRecordNotFound) {
return nil, nil
}
} else if order.PayType == 2 {
res.Msg = "订单已支付,无法删除"
return res, nil
}
if err = app.ModuleClients.BundleDB.Where("order_no = ?", order.OrderNo).
Delete(&model.BundleOrderRecords{}).Error; err != nil {
res.Msg = msg.ErrorDeleteOrderInfo
return res, commonErr.ReturnError(err, msg.ErrorDeleteOrderInfo, "删除套餐订单服务失败: ")
}
res.Msg = msg.SuccessDeletedOrderInfo
return res, nil
}
func ListUnfinishedInfos(req *bundle.AutoCreateUserAndOrderRequest) (res *bundle.UnfinishedInfos, err error) {
res = new(bundle.UnfinishedInfos)
res.UnfinishedInfos = make([]*bundle.UnfinishedInfo, 0)
// TODO 0.捞出指定数量的数据
infos := make([]*model.FieePaymentAuto, 0)
query := app.ModuleClients.BundleDB.Where("deleted_at is null")
if req.Num != 0 {
query.Limit(int(req.Num))
}
err = query.Find(&infos).Error
if err != nil {
return nil, err
}
for _, info := range infos {
unfinishedInfo := new(bundle.UnfinishedInfo)
unfinishedInfo.ID = uint32(info.ID)
unfinishedInfo.UserNum = info.UserNum
unfinishedInfo.UserName = info.UserName
unfinishedInfo.UserTelArea = info.UserTelArea
unfinishedInfo.UserTel = info.UserTel
unfinishedInfo.UserSex = info.UserSex
unfinishedInfo.Nationality = info.Nationality
unfinishedInfo.PlaceOfResidence = info.PlaceOfResidence
unfinishedInfo.DocumentType = int32(info.DocumentType)
unfinishedInfo.UserIdCardFrontUrl = info.UserIdCardFrontUrl
unfinishedInfo.UserIdCardReverseUrl = info.UserIdCardReverseUrl
unfinishedInfo.UserIdCardValidity = info.UserIdCardValidity
unfinishedInfo.OrderNo = info.OrderNo
unfinishedInfo.OrderPayAmount = info.OrderPayAmount
unfinishedInfo.OrderSettlementAmount = info.OrderSettlementAmount
unfinishedInfo.OrderFeeAmount = info.OrderFeeAmount
unfinishedInfo.OrderPayCurrency = info.OrderPayCurrency
unfinishedInfo.OrderAccountCurrency = info.OrderAccountCurrency
unfinishedInfo.PayTime = info.PayTime.Format("2006-01-02 15:04:05")
res.UnfinishedInfos = append(res.UnfinishedInfos, unfinishedInfo)
}
return res, nil
}
func SoftDeleteUnfinishedInfo(req *bundle.SoftDeleteUnfinishedInfoRequest) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
exist := new(model.FieePaymentAuto)
// 查询未处理的数据
err = app.ModuleClients.BundleDB.Model(&model.FieePaymentAuto{}).
Where("id = ?", req.ID).
First(&exist).Error
if err != nil {
return nil, errors.New("数据不存在")
}
if err = app.ModuleClients.BundleDB.Where("id = ?", req.ID).
Delete(&model.FieePaymentAuto{}).Error; err != nil {
return res, errors.New("删除自动导入表数据失败")
}
return res, nil
}

View File

@ -1,176 +0,0 @@
package logic
import (
"errors"
"micro-bundle/internal/dao"
"micro-bundle/internal/model"
"micro-bundle/pb/bundle"
"time"
"dubbo.apache.org/dubbo-go/v3/common/logger"
"github.com/jinzhu/copier"
"github.com/samber/lo"
)
func BundleExtend(req *bundle.BundleExtendRequest) (*bundle.BundleExtendResponse, error) {
data := model.BundleExtensionRecords{}
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,
}); err != nil {
return nil, errors.New("用户没有余量信息")
}
err := dao.AddBundleExtendRecord(data)
if err != nil {
logger.Error(err)
return nil, errors.New("创建扩展记录失败")
}
return nil, nil
}
func BundleExtendRecordsList(req *bundle.BundleExtendRecordsListRequest) (*bundle.BundleExtendRecordsListResponse, error) {
data, total, err := dao.GetBundleExtendRecordList(req)
if err != nil {
logger.Error(err)
return nil, errors.New("查询失败")
}
resp := &bundle.BundleExtendRecordsListResponse{}
resp.Total = total
resp.Data = lo.Map(data, func(m model.BundleExtendRecordItemPo, _ int) *bundle.BundleExtendRecordItem {
result := &bundle.BundleExtendRecordItem{}
copier.Copy(result, &m)
result.CreatedAt = uint64(m.CreatedAt.UnixMilli())
return result
})
return resp, nil
}
func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (*bundle.GetBundleBalanceListResp, error) {
data, total, err := dao.GetBundleBalanceList(req)
if err != nil {
logger.Error(err)
return nil, errors.New("查询失败")
}
resp := &bundle.GetBundleBalanceListResp{}
resp.Total = total
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)
if m.OrderUUID != "" {
result.Bought = 2
} else {
result.Bought = 1
}
result.ExpiredTime = t.UnixMilli()
return result
})
return resp, nil
}
func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (*bundle.GetBundleBalanceByUserIdResp, error) {
data, err := dao.GetBundleBalanceByUserId(req)
if err != nil {
logger.Error(err)
return nil, errors.New("查询失败")
}
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("操作失败")
}
return nil, dao.AddBundleBalanceByUserId(data)
}
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("操作失败")
}
err := dao.CreateBundleBalance(data)
if err != nil {
logger.Error(err)
return nil, errors.New("创建余量信息失败")
}
return nil, nil
}
func GetUsedRecord(req *bundle.GetUsedRecordListReq) (*bundle.GetUsedRecordListResp, error) {
data, total, err := dao.GetUsedRecord(req)
if err != nil {
logger.Error(err)
return nil, errors.New("查询失败")
}
resp := &bundle.GetUsedRecordListResp{}
resp.Total = total
resp.Data = lo.Map(data, func(m model.CostLogPo, _ int) *bundle.WorkCastItem {
result := &bundle.WorkCastItem{}
copier.Copy(result, &m)
return result
})
return resp, nil
}
func GetImageWorkDetail(req *bundle.GetImageWorkDetailReq) (*bundle.GetImageWorkDetailResp, error) {
data, err := dao.GetImageWorkDetail(req)
if err != nil {
logger.Error(err)
return nil, errors.New("查询失败")
}
result := &bundle.GetImageWorkDetailResp{}
err = copier.Copy(result, &data)
return result, err
}
func GetVedioWorkDetail(req *bundle.GetVedioWorkDetailReq) (*bundle.GetVedioeWorkDetailResp, error) {
data, err := dao.GetVedioWorkDetail(req)
if err != nil {
logger.Error(err)
return nil, errors.New("查询失败")
}
result := &bundle.GetVedioeWorkDetailResp{}
err = copier.Copy(result, &data)
return result, err
}
func ToBeComfirmedWorks(req *bundle.ToBeComfirmedWorksReq) (*bundle.ToBeComfirmedWorksResp, error) {
data, total, unconfirmed, err := dao.ToBeComfirmedWorks(req)
if err != nil {
logger.Error(err)
return nil, errors.New("查询失败")
}
result := &bundle.ToBeComfirmedWorksResp{
Total: total,
Unconfirmed: unconfirmed,
}
result.Data = lo.Map(data, func(m model.CastWorkLog, _ int) *bundle.WorkItem {
result := &bundle.WorkItem{}
copier.Copy(result, &m)
return result
})
return result, nil
}
func ConfirmWork(req *bundle.ConfirmWorkReq) (*bundle.ConfirmWorkResp, error) {
return nil, dao.ConfirmWork(req)
}

View File

@ -9,12 +9,12 @@ import (
"micro-bundle/pkg/msg"
"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) {

View File

@ -1,69 +1,25 @@
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) {
func CreateOrderRecord(req *bundle.OrderRecord) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
orderUUID := app.ModuleClients.SfNode.Generate().Base64()
orderNo := utils.GetOrderNo()
if req.OrderNo != "" {
orderNo = req.OrderNo
}
var addRecords []model.BundleOrderValueAdd
for _, i := range req.AddRecords {
addRecords = append(addRecords, model.BundleOrderValueAdd{
UUID: app.ModuleClients.SfNode.Generate().Base64(),
OrderNo: orderNo,
OrderUUID: orderUUID,
CustomerID: req.CustomerID,
CustomerNum: req.CustomerNum,
CustomerName: req.CustomerName,
ServiceType: i.ServiceType,
CurrencyType: i.CurrencyType,
Amount: float64(i.Amount),
Num: i.Num,
Unit: i.Unit,
ValueAddUUID: i.ValueUid,
Source: int(i.Source),
PaymentStatus: int(i.PaymentStatus),
SignContract: req.SignContract,
Signature: req.Signature,
SignedTime: req.SignedTime,
Snapshot: req.Snapshot,
HandlingFee: i.HandlingFee,
})
}
orderRecord := &model.BundleOrderRecords{
UUID: orderUUID,
OrderNo: orderNo,
BundleUUID: req.BundleUuid,
BundleName: req.BundleName,
CustomerID: req.CustomerID,
CustomerNum: req.CustomerNum,
CustomerName: req.CustomerName,
Amount: req.Amount,
AmountType: req.AmountType,
TotalAmount: req.TotalAmount,
SignContract: req.SignContract,
Signature: req.Signature,
SignedTime: req.SignedTime,
PayType: int64(req.PayType),
PayTime: req.PayTime,
Status: req.Status,
ContractNo: req.ContractNo,
BundleCommonUid: req.BundleCommonUid,
FinancialConfirmation: model.ConfirmationNotConfirmed,
ExpirationTime: req.ExpirationTime,
Language: req.Language,
BundleOrderValueAdd: addRecords,
}
orderRecord := new(model.BundleOrderRecords)
_ = copier.CopyWithOption(&orderRecord, req, copier.Option{DeepCopy: true})
orderRecord.UUID = app.ModuleClients.SfNode.Generate().Base64()
orderRecord.OrderNo = utils.GetOrderNo()
orderRecord.BundleUUID = req.BundleUuid
orderRecord.ValueAddBundleUUID = req.ValueAddBundleUuid
orderRecord.FinancialConfirmation = model.ConfirmationNotConfirmed
res, err = dao.CreateOrderRecord(orderRecord)
return
}
@ -114,66 +70,3 @@ func UpdateFinancialConfirmationStatus(req *bundle.FinancialConfirmationRequest)
res.Msg = "更新财务确认状态成功"
return
}
func PackagePriceAndTime(req *bundle.OrderRecord) (res *bundle.PackagePriceAndTimeResponse, err error) {
res = new(bundle.PackagePriceAndTimeResponse)
res, err = dao.PackagePriceAndTime(req)
return
}
func CreateOrderAddRecord(req *bundle.OrderAddRecord) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
res, err = dao.CreateOrderAddRecord(req)
return
}
func OrderRecordsListV2(req *bundle.OrderRecordsRequestV2) (res *bundle.OrderRecordsResponseV2, err error) {
res = new(bundle.OrderRecordsResponseV2)
res, err = dao.OrderRecordsListV2(req)
return
}
func OrderListByOrderNo(req *bundle.OrderInfoByOrderNoRequest) (res *bundle.OrderInfoByOrderNoResp, err error) {
res = new(bundle.OrderInfoByOrderNoResp)
res, err = dao.OrderListByOrderNo(req)
return
}
func GetReconciliationList(req *bundle.GetReconciliationListReq) (res *bundle.GetReconciliationListResp, err error) {
res = new(bundle.GetReconciliationListResp)
res, err = dao.GetReconciliationList(req)
return
}
func CreateReconciliation(req *bundle.ReconciliationInfo) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
res, err = dao.CreateReconciliation(req)
return
}
func UpdateReconciliation(req *bundle.ReconciliationInfo) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
res, err = dao.UpdateReconciliation(req)
return
}
func OnlyAddValueListByOrderNo(req *bundle.OnlyAddValueListByOrderNoRequest) (res *bundle.OnlyAddValueListByOrderNoResp, err error) {
res = new(bundle.OnlyAddValueListByOrderNoResp)
res, err = dao.OnlyAddValueListByOrderNo(req)
return
}
func UpdateReconciliationStatusBySerialNumber(req *bundle.UpdateStatusAndPayTimeBySerialNumber) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
res, err = dao.UpdateReconciliationStatusBySerialNumber(req)
return
}
func DeleteValueAddService(req *bundle.DeleteValueAddServiceRequest) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
res, err = dao.DeleteValueAddService(req)
return
}
func ListUnfinishedInfos(req *bundle.AutoCreateUserAndOrderRequest) (res *bundle.UnfinishedInfos, err error) {
res = new(bundle.UnfinishedInfos)
res, err = dao.ListUnfinishedInfos(req)
return
}
func SoftDeleteUnfinishedInfo(req *bundle.SoftDeleteUnfinishedInfoRequest) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
res, err = dao.SoftDeleteUnfinishedInfo(req)
return
}

View File

@ -165,18 +165,7 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
price, parseErr1 := strconv.ParseFloat(option.Price, 32)
if parseErr1 != nil {
fmt.Println("优惠单价转换失败: ", parseErr1)
return res, errors.New("单价不能为空: " + parseErr1.Error())
}
if option.TotalPrice == "" {
if option.Symbol == "=" {
return res, errors.New("总价不能为空")
}
option.TotalPrice = "0"
}
totalPrice, parseErr2 := strconv.ParseFloat(option.TotalPrice, 32)
if parseErr2 != nil {
fmt.Println("总价转换失败: ", parseErr2)
return res, errors.New("总价转换失败: " + parseErr2.Error())
return res, errors.New("优惠单价转换失败")
}
if option.Num < 0 || option.Num > 99 {
return res, errors.New("数量参数需为0-99")
@ -185,11 +174,10 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
return res, errors.New("优惠单价需小于等于原价")
}
options = append(options, &model.PriceOption{
Id: int32(index),
Num: option.Num,
Symbol: option.Symbol,
Price: float32(price),
TotalPrice: float32(totalPrice),
Id: int32(index),
Num: option.Num,
Symbol: option.Symbol,
Price: float32(price),
})
index++
}
@ -370,12 +358,7 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
price := decimal.NewFromFloat(float64(option.Price))
num := decimal.NewFromInt(int64(option.Num))
totalPrice := decimal.NewFromFloat(float64(option.TotalPrice))
if !totalPrice.IsZero() {
saveAmount = (original.Mul(num)).Sub(totalPrice)
} else {
saveAmount = original.Sub(price).Mul(num)
}
saveAmount = original.Sub(price).Mul(num)
case 2:
//original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
//price := decimal.NewFromFloat(float64(option.Price))
@ -388,7 +371,6 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
Num: option.Num,
Symbol: option.Symbol,
Price: fmt.Sprintf("%.2f", option.Price),
TotalPrice: fmt.Sprintf("%.2f", option.TotalPrice),
SaveAmount: saveAmount.StringFixed(2),
})
}
@ -434,12 +416,7 @@ func ValueAddServiceDetail(req *bundle.ValueAddServiceDetailRequest) (res *bundl
original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
price := decimal.NewFromFloat(float64(opt.Price))
num := decimal.NewFromInt(int64(opt.Num))
totalPrice := decimal.NewFromFloat(float64(opt.TotalPrice))
if !totalPrice.IsZero() {
saveAmount = (original.Mul(num)).Sub(totalPrice)
} else {
saveAmount = original.Sub(price).Mul(num)
}
saveAmount = original.Sub(price).Mul(num)
case 2:
//original := decimal.NewFromFloat(float64(serviceLang.OriginalPrice))
//price := decimal.NewFromFloat(float64(opt.Price))
@ -452,7 +429,6 @@ func ValueAddServiceDetail(req *bundle.ValueAddServiceDetailRequest) (res *bundl
Num: opt.Num,
Symbol: opt.Symbol,
Price: fmt.Sprintf("%.2f", opt.Price),
TotalPrice: fmt.Sprintf("%.2f", opt.TotalPrice),
SaveAmount: saveAmount.StringFixed(2),
})
}
@ -523,12 +499,7 @@ func ValueAddServiceDetailByUuidAndLanguage(req *bundle.ValueAddServiceDetailReq
original := decimal.NewFromFloat(float64(detail.OriginalPrice))
price := decimal.NewFromFloat(float64(opt.Price))
num := decimal.NewFromInt(int64(opt.Num))
totalPrice := decimal.NewFromFloat(float64(opt.TotalPrice))
if !totalPrice.IsZero() {
saveAmount = (original.Mul(num)).Sub(totalPrice)
} else {
saveAmount = original.Sub(price).Mul(num)
}
saveAmount = original.Sub(price).Mul(num)
case 2:
//original := decimal.NewFromFloat(float64(detail.OriginalPrice))
//price := decimal.NewFromFloat(float64(opt.Price))
@ -541,7 +512,6 @@ func ValueAddServiceDetailByUuidAndLanguage(req *bundle.ValueAddServiceDetailReq
Num: opt.Num,
Symbol: opt.Symbol,
Price: fmt.Sprintf("%.2f", opt.Price),
TotalPrice: fmt.Sprintf("%.2f", opt.TotalPrice),
SaveAmount: saveAmount.StringFixed(2),
})
}
@ -616,12 +586,7 @@ func BatchGetValueAddServiceLang(req *bundle.BatchGetValueAddServiceLangRequest)
original := decimal.NewFromFloat(float64(v.OriginalPrice))
price := decimal.NewFromFloat(float64(opt.Price))
num := decimal.NewFromInt(int64(opt.Num))
totalPrice := decimal.NewFromFloat(float64(opt.TotalPrice))
if !totalPrice.IsZero() {
saveAmount = (original.Mul(num)).Sub(totalPrice)
} else {
saveAmount = original.Sub(price).Mul(num)
}
saveAmount = original.Sub(price).Mul(num)
case 2:
//original := decimal.NewFromFloat(float64(v.OriginalPrice))
//price := decimal.NewFromFloat(float64(opt.Price))
@ -634,7 +599,6 @@ func BatchGetValueAddServiceLang(req *bundle.BatchGetValueAddServiceLangRequest)
Num: opt.Num,
Symbol: opt.Symbol,
Price: fmt.Sprintf("%.2f", opt.Price),
TotalPrice: fmt.Sprintf("%.2f", opt.TotalPrice),
SaveAmount: saveAmount.StringFixed(2),
})
}

View File

@ -1,8 +1,6 @@
package model
import (
"time"
"gorm.io/datatypes"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
@ -79,128 +77,3 @@ func (m *BundleToValueAddService) TableName() string {
func (m *BundleProfileHistory) TableName() string {
return "bundle_profile_history"
}
// 套餐扩容记录表
type BundleExtensionRecords struct {
gorm.Model
UserId int `gorm:"column:user_id;type:int(11);comment:艺人id;NOT NULL" json:"user_id"`
AccountAdditional uint `gorm:"column:account_additional;type:int(11) unsigned;comment:账号额外增加" json:"account_additional"`
VideoAdditional uint `gorm:"column:video_additional;type:int(11) unsigned;comment:图文额外增加" json:"video_additional"`
ImagesAdditional uint `gorm:"column:images_additional;type:int(11) unsigned;comment:图文额外增加" json:"images_additional"`
DataAdditional uint `gorm:"column:data_additional;type:int(11) unsigned;comment:数据额外增加" json:"data_additional"`
AvailableDurationAdditional uint `gorm:"column:available_duration_additional;type:int(11) unsigned;comment:可用时长增加" json:"available_duration_additional"`
Type int `gorm:"column:type;type:tinyint(4);comment:类型 1:手动操作 2:自行购买" json:"type"`
Remark string `gorm:"column:remark;type:text;comment:备注" json:"remark"`
AssociatedorderNumber string `gorm:"column:associated_order_number;type:varchar(256);comment:关联订单号" json:"associatedOrderNumber"`
OperatorId int `gorm:"column:operator_id;type:int(11);comment:操作人id" json:"operator_id"`
OperatorName string `gorm:"column:operator_name;type:varchar(256)" json:"operatorName"`
OperatorPhoneNumber string `gorm:"column:operator_phone_number;type:varchar(256)" json:"operatorPhoneNumber"`
TimeUnit uint `gorm:"column:time_unit;type:int(11) unsigned;comment:时间单位" json:"timeUnit"`
}
// TableName 表名称
func (*BundleExtensionRecords) TableName() string {
return "bundle_extension_records"
}
type BundleExtendRecordItemPo struct {
UserName string
UserPhoneNumber string
AccountAdditional int
ImagesAdditional int
DataAdditional int
VideoAdditional int
AvailableDurationAdditional uint `gorm:"column:available_duration_additional;type:int(11) unsigned;comment:可用时长增加" json:"available_duration_additional"`
Type int
Remark string
OperatorName string
OperatorPhoneNumber string
AssociatedOrderNumber string `gorm:"column:associated_order_number;type:varchar(256);comment:关联订单号" json:"associatedOrderNumber"`
TimeUnit uint `gorm:"column:time_unit;type:int(11) unsigned;comment:时间单位" json:"timeUnit"`
OrderUUID string
CreatedAt time.Time
}
type BundleExtendRecordItemDto struct {
ID uint `gorm:"primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt soft_delete.DeletedAt
UserId int `gorm:"column:user_id;type:int(11);comment:艺人id;NOT NULL" json:"user_id"`
AccountAdditional uint `gorm:"column:account_additional;type:int(11) unsigned;comment:账号额外增加" json:"account_additional"`
VideoAdditional uint `gorm:"column:video_additional;type:int(11) unsigned;comment:图文额外增加" json:"video_additional"`
ImagesAdditional uint `gorm:"column:images_additional;type:int(11) unsigned;comment:图文额外增加" json:"images_additional"`
DataAdditional uint `gorm:"column:data_additional;type:int(11) unsigned;comment:数据额外增加" json:"data_additional"`
AvailableDurationAdditional uint `gorm:"column:available_duration_additional;type:int(11) unsigned;comment:可用时长增加" json:"available_duration_additional"`
Type int `gorm:"column:type;type:tinyint(4);comment:类型 0:手动操作" json:"type"`
Remark string `gorm:"column:remark;type:text;comment:备注" json:"remark"`
AssociatedOrderNumber string `gorm:"column:associated_order_number;type:varchar(256);comment:关联增值服务订单号" json:"associated_order_number"`
OperatorId int `gorm:"column:operator_id;type:int(11);comment:操作人id" json:"operator_id"`
OperatorName string `gorm:"column:operator_name;type:varchar(256)" json:"operatorName"`
OperatorPhoneNumber string `gorm:"column:operator_phone_number;type:varchar(256)" json:"operatorPhoneNumber"`
UserName string `json:"userName" gorm:"column:user_name"`
UserPhoneNumber string `json:"userPhoneNumber" gorm:"column:user_phone_number"`
}
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"`
}
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"`
}
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"`
}
// TableName 表名称
func (*BundleBalance) TableName() string {
return "bundle_balance"
}

View File

@ -1,71 +1,38 @@
package model
import (
"encoding/json"
"gorm.io/gorm"
)
import "gorm.io/gorm"
// BundleOrderRecords struct
type BundleOrderRecords struct {
gorm.Model
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:UUID"`
OrderNo string `json:"orderNo" gorm:"column:order_no;type:varchar(1024);comment:交易编号"`
BundleUUID string `json:"bundleUUID" gorm:"column:bundle_uuid;type:varchar(1024);comment:套餐UUID"`
BundleName string `json:"bundleName" gorm:"column:bundle_name;type:varchar(2048);comment:套餐名"`
CustomerID string `json:"customerID" gorm:"column:customer_id;type:varchar(1024);comment:客户ID"`
CustomerNum string `json:"customerNum" gorm:"column:customer_num;type:varchar(1024);comment:客户编号"`
CustomerName string `json:"customerName" gorm:"column:customer_name;type:varchar(1024);comment:客户名"`
Amount float32 `json:"amount" gorm:"column:amount;type:decimal(12,2);comment:套餐金额"`
AmountType int64 `json:"amountType" gorm:"column:amount_type;type:int;comment:金额类型"`
ValueAddBundleUUID string `json:"valueAddBundleUUID" gorm:"column:value_add_bundle_uuid;type:varchar(1024);comment:增值套餐记录UUID"`
ValueAddBundleAmount float32 `json:"valueAddBundleAmount" gorm:"column:value_add_bundle_amount;type:decimal(12,2);comment:增值套餐金额"`
ValueAddOriginalPrice float32 `json:"valueAddOriginalPrice" gorm:"column:value_add_original_price;type:decimal(12,2);comment:原单价"`
ValueAddDiscountPrice float32 `json:"valueAddDiscountPrice" gorm:"column:value_add_discount_price;type:decimal(12,2);comment:优惠单价"`
ValueAddSavedAmount float32 `json:"valueAddSavedAmount" gorm:"column:value_add_saved_amount;type:decimal(12,2);comment:节省金额"`
TotalAmount float32 `json:"totalAmount" gorm:"column:total_amount;type:decimal(12,2);comment:总金额"`
Num int32 `json:"num" gorm:"column:num;type:int;comment:视频数量"`
SignContract string `json:"signContract" gorm:"column:sign_contract;type:varchar(1024);comment:签约合同"`
Signature string `json:"signature" gorm:"column:signature;type:text;comment:签字"`
SignedTime string `json:"signedTime" gorm:"column:signed_time;type:varchar(1024);comment:签约时间(北京时间)"`
PayType int64 `json:"payType" gorm:"column:pay_type;type:int;comment:支付类型"`
PayTime string `json:"payTime" gorm:"column:pay_time;type:varchar(1024);comment:支付时间(北京时间)"`
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"`
Status int64 `json:"status" gorm:"column:status;type:int;comment:状态 1:已签未支付 2:已签已支付"`
ContractNo string `json:"contractNo" gorm:"column:contract_no;type:varchar(1024);comment:合同编号"`
BundleCommonUid string `json:"bundleCommonUid" gorm:"column:bundle_common_uid;type:text;comment:套餐公共ID"`
AddBundleCommonUid string `json:"addBundleCommonUid" gorm:"column:add_bundle_common_uid;type:text;comment:附加套餐公共ID"`
FinancialConfirmation int32 `json:"financialConfirmation" gorm:"column:financial_confirmation;type:int;comment:财务确认 1:未确认 2:已确认"`
ExpirationTime string `json:"expirationTime" gorm:"column:expiration_time;comment:套餐过期时间"`
BundleCommonJson json.RawMessage `json:"bundle_common_json" gorm:"column:bundle_common_json;type:json;serializer:json;comment:套餐信息"`
Language string `gorm:"column:language;comment:语言" json:"language"`
BundleOrderValueAdd []BundleOrderValueAdd `gorm:"foreignKey:OrderUUID;references:UUID" json:"bundleOrderValueAdd"`
}
type BundleOrderValueAdd struct {
gorm.Model
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:UUID"`
OrderNo string `json:"orderNo" gorm:"column:order_no;type:varchar(1024);comment:交易编号"`
OrderUUID string `json:"orderUUID" gorm:"column:order_uuid;type:varchar(1024);comment:套餐UUID"`
CustomerID string `json:"customerID" gorm:"column:customer_id;type:varchar(1024);comment:客户ID"`
CustomerNum string `json:"customerNum" gorm:"column:customer_num;type:varchar(1024);comment:客户编号"`
CustomerName string `json:"customerName" gorm:"column:customer_name;type:varchar(1024);comment:客户名"`
ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长"`
CurrencyType int64 `json:"currencyType" gorm:"column:currency_type;type:int;comment:货币类型"`
Amount float64 `json:"amount" gorm:"column:amount;type:decimal(12,2);comment:金额"`
Num int32 `json:"num" gorm:"column:num;type:int;comment:数量"`
Unit string `json:"unit" gorm:"column:unit;type:varchar(1024);comment:单位 1个 2条 3天 4月 5年"`
ValueAddUUID string `json:"valueAddUUID" gorm:"column:value_add_uuid;type:varchar(1024);comment:增值服务UUID"`
Source int `json:"source" gorm:"column:source;comment:增加方式 1套餐 2单独购买 3拓展"`
Remark string `json:"remark" gorm:"column:remark;comment:备注"`
PaymentStatus int `json:"paymentStatus" gorm:"column:payment_status;comment:支付状态 1未支付 2已支付"`
PaymentTime string `gorm:"column:payment_time;comment:支付时间" json:"paymentTime"`
SignContract string `json:"signContract" gorm:"column:sign_contract;type:varchar(1024);comment:签约合同"`
Signature string `json:"signature" gorm:"column:signature;type:text;comment:签字"`
SignedTime string `json:"signedTime" gorm:"column:signed_time;type:varchar(1024);comment:签约时间(北京时间)"`
Snapshot string `gorm:"column:snapshot;comment:快照" json:"snapshot"` //订单快照
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"`
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:UUID"`
OrderNo string `json:"orderNo" gorm:"column:order_no;type:varchar(1024);comment:交易编号"`
BundleUUID string `json:"bundleUUID" gorm:"column:bundle_uuid;type:varchar(1024);comment:套餐UUID"`
BundleName string `json:"bundleName" gorm:"column:bundle_name;type:varchar(2048);comment:套餐名"`
CustomerID string `json:"customerID" gorm:"column:customer_id;type:varchar(1024);comment:客户ID"`
CustomerNum string `json:"customerNum" gorm:"column:customer_num;type:varchar(1024);comment:客户编号"`
CustomerName string `json:"customerName" gorm:"column:customer_name;type:varchar(1024);comment:客户名"`
Amount float32 `json:"amount" gorm:"column:amount;type:decimal(12,2);comment:套餐金额"`
AmountType int64 `json:"amountType" gorm:"column:amount_type;type:int;comment:金额类型"`
ValueAddBundleUUID string `json:"valueAddBundleUUID" gorm:"column:value_add_bundle_uuid;type:varchar(1024);comment:增值套餐记录UUID"`
ValueAddBundleAmount float32 `json:"valueAddBundleAmount" gorm:"column:value_add_bundle_amount;type:decimal(12,2);comment:增值套餐金额"`
ValueAddOriginalPrice float32 `json:"valueAddOriginalPrice" gorm:"column:value_add_original_price;type:decimal(12,2);comment:原单价"`
ValueAddDiscountPrice float32 `json:"valueAddDiscountPrice" gorm:"column:value_add_discount_price;type:decimal(12,2);comment:优惠单价"`
ValueAddSavedAmount float32 `json:"valueAddSavedAmount" gorm:"column:value_add_saved_amount;type:decimal(12,2);comment:节省金额"`
TotalAmount float32 `json:"totalAmount" gorm:"column:total_amount;type:decimal(12,2);comment:总金额"`
Num int32 `json:"num" gorm:"column:num;type:int;comment:视频数量"`
SignContract string `json:"signContract" gorm:"column:sign_contract;type:varchar(1024);comment:签约合同"`
Signature string `json:"signature" gorm:"column:signature;type:text;comment:签字"`
SignedTime string `json:"signedTime" gorm:"column:signed_time;type:varchar(1024);comment:签约时间(北京时间)"`
PayType int64 `json:"payType" gorm:"column:pay_type;type:int;comment:支付类型"`
PayTime string `json:"payTime" gorm:"column:pay_time;type:varchar(1024);comment:支付时间(北京时间)"`
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"`
Status int64 `json:"status" gorm:"column:status;type:int;comment:状态 1:已签未支付 2:已签已支付"`
ContractNo string `json:"contractNo" gorm:"column:contract_no;type:varchar(1024);comment:合同编号"`
BundleCommonUid string `json:"bundleCommonUid" gorm:"column:bundle_common_uid;type:text;comment:套餐公共ID"`
AddBundleCommonUid string `json:"addBundleCommonUid" gorm:"column:add_bundle_common_uid;type:text;comment:附加套餐公共ID"`
FinancialConfirmation int32 `json:"financialConfirmation" gorm:"column:financial_confirmation;type:int;comment:财务确认 1:未确认 2:已确认"`
}
// 财务确认状态

View File

@ -1,118 +0,0 @@
package model
import (
"gorm.io/plugin/soft_delete"
)
type CostLog struct {
Uuid string `gorm:"column:uuid;type:varchar(50);NOT NULL;primary_key;" json:"id"`
ArtistUuid string `gorm:"column:artist_uuid;type:varchar(50);NOT NULL;index:idx_artist_uuid;default:'';comment:艺人ID" json:"artistUuid"`
ArtistName string `gorm:"column:artist_name;type:varchar(50);NOT NULL;default:'';comment:艺人名称" json:"artistName"`
ArtistPhone string `gorm:"column:artist_phone;type:varchar(50);NOT NULL;default:'';comment:艺人手机号" json:"artistPhone"`
WorkUuid string `gorm:"column:work_uuid;type:varchar(50);NOT NULL;index:idx_work_uuid;default:'';comment:作品uuid" json:"workUuid"`
WorkCategory uint8 `gorm:"column:work_category;type:tinyint(1);NOT NULL;default:1;comment: 1 图文 2 视频" json:"workCategory"`
BundleUuid string `gorm:"column:bundle_uuid;type:varchar(50);NOT NULL;index:idx_bundle_uuid;default:'';comment:套餐ID uuid" json:"bundleUuid"`
BundleName string `gorm:"column:bundle_name;type:varchar(50);NOT NULL;default:'';comment:套餐名称" json:"bundleName"`
PlatformIds string `gorm:"column:platform_ids;type:json;NOT NULL;comment:发布平台ID集合" json:"platformIDs"`
MediaNames string `gorm:"column:media_names;type:varchar(600);NOT NULL;default:'';comment:自媒体账号名称集合" json:"mediaNames"`
MediaAccIDs string `gorm:"column:media_acc_ids;type:varchar(600);NOT NULL;default:'';comment:自媒体账号ID集合" json:"mediaAccIDs"`
WorkTitle string `gorm:"column:work_title;type:varchar(50);NOT NULL;" json:"workTitle"`
SubmitTime string `gorm:"column:submit_time;type:varchar(50);NOT NULL;default:'';comment:提交时间" json:"submitTime"`
OperatorName string `gorm:"column:operator_name;type:varchar(50);NOT NULL;default:'';comment:操作人名称" json:"operatorName"`
OperatorID string `gorm:"column:operator_id;type:varchar(50);NOT NULL;default:'';comment:操作人ID" json:"operatorID"`
OperatorPhone string `gorm:"column:operator_phone;type:varchar(50);NOT NULL;default:'';comment:操作人手机号" json:"operatorPhone"`
Status uint8 `gorm:"column:status;type:tinyint(1);NOT NULL;default:1;comment: 1 有效 2 失效" json:"status"`
CreatedAt int `gorm:"column:created_at;type:int(11);autoCreateTime" json:"createdAt"`
UpdatedAt int `gorm:"column:updated_at;type:int(11);autoCreateTime" json:"updatedAt"`
DeletedAt soft_delete.DeletedAt
}
func (CostLog) TableName() string {
return "cast_cost_log"
}
type CastWorkImage struct {
Uuid string `json:"uuid" gorm:"uuid"`
WorkUuid string `json:"work_uuid" gorm:"work_uuid"` // 作品uuid
ImageUrls string `json:"image_urls" gorm:"image_urls"` // 图片url集合
CreatedAt int64 `json:"created_at" gorm:"created_at"`
UpdatedAt int64 `json:"updated_at" gorm:"updated_at"`
DeletedAt int64 `json:"deleted_at" gorm:"deleted_at"`
}
// TableName 表名称
func (*CastWorkImage) TableName() string {
return "cast_work_image"
}
type CastWorkVideo struct {
Uuid string `json:"uuid" gorm:"uuid"`
WorkUuid string `json:"work_uuid" gorm:"work_uuid"` // 作品uuid
CoverUrl string `json:"cover_url" gorm:"cover_url"` // 封面url
VideoUrl string `json:"video_url" gorm:"video_url"` // 视频url
CreatedAt int64 `json:"created_at" gorm:"created_at"`
UpdatedAt int64 `json:"updated_at" gorm:"updated_at"`
DeletedAt int64 `json:"deleted_at" gorm:"deleted_at"`
}
// TableName 表名称
func (*CastWorkVideo) TableName() string {
return "cast_work_video"
}
// CastWork undefined
type CastWork struct {
Uuid string `json:"uuid" gorm:"uuid"`
ArtistUuid string `json:"artist_uuid" gorm:"artist_uuid"` // 艺人ID
MediaAccUserIds string `json:"media_acc_user_ids" gorm:"media_acc_user_ids"` // 自媒体账号user_ids集合
MediaNames string `json:"media_names" gorm:"media_names"` // 自媒体账号名称集合
ArtistName string `json:"artist_name" gorm:"artist_name"` // 艺人名称
ArtistPhone string `json:"artist_phone" gorm:"artist_phone"` // 艺人手机号
WorkCategory int8 `json:"work_category" gorm:"work_category"` // 1 图文 2 视频
SubmitTime string `json:"submit_time" gorm:"submit_time"` // 提交时间
StatusUpdateTime string `json:"status_update_time" gorm:"status_update_time"` // 状态更新时间
Status int8 `json:"status" gorm:"status"` // 1 待提交 2 审核中 3 审核失败 4 待艺人确认 5 艺人驳回 6 发布成功 7 发布失败
Title string `json:"title" gorm:"title"`
Content string `json:"content" gorm:"content"`
PublishConfig string `json:"publish_config" gorm:"publish_config"` // 发布配置
CreatedAt int64 `json:"created_at" gorm:"created_at"`
UpdatedAt int64 `json:"updated_at" gorm:"updated_at"`
DeletedAt int64 `json:"deleted_at" gorm:"deleted_at"`
Cost int8 `json:"cost" gorm:"cost"` // 1 消耗 2 未消耗
ConfirmRemark string `json:"confirm_remark" gorm:"confirm_remark"` // 艺人确认备注
ApprovalId string `json:"approval_id" gorm:"approval_id"` // 审批ID
}
// TableName 表名称
func (*CastWork) TableName() string {
return "cast_work"
}
type CastWorkLog struct {
Uuid string `gorm:"column:uuid;type:varchar(50);primary_key" json:"uuid"`
WorkUuid string `gorm:"column:work_uuid;type:varchar(50);comment:作品uuid;NOT NULL" json:"work_uuid"`
Title string `gorm:"column:title;type:varchar(50);NOT NULL" json:"title"`
Content string `gorm:"column:content;type:varchar(2000);NOT NULL" json:"content"`
WorkCategory int `gorm:"column:work_category;type:tinyint(1);default:1;comment: 1 图文 2 视频;NOT NULL" json:"work_category"`
UpdateTime string `gorm:"column:update_time;type:varchar(50);comment:更新时间;NOT NULL" json:"update_time"`
WorkStatus int `gorm:"column:work_status;type:tinyint(1);default:1;comment: 1 待提交 2 审核中 3 审核失败 4 待艺人确认 5 艺人驳回 6 发布成功 7 发布失败;NOT NULL" json:"work_status"`
PlatformIds string `gorm:"column:platform_ids;type:json;comment:发布平台ID集合 TIKTOK= 1, YOUTUBE = 2, INS = 3;NOT NULL" json:"platform_ids"`
ArtistName string `gorm:"column:artist_name;type:varchar(50);comment:艺人名称;NOT NULL" json:"artist_name"`
ArtistUuid string `gorm:"column:artist_uuid;type:varchar(50);comment:艺人ID;NOT NULL" json:"artist_uuid"`
MediaAccUserIds string `gorm:"column:media_acc_user_ids;type:json;comment:自媒体账号user_ids集合;NOT NULL" json:"media_acc_user_ids"`
MediaNames string `gorm:"column:media_names;type:varchar(600);comment:自媒体账号名称集合;NOT NULL" json:"media_names"`
CostType int `gorm:"column:cost_type;type:int(11)" json:"costType"`
ConfirmedAt int64 `gorm:"column:confirmed_at;type:int(11)" json:"confirmedAt"`
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"`
}
func (m *CastWorkLog) TableName() string {
return "cast_work_log"
}
type CostLogPo struct {
CostLog
CostType int `gorm:"column:cost_type;type:int(11)" json:"costType"`
}

View File

@ -1,29 +0,0 @@
package model
import (
"gorm.io/gorm"
"time"
)
// 用来自动导入 来创建用户和订单的 数据
type FieePaymentAuto struct {
gorm.Model
UserNum string `json:"userNum" gorm:"column:user_num;type:varchar(64);comment:用户编号"`
UserName string `json:"userName" gorm:"column:user_name;type:varchar(128);comment:用户姓名"`
UserTelArea string `json:"userTelArea" gorm:"column:user_tel_area;type:varchar(32);comment:用户手机号区号"`
UserTel string `json:"userTel" gorm:"column:user_tel;type:varchar(32);comment:用户手机号"`
UserSex string `json:"userSex" gorm:"column:user_sex;type:varchar(16);comment:用户性别"`
Nationality string `json:"nationality" gorm:"column:nationality;type:varchar(128);comment:国籍"`
PlaceOfResidence string `json:"placeOfResidence" gorm:"column:place_of_residence;type:varchar(512);comment:用户居住地"`
DocumentType int `json:"documentType" gorm:"column:document_type;type:varchar(512);comment:证件类型:1护照 2身份证 3驾驶证 4居住证 5自拍照 6社保卡"`
UserIdCardFrontUrl string `json:"userIdCardFrontUrl" gorm:"column:user_id_card_front_url;type:varchar(1024);comment:用户身份证正面"`
UserIdCardReverseUrl string `json:"userIdCardReverseUrl" gorm:"column:user_id_card_reverse_url;type:varchar(1024);comment:用户身份证反面"`
UserIdCardValidity string `json:"userIdCardValidity" gorm:"column:user_id_card_validity;type:varchar(64);comment:证件有效期"`
OrderNo string `json:"orderNo" gorm:"column:order_no;type:varchar(128);comment:订单编号"`
OrderPayAmount string `gorm:"column:order_pay_amount;type:decimal(20,2);comment:订单支付金额" json:"orderPayAmount"`
OrderSettlementAmount string `gorm:"column:order_settlement_amount;type:decimal(20,2);comment:订单结算金额" json:"orderSettlementAmount"`
OrderFeeAmount string `gorm:"column:order_fee_amount;type:decimal(20,2);comment:订单手续费金额" json:"orderFeeAmount"`
OrderPayCurrency string `json:"orderPayCurrency" gorm:"column:order_pay_currency;type:varchar(16);comment:支付时的币种cny人民币usd美元"`
OrderAccountCurrency string `json:"orderAccountCurrency" gorm:"column:order_account_currency;type:varchar(16);comment:账户上的币种: 暂时固定usd美元"`
PayTime time.Time `gorm:"column:pay_time;type:datetime;default:null;comment:支付成功时间" json:"payTime"`
}

View File

@ -1,21 +0,0 @@
package model
import "gorm.io/gorm"
type Reconciliation struct {
gorm.Model
BundleOrderOn string `gorm:"column:bundle_order_on;comment:套餐交易编号" json:"bundleOrderOn"`
BundleAddOrderOn string `gorm:"column:bundle_add_order_on;comment:增值套餐交易编号" json:"bundleAddOrderOn"`
UserID uint64 `gorm:"column:user_id;comment:艺人id" json:"userId"`
UserName string `gorm:"column:user_name;comment:艺人" json:"userName"`
UserTel string `gorm:"column:user_tel;comment:艺人手机号" json:"userTel"`
BundleName string `gorm:"column:bundle_name;comment:套餐名称" json:"bundleName"`
PayAmount float32 `gorm:"column:pay_amount;comment:支付金额" json:"payAmount"`
CurrencyType int `gorm:"column:currency_type;comment:币种1:人民币 2美元" json:"currencyType"`
PayChannel int `gorm:"column:pay_channel;comment:支付渠道" json:"payChannel"`
PayTime string `gorm:"column:pay_time;comment:支付渠道" json:"payTime"`
PayStatus int `gorm:"column:pay_status;comment:支付状态" json:"payStatus"`
SerialNumber string `gorm:"column:serial_number;comment:流水号" json:"serialNumber"`
CreationTime string `gorm:"column:creation_time;comment:创建时间" json:"creationTime"`
HandlingFee string `gorm:"column:handling_fee;comment:手续费" json:"handlingFee"`
}

View File

@ -51,7 +51,7 @@ type ValueAddServiceLang struct {
ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长"`
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:增值服务总价"` //总价模式不合理,该字段暂时无用
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:年"`
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:欧元"`
@ -74,11 +74,10 @@ type ValueAddServiceHistory struct {
type PriceOptions []*PriceOption
type PriceOption struct {
Id int32 `json:"id"`
Num int32 `json:"num"`
Symbol string `json:"symbol"` // 符号> < = >= <=
Price float32 `json:"price"` // 价格(根据priceMode决定是单价还是总价)
TotalPrice float32 `json:"totalPrice"` // 总价-新加
Id int32 `json:"id"`
Num int32 `json:"num"`
Symbol string `json:"symbol"` // 符号> < = >= <=
Price float32 `json:"price"` // 价格(根据priceMode决定是单价还是总价)
}
// 实现 driver.Valuer 接口
@ -151,7 +150,6 @@ func (m *ValueAddServiceHistory) TableName() string {
func (options PriceOptions) CalculatePrice(priceMode, target int32) (float32, error) {
for _, opt := range options {
match := false
last := false
switch opt.Symbol {
case "=":
match = target == opt.Num
@ -159,7 +157,6 @@ func (options PriceOptions) CalculatePrice(priceMode, target int32) (float32, er
match = target > opt.Num
case ">=":
match = target >= opt.Num
last = true
case "<":
match = target < opt.Num
case "<=":
@ -171,12 +168,6 @@ func (options PriceOptions) CalculatePrice(priceMode, target int32) (float32, er
if match {
switch priceMode { //1 单价模式
case 1:
if last {
return float32(target) * opt.Price, nil
}
if opt.TotalPrice > 0 {
return opt.TotalPrice, nil
}
return float32(target) * opt.Price, nil
case 2:
return opt.Price, nil

View File

@ -74,10 +74,6 @@ service Bundle {
rpc CreateReconciliation(ReconciliationInfo) returns (CommonResponse) {} //
rpc UpdateReconciliation(ReconciliationInfo) returns (CommonResponse) {} //
rpc UpdateReconciliationStatusBySerialNumber(UpdateStatusAndPayTimeBySerialNumber) returns (CommonResponse) {} //
//
rpc ListUnfinishedInfos(AutoCreateUserAndOrderRequest) returns (UnfinishedInfos) {} //
rpc SoftDeleteUnfinishedInfo(SoftDeleteUnfinishedInfoRequest) returns (CommonResponse) {} //
}
message DeleteValueAddServiceRequest{
string orderNo = 1;
@ -120,8 +116,6 @@ message ReconciliationInfo{
int32 payStatus = 12;
string serialNumber = 13;
uint64 userID = 14;
string handlingFee = 15;
string subNum = 16;
}
message OrderInfoByOrderNoRequest{
string orderNo = 1;
@ -160,7 +154,6 @@ message OrderCreateRecord{
string snapshot = 18 [json_name = "snapshot"];
int32 payType = 19 [json_name = "payType"];
repeated OrderCreateAddRecord addRecords = 20 [json_name = "addRecords"]; //
string orderNo = 21 [json_name = "orderNo"];
}
message OrderCreateAddRecord{
int32 serviceType = 1 [json_name = "serviceType"];
@ -171,7 +164,6 @@ message OrderCreateAddRecord{
string unit = 6 [json_name = "unit"];
int32 source = 7 [json_name = "source"];
int32 paymentStatus = 8 [json_name = "paymentStatus"];
string handlingFee = 9 [json_name = "handlingFee"];
}
message OrderRecordsRequestV2{
string customerName = 1;
@ -188,8 +180,6 @@ message OrderRecordsRequestV2{
int32 page = 12;
int32 pageSize = 13;
repeated int64 userIds = 14;
string bundlePayStart = 15;
string bundlePayEnd = 16;
}
message OrderRecordsResponseV2{
repeated OrderBundleRecordInfo bundleInfo = 1;
@ -207,15 +197,13 @@ message OrderBundleRecordInfo{
float amount = 7;
repeated OrderAddBundleRecordInfo addBundleInfo = 8;
int64 customerId = 9;
string payTime = 10;
string subNum = 11;
}
message OrderAddBundleRecordInfo{
string orderAddNo = 1;
float amount = 2;
float settlementAmount = 3;
int32 currencyType = 4;
string handlingFee = 5;
float handlingFee = 5;
float exchangeRate = 6;
string orderAddCreateAt = 7;
int32 addPayStatus = 8;
@ -223,7 +211,6 @@ message OrderAddBundleRecordInfo{
string snapshot = 10;
string CheckoutSessionId = 11;
string CustomerID = 12;
int32 videoNum = 13;
}
message PackagePriceAndTimeResponse{
float price = 1 [json_name = "price"];
@ -524,7 +511,6 @@ message ValueAddPriceOptions {
string symbol = 3 [json_name = "symbol"];
string price = 4 [json_name = "price"];
string saveAmount = 5 [json_name = "saveAmount"];
string totalPrice = 6 [json_name = "totalPrice"];
}
//
@ -614,9 +600,8 @@ message BundleExtendRecordItem{
uint64 createdAt = 9;
string remark = 10;
string associatedOrderNumber = 11;
uint32 timeUnit = 12;
string operatorName = 13;
string operatorPhoneNumber = 14;
string operatorName = 12;
string operatorPhoneNumber = 13;
}
message GetBundleBalanceListReq{
@ -707,12 +692,11 @@ message GetUsedRecordListReq{
string account = 3;
int32 platform = 4;
int32 type = 5;
string workTitle = 6;
string title = 6;
int64 submitTimeStart = 7;
int64 submitTimeEnd = 8;
int32 page = 9;
int32 pageSize = 10;
int32 costType = 11;
}
message GetUsedRecordListResp {
@ -736,7 +720,6 @@ message WorkCastItem{
string operatorName = 13; //
string operatorPhone = 14; //
uint32 status = 15; // 1 2
uint32 costType = 16;
}
message GetImageWorkDetailReq {
@ -780,7 +763,6 @@ message workItem{
int64 createdAt = 11; //
string artistName = 12;
string artistUuid = 13;
uint32 costType = 14;
}
message ToBeComfirmedWorksResp{
@ -845,38 +827,4 @@ message ConfirmWorkReq{
message ConfirmWorkResp{
}
message AutoCreateUserAndOrderRequest {
int32 num = 1; //
}
message UnfinishedInfos {
repeated UnfinishedInfo unfinishedInfos = 1;
}
message UnfinishedInfo {
uint32 ID = 1;
string userNum = 2;
string userName = 3;
string userTelArea = 4;
string userTel = 5;
string userSex = 6;
string nationality = 7;
string placeOfResidence = 8;
int32 documentType = 9;
string userIdCardFrontUrl = 10;
string userIdCardReverseUrl = 11;
string userIdCardValidity = 12;
string orderNo = 13;
string orderPayAmount = 14;
string orderSettlementAmount = 15;
string orderFeeAmount = 16;
string orderPayCurrency = 17;
string orderAccountCurrency = 18;
string payTime = 19;
}
message SoftDeleteUnfinishedInfoRequest {
uint32 ID = 1;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -7,8 +7,8 @@ import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "google.golang.org/protobuf/types/descriptorpb"
_ "github.com/mwitkow/go-proto-validators"
_ "google.golang.org/protobuf/types/descriptorpb"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)
@ -447,22 +447,3 @@ func (this *ConfirmWorkReq) Validate() error {
func (this *ConfirmWorkResp) Validate() error {
return nil
}
func (this *AutoCreateUserAndOrderRequest) Validate() error {
return nil
}
func (this *UnfinishedInfos) Validate() error {
for _, item := range this.UnfinishedInfos {
if item != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("UnfinishedInfos", err)
}
}
}
return nil
}
func (this *UnfinishedInfo) Validate() error {
return nil
}
func (this *SoftDeleteUnfinishedInfoRequest) Validate() error {
return nil
}

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.12.4
// - protoc v4.24.0--rc1
// source: pb/bundle.proto
package bundle
@ -50,11 +50,11 @@ type BundleClient interface {
OrderRecordsListV2(ctx context.Context, in *OrderRecordsRequestV2, opts ...grpc_go.CallOption) (*OrderRecordsResponseV2, common.ErrorWithAttachment)
OrderListByOrderNo(ctx context.Context, in *OrderInfoByOrderNoRequest, opts ...grpc_go.CallOption) (*OrderInfoByOrderNoResp, common.ErrorWithAttachment)
OnlyAddValueListByOrderNo(ctx context.Context, in *OnlyAddValueListByOrderNoRequest, opts ...grpc_go.CallOption) (*OnlyAddValueListByOrderNoResp, common.ErrorWithAttachment)
// 增值套餐
//增值套餐
CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment)
ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment)
ValueAddBundleDetail(ctx context.Context, in *ValueAddBundleDetailRequest, opts ...grpc_go.CallOption) (*ValueAddBundleDetailResponse, common.ErrorWithAttachment)
// 新增值服务
//新增值服务
SaveValueAddService(ctx context.Context, in *ValueAddServiceLang, opts ...grpc_go.CallOption) (*SaveResponse, common.ErrorWithAttachment)
ValueAddServiceList(ctx context.Context, in *ValueAddServiceListRequest, opts ...grpc_go.CallOption) (*ValueAddServiceListResponse, common.ErrorWithAttachment)
ValueAddServiceDetail(ctx context.Context, in *ValueAddServiceDetailRequest, opts ...grpc_go.CallOption) (*ValueAddServiceDetailResponse, common.ErrorWithAttachment)
@ -75,14 +75,11 @@ type BundleClient interface {
GetVedioWorkDetail(ctx context.Context, in *GetVedioWorkDetailReq, opts ...grpc_go.CallOption) (*GetVedioeWorkDetailResp, common.ErrorWithAttachment)
ToBeComfirmedWorks(ctx context.Context, in *ToBeComfirmedWorksReq, opts ...grpc_go.CallOption) (*ToBeComfirmedWorksResp, common.ErrorWithAttachment)
ConfirmWork(ctx context.Context, in *ConfirmWorkReq, opts ...grpc_go.CallOption) (*ConfirmWorkResp, common.ErrorWithAttachment)
// 对账单
//对账单
GetReconciliationList(ctx context.Context, in *GetReconciliationListReq, opts ...grpc_go.CallOption) (*GetReconciliationListResp, common.ErrorWithAttachment)
CreateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
UpdateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
UpdateReconciliationStatusBySerialNumber(ctx context.Context, in *UpdateStatusAndPayTimeBySerialNumber, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
// 查出没处理的数据
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)
}
type bundleClient struct {
@ -137,8 +134,6 @@ type BundleClientImpl struct {
CreateReconciliation func(ctx context.Context, in *ReconciliationInfo) (*CommonResponse, error)
UpdateReconciliation func(ctx context.Context, in *ReconciliationInfo) (*CommonResponse, error)
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)
}
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
@ -435,18 +430,6 @@ func (c *bundleClient) UpdateReconciliationStatusBySerialNumber(ctx context.Cont
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateReconciliationStatusBySerialNumber", in, out)
}
func (c *bundleClient) ListUnfinishedInfos(ctx context.Context, in *AutoCreateUserAndOrderRequest, opts ...grpc_go.CallOption) (*UnfinishedInfos, common.ErrorWithAttachment) {
out := new(UnfinishedInfos)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ListUnfinishedInfos", in, out)
}
func (c *bundleClient) SoftDeleteUnfinishedInfo(ctx context.Context, in *SoftDeleteUnfinishedInfoRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
out := new(CommonResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/SoftDeleteUnfinishedInfo", in, out)
}
// BundleServer is the server API for Bundle service.
// All implementations must embed UnimplementedBundleServer
// for forward compatibility
@ -473,11 +456,11 @@ type BundleServer interface {
OrderRecordsListV2(context.Context, *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
OrderListByOrderNo(context.Context, *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
// 增值套餐
//增值套餐
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
// 新增值服务
//新增值服务
SaveValueAddService(context.Context, *ValueAddServiceLang) (*SaveResponse, error)
ValueAddServiceList(context.Context, *ValueAddServiceListRequest) (*ValueAddServiceListResponse, error)
ValueAddServiceDetail(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
@ -498,14 +481,11 @@ type BundleServer interface {
GetVedioWorkDetail(context.Context, *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
ToBeComfirmedWorks(context.Context, *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
ConfirmWork(context.Context, *ConfirmWorkReq) (*ConfirmWorkResp, error)
// 对账单
//对账单
GetReconciliationList(context.Context, *GetReconciliationListReq) (*GetReconciliationListResp, error)
CreateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
UpdateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
UpdateReconciliationStatusBySerialNumber(context.Context, *UpdateStatusAndPayTimeBySerialNumber) (*CommonResponse, error)
// 查出没处理的数据
ListUnfinishedInfos(context.Context, *AutoCreateUserAndOrderRequest) (*UnfinishedInfos, error)
SoftDeleteUnfinishedInfo(context.Context, *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error)
mustEmbedUnimplementedBundleServer()
}
@ -655,12 +635,6 @@ func (UnimplementedBundleServer) UpdateReconciliation(context.Context, *Reconcil
func (UnimplementedBundleServer) UpdateReconciliationStatusBySerialNumber(context.Context, *UpdateStatusAndPayTimeBySerialNumber) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateReconciliationStatusBySerialNumber not implemented")
}
func (UnimplementedBundleServer) ListUnfinishedInfos(context.Context, *AutoCreateUserAndOrderRequest) (*UnfinishedInfos, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUnfinishedInfos not implemented")
}
func (UnimplementedBundleServer) SoftDeleteUnfinishedInfo(context.Context, *SoftDeleteUnfinishedInfoRequest) (*CommonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SoftDeleteUnfinishedInfo not implemented")
}
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
@ -2052,64 +2026,6 @@ func _Bundle_UpdateReconciliationStatusBySerialNumber_Handler(srv interface{}, c
return interceptor(ctx, in, info, handler)
}
func _Bundle_ListUnfinishedInfos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(AutoCreateUserAndOrderRequest)
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("ListUnfinishedInfos", 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_SoftDeleteUnfinishedInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(SoftDeleteUnfinishedInfoRequest)
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("SoftDeleteUnfinishedInfo", 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)
@ -2305,14 +2221,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "UpdateReconciliationStatusBySerialNumber",
Handler: _Bundle_UpdateReconciliationStatusBySerialNumber_Handler,
},
{
MethodName: "ListUnfinishedInfos",
Handler: _Bundle_ListUnfinishedInfos_Handler,
},
{
MethodName: "SoftDeleteUnfinishedInfo",
Handler: _Bundle_SoftDeleteUnfinishedInfo_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "pb/bundle.proto",

View File

@ -13,7 +13,7 @@ var Provider = wire.NewSet(NewBundleDB)
func NewBundleDB() *gorm.DB {
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"}, "")
bundleConfig.Data.BundleDB.DbName, "?charset=utf8mb4&parseTime=true"}, "")
DciDB := loadMysqlConn(connBundleDB)
return DciDB
}

View File

@ -51,10 +51,6 @@ func loadMysqlConn(conn string) *gorm.DB {
&model.BundleToValueAddService{},
&model.BundleProfileHistory{},
&model.ValueAddServiceHistory{},
&model.BundleOrderValueAdd{},
&model.BundleExtensionRecords{},
&model.BundleBalance{},
&model.Reconciliation{},
)
if err != nil {

View File

@ -51,16 +51,12 @@ const (
ErrorCreateOrderInfo = "创建订单信息失败"
SuccessCreateOrderInfo = "创建订单信息成功"
ErrorUpdateOrderInfo = "更新订单信息失败"
ErrorDeleteOrderInfo = "删除增值服务失败"
SuccessUpdateOrderInfo = "更新订单信息成功"
SuccessDeletedOrderInfo = "删除订单信息成功"
ErrorUpdateOrderInfo = "更新订单信息失败"
SuccessUpdateOrderInfo = "更新订单信息成功"
ErrorGetOrderInfo = "获取订单信息失败"
ErrorGetOrderList = "获取订单列表失败"
ErrorBundleNotFound = "套餐不存在"
ErrorDataConvert = "数据转换失败"
ErrorGetOrderList = "获取订单列表失败"
)
// 增值套餐信息

View File

@ -1,20 +0,0 @@
package utils
import "regexp"
func IsPhoneNumber(phone string) bool {
// 正则表达式匹配常见的电话号码格式
// 1. 11位手机号13x, 14x, 15x, 16x, 17x, 18x, 19x开头
// 2. 3-4位区号+7-8位号码可含-或空格分隔)
// 3. 国际号码(+开头)
pattern := `^(?:\+?[0-9]{1,4}[- ]?)?` + // 国际前缀
`(?:\([0-9]{1,4}\)[- ]?)?` + // 可能有括号的区号
`(?:[0-9]{7,15}|` + // 7-15位数字或
`1[3-9][0-9]{9})$` // 11位手机号
matched, err := regexp.MatchString(pattern, phone)
if err != nil {
return false
}
return matched
}