Compare commits
104 Commits
feat-zjy-i
...
main
Author | SHA1 | Date | |
---|---|---|---|
4098d590bf | |||
db58773aea | |||
b2a96ad465 | |||
6702083fd6 | |||
5da9d19112 | |||
87d46af603 | |||
15072f9e49 | |||
c72d45c020 | |||
f3c5cbff2a | |||
ebe59394cf | |||
5746dab3e0 | |||
6c4aeb8193 | |||
7200099204 | |||
c70c5913d4 | |||
414735bc54 | |||
3f5e4e3bc8 | |||
af4c370b84 | |||
9f7e2d1667 | |||
557739aeff | |||
91e1dfa196 | |||
2825ca826e | |||
90d088101c | |||
24cc34462e | |||
9b7fbe73fd | |||
1c6172a848 | |||
af7fa93b4d | |||
48dea8eaac | |||
761b9b656b | |||
e2d87cb5e0 | |||
6a6bd459e6 | |||
47473df3be | |||
fd908ec72b | |||
6e6f159b23 | |||
97f79df433 | |||
e037f91507 | |||
b35278771e | |||
38e7e1aac6 | |||
e33aaac2b9 | |||
430304cd1e | |||
b4520ccf94 | |||
74b5c28cc4 | |||
4dba6c7669 | |||
8271683614 | |||
26a4fe0413 | |||
be7e522219 | |||
fcb33cc715 | |||
3cb95a8f65 | |||
5dc0b1cbf5 | |||
0f6e0abf33 | |||
3d13747ad9 | |||
39ca08605e | |||
b4dd5d0778 | |||
ef6d40cf81 | |||
1c3e0b8f52 | |||
e85207132f | |||
6d34d7d4f2 | |||
e667837d6a | |||
09a4df2b21 | |||
d20cd6d41b | |||
0e1c8df1ee | |||
645770c9fc | |||
077f743e54 | |||
fe9173b872 | |||
41e28c9aed | |||
d54a3df245 | |||
e2962353b9 | |||
07326e3af8 | |||
c135849195 | |||
7488f76c08 | |||
bca6eb9009 | |||
8aab8ff4e6 | |||
857b7712ae | |||
adb956dacb | |||
e7f8993fa5 | |||
eaa48b9d5e | |||
bd59b2dc69 | |||
b063a38f76 | |||
6c4578b8aa | |||
9bf59916a6 | |||
2c49b28d0f | |||
3c964140f3 | |||
c20e90d45a | |||
25eed16be5 | |||
2d7269148a | |||
e9d74c99fb | |||
512bfe4d15 | |||
d2ef31f289 | |||
2ff956bb30 | |||
3ff698e94f | |||
130bb26ebf | |||
f672ecf670 | |||
2220a78c19 | |||
36aaa0a365 | |||
b86e759146 | |||
fa468e0130 | |||
403f065486 | |||
54326ebe01 | |||
9c6f1ae832 | |||
80e45457ec | |||
bc1bdf1fc0 | |||
817c685190 | |||
c3009b2086 | |||
cdf4b77aa7 | |||
7c2f3b5545 |
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
10
.idea/AugmentWebviewStateStore.xml
Normal file
10
.idea/AugmentWebviewStateStore.xml
Normal file
File diff suppressed because one or more lines are too long
9
.idea/fonchain-fiee.iml
Normal file
9
.idea/fonchain-fiee.iml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="Go" enabled="true" />
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
6
.idea/git_toolbox_blame.xml
Normal file
6
.idea/git_toolbox_blame.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GitToolBoxBlameSettings">
|
||||||
|
<option name="version" value="2" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/fonchain-fiee.iml" filepath="$PROJECT_DIR$/.idea/fonchain-fiee.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
13
README.md
13
README.md
@ -0,0 +1,13 @@
|
|||||||
|
## 测试服后台
|
||||||
|
http://172.16.100.99:9028/
|
||||||
|
13580848136
|
||||||
|
|
||||||
|
https://erp.fiee.com/older_list
|
||||||
|
13580848136
|
||||||
|
Aa.123456
|
||||||
|
|
||||||
|
测试h5
|
||||||
|
## https://saas-test.szjixun.cn
|
||||||
|
|
||||||
|
正式h5
|
||||||
|
https://saas.fiee.com
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-triple v1.0.8
|
// - protoc-gen-go-triple v1.0.8
|
||||||
// - protoc v4.24.0--rc1
|
// - protoc v3.12.4
|
||||||
// source: pb/bundle.proto
|
// source: pb/bundle.proto
|
||||||
|
|
||||||
package bundle
|
package bundle
|
||||||
@ -50,11 +50,11 @@ type BundleClient interface {
|
|||||||
OrderRecordsListV2(ctx context.Context, in *OrderRecordsRequestV2, opts ...grpc_go.CallOption) (*OrderRecordsResponseV2, common.ErrorWithAttachment)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
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)
|
ValueAddServiceDetail(ctx context.Context, in *ValueAddServiceDetailRequest, opts ...grpc_go.CallOption) (*ValueAddServiceDetailResponse, common.ErrorWithAttachment)
|
||||||
@ -75,7 +75,7 @@ type BundleClient interface {
|
|||||||
GetVedioWorkDetail(ctx context.Context, in *GetVedioWorkDetailReq, opts ...grpc_go.CallOption) (*GetVedioeWorkDetailResp, common.ErrorWithAttachment)
|
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)
|
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)
|
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)
|
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)
|
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)
|
UpdateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||||
@ -473,11 +473,11 @@ type BundleServer interface {
|
|||||||
OrderRecordsListV2(context.Context, *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
|
OrderRecordsListV2(context.Context, *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
|
||||||
OrderListByOrderNo(context.Context, *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
|
OrderListByOrderNo(context.Context, *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
|
||||||
OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
||||||
//增值套餐
|
// 增值套餐
|
||||||
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||||
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||||
ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||||
//新增值服务
|
// 新增值服务
|
||||||
SaveValueAddService(context.Context, *ValueAddServiceLang) (*SaveResponse, error)
|
SaveValueAddService(context.Context, *ValueAddServiceLang) (*SaveResponse, error)
|
||||||
ValueAddServiceList(context.Context, *ValueAddServiceListRequest) (*ValueAddServiceListResponse, error)
|
ValueAddServiceList(context.Context, *ValueAddServiceListRequest) (*ValueAddServiceListResponse, error)
|
||||||
ValueAddServiceDetail(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
|
ValueAddServiceDetail(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
|
||||||
@ -498,7 +498,7 @@ type BundleServer interface {
|
|||||||
GetVedioWorkDetail(context.Context, *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
|
GetVedioWorkDetail(context.Context, *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
|
||||||
ToBeComfirmedWorks(context.Context, *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
|
ToBeComfirmedWorks(context.Context, *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
|
||||||
ConfirmWork(context.Context, *ConfirmWorkReq) (*ConfirmWorkResp, error)
|
ConfirmWork(context.Context, *ConfirmWorkReq) (*ConfirmWorkResp, error)
|
||||||
//对账单
|
// 对账单
|
||||||
GetReconciliationList(context.Context, *GetReconciliationListReq) (*GetReconciliationListResp, error)
|
GetReconciliationList(context.Context, *GetReconciliationListReq) (*GetReconciliationListResp, error)
|
||||||
CreateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
|
CreateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
|
||||||
UpdateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
|
UpdateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
|
||||||
|
2311
api/cast/cast.pb.go
2311
api/cast/cast.pb.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-triple v1.0.8
|
// - protoc-gen-go-triple v1.0.8
|
||||||
// - protoc v3.21.1
|
// - protoc v6.32.0--rc2
|
||||||
// source: pb/fiee/cast.proto
|
// source: pb/fiee/cast.proto
|
||||||
|
|
||||||
package cast
|
package cast
|
||||||
@ -43,8 +43,11 @@ type CastClient interface {
|
|||||||
RePublish(ctx context.Context, in *RePublishReq, opts ...grpc_go.CallOption) (*RePublishResp, common.ErrorWithAttachment)
|
RePublish(ctx context.Context, in *RePublishReq, opts ...grpc_go.CallOption) (*RePublishResp, common.ErrorWithAttachment)
|
||||||
DelWork(ctx context.Context, in *DelWorkReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
DelWork(ctx context.Context, in *DelWorkReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||||
WorkInfo(ctx context.Context, in *WorkInfoReq, opts ...grpc_go.CallOption) (*WorkInfoResp, common.ErrorWithAttachment)
|
WorkInfo(ctx context.Context, in *WorkInfoReq, opts ...grpc_go.CallOption) (*WorkInfoResp, common.ErrorWithAttachment)
|
||||||
OAuthYoutubeUrl(ctx context.Context, in *OAuthYoutubeUrlReq, opts ...grpc_go.CallOption) (*OAuthYoutubeUrlResp, common.ErrorWithAttachment)
|
OAuthAccount(ctx context.Context, in *OAuthAccountReq, opts ...grpc_go.CallOption) (*OAuthAccountResp, common.ErrorWithAttachment)
|
||||||
OAuthYoutubeToken(ctx context.Context, in *OAuthYoutubeTokenReq, opts ...grpc_go.CallOption) (*OAuthYoutubeTokenResp, common.ErrorWithAttachment)
|
OAuthCodeToToken(ctx context.Context, in *OAuthCodeToTokenReq, opts ...grpc_go.CallOption) (*OAuthCodeToTokenResp, common.ErrorWithAttachment)
|
||||||
|
RefreshToken(ctx context.Context, in *RefreshTokenReq, opts ...grpc_go.CallOption) (*RefreshTokenResp, common.ErrorWithAttachment)
|
||||||
|
PublishMediaInfo(ctx context.Context, in *PublishMediaInfoReq, opts ...grpc_go.CallOption) (*PublishMediaInfoResp, common.ErrorWithAttachment)
|
||||||
|
Test(ctx context.Context, in *emptypb.Empty, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||||
}
|
}
|
||||||
|
|
||||||
type castClient struct {
|
type castClient struct {
|
||||||
@ -66,8 +69,11 @@ type CastClientImpl struct {
|
|||||||
RePublish func(ctx context.Context, in *RePublishReq) (*RePublishResp, error)
|
RePublish func(ctx context.Context, in *RePublishReq) (*RePublishResp, error)
|
||||||
DelWork func(ctx context.Context, in *DelWorkReq) (*emptypb.Empty, error)
|
DelWork func(ctx context.Context, in *DelWorkReq) (*emptypb.Empty, error)
|
||||||
WorkInfo func(ctx context.Context, in *WorkInfoReq) (*WorkInfoResp, error)
|
WorkInfo func(ctx context.Context, in *WorkInfoReq) (*WorkInfoResp, error)
|
||||||
OAuthYoutubeUrl func(ctx context.Context, in *OAuthYoutubeUrlReq) (*OAuthYoutubeUrlResp, error)
|
OAuthAccount func(ctx context.Context, in *OAuthAccountReq) (*OAuthAccountResp, error)
|
||||||
OAuthYoutubeToken func(ctx context.Context, in *OAuthYoutubeTokenReq) (*OAuthYoutubeTokenResp, error)
|
OAuthCodeToToken func(ctx context.Context, in *OAuthCodeToTokenReq) (*OAuthCodeToTokenResp, error)
|
||||||
|
RefreshToken func(ctx context.Context, in *RefreshTokenReq) (*RefreshTokenResp, error)
|
||||||
|
PublishMediaInfo func(ctx context.Context, in *PublishMediaInfoReq) (*PublishMediaInfoResp, error)
|
||||||
|
Test func(ctx context.Context, in *emptypb.Empty) (*emptypb.Empty, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CastClientImpl) GetDubboStub(cc *triple.TripleConn) CastClient {
|
func (c *CastClientImpl) GetDubboStub(cc *triple.TripleConn) CastClient {
|
||||||
@ -166,16 +172,34 @@ func (c *castClient) WorkInfo(ctx context.Context, in *WorkInfoReq, opts ...grpc
|
|||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/WorkInfo", in, out)
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/WorkInfo", in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *castClient) OAuthYoutubeUrl(ctx context.Context, in *OAuthYoutubeUrlReq, opts ...grpc_go.CallOption) (*OAuthYoutubeUrlResp, common.ErrorWithAttachment) {
|
func (c *castClient) OAuthAccount(ctx context.Context, in *OAuthAccountReq, opts ...grpc_go.CallOption) (*OAuthAccountResp, common.ErrorWithAttachment) {
|
||||||
out := new(OAuthYoutubeUrlResp)
|
out := new(OAuthAccountResp)
|
||||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OAuthYoutubeUrl", in, out)
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OAuthAccount", in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *castClient) OAuthYoutubeToken(ctx context.Context, in *OAuthYoutubeTokenReq, opts ...grpc_go.CallOption) (*OAuthYoutubeTokenResp, common.ErrorWithAttachment) {
|
func (c *castClient) OAuthCodeToToken(ctx context.Context, in *OAuthCodeToTokenReq, opts ...grpc_go.CallOption) (*OAuthCodeToTokenResp, common.ErrorWithAttachment) {
|
||||||
out := new(OAuthYoutubeTokenResp)
|
out := new(OAuthCodeToTokenResp)
|
||||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OAuthYoutubeToken", in, out)
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OAuthCodeToToken", in, out)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *castClient) RefreshToken(ctx context.Context, in *RefreshTokenReq, opts ...grpc_go.CallOption) (*RefreshTokenResp, common.ErrorWithAttachment) {
|
||||||
|
out := new(RefreshTokenResp)
|
||||||
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/RefreshToken", in, out)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *castClient) PublishMediaInfo(ctx context.Context, in *PublishMediaInfoReq, opts ...grpc_go.CallOption) (*PublishMediaInfoResp, common.ErrorWithAttachment) {
|
||||||
|
out := new(PublishMediaInfoResp)
|
||||||
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/PublishMediaInfo", in, out)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *castClient) Test(ctx context.Context, in *emptypb.Empty, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment) {
|
||||||
|
out := new(emptypb.Empty)
|
||||||
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Test", in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CastServer is the server API for Cast service.
|
// CastServer is the server API for Cast service.
|
||||||
@ -196,8 +220,11 @@ type CastServer interface {
|
|||||||
RePublish(context.Context, *RePublishReq) (*RePublishResp, error)
|
RePublish(context.Context, *RePublishReq) (*RePublishResp, error)
|
||||||
DelWork(context.Context, *DelWorkReq) (*emptypb.Empty, error)
|
DelWork(context.Context, *DelWorkReq) (*emptypb.Empty, error)
|
||||||
WorkInfo(context.Context, *WorkInfoReq) (*WorkInfoResp, error)
|
WorkInfo(context.Context, *WorkInfoReq) (*WorkInfoResp, error)
|
||||||
OAuthYoutubeUrl(context.Context, *OAuthYoutubeUrlReq) (*OAuthYoutubeUrlResp, error)
|
OAuthAccount(context.Context, *OAuthAccountReq) (*OAuthAccountResp, error)
|
||||||
OAuthYoutubeToken(context.Context, *OAuthYoutubeTokenReq) (*OAuthYoutubeTokenResp, error)
|
OAuthCodeToToken(context.Context, *OAuthCodeToTokenReq) (*OAuthCodeToTokenResp, error)
|
||||||
|
RefreshToken(context.Context, *RefreshTokenReq) (*RefreshTokenResp, error)
|
||||||
|
PublishMediaInfo(context.Context, *PublishMediaInfoReq) (*PublishMediaInfoResp, error)
|
||||||
|
Test(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
|
||||||
mustEmbedUnimplementedCastServer()
|
mustEmbedUnimplementedCastServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,11 +275,20 @@ func (UnimplementedCastServer) DelWork(context.Context, *DelWorkReq) (*emptypb.E
|
|||||||
func (UnimplementedCastServer) WorkInfo(context.Context, *WorkInfoReq) (*WorkInfoResp, error) {
|
func (UnimplementedCastServer) WorkInfo(context.Context, *WorkInfoReq) (*WorkInfoResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method WorkInfo not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method WorkInfo not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedCastServer) OAuthYoutubeUrl(context.Context, *OAuthYoutubeUrlReq) (*OAuthYoutubeUrlResp, error) {
|
func (UnimplementedCastServer) OAuthAccount(context.Context, *OAuthAccountReq) (*OAuthAccountResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method OAuthYoutubeUrl not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method OAuthAccount not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedCastServer) OAuthYoutubeToken(context.Context, *OAuthYoutubeTokenReq) (*OAuthYoutubeTokenResp, error) {
|
func (UnimplementedCastServer) OAuthCodeToToken(context.Context, *OAuthCodeToTokenReq) (*OAuthCodeToTokenResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method OAuthYoutubeToken not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method OAuthCodeToToken not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedCastServer) RefreshToken(context.Context, *RefreshTokenReq) (*RefreshTokenResp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method RefreshToken not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedCastServer) PublishMediaInfo(context.Context, *PublishMediaInfoReq) (*PublishMediaInfoResp, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method PublishMediaInfo not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedCastServer) Test(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method Test not implemented")
|
||||||
}
|
}
|
||||||
func (s *UnimplementedCastServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
func (s *UnimplementedCastServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||||
s.proxyImpl = impl
|
s.proxyImpl = impl
|
||||||
@ -688,8 +724,8 @@ func _Cast_WorkInfo_Handler(srv interface{}, ctx context.Context, dec func(inter
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Cast_OAuthYoutubeUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
func _Cast_OAuthAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(OAuthYoutubeUrlReq)
|
in := new(OAuthAccountReq)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -701,7 +737,7 @@ func _Cast_OAuthYoutubeUrl_Handler(srv interface{}, ctx context.Context, dec fun
|
|||||||
for k, v := range md {
|
for k, v := range md {
|
||||||
invAttachment[k] = v
|
invAttachment[k] = v
|
||||||
}
|
}
|
||||||
invo := invocation.NewRPCInvocation("OAuthYoutubeUrl", args, invAttachment)
|
invo := invocation.NewRPCInvocation("OAuthAccount", args, invAttachment)
|
||||||
if interceptor == nil {
|
if interceptor == nil {
|
||||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||||
return result, result.Error()
|
return result, result.Error()
|
||||||
@ -717,8 +753,8 @@ func _Cast_OAuthYoutubeUrl_Handler(srv interface{}, ctx context.Context, dec fun
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Cast_OAuthYoutubeToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
func _Cast_OAuthCodeToToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(OAuthYoutubeTokenReq)
|
in := new(OAuthCodeToTokenReq)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -730,7 +766,94 @@ func _Cast_OAuthYoutubeToken_Handler(srv interface{}, ctx context.Context, dec f
|
|||||||
for k, v := range md {
|
for k, v := range md {
|
||||||
invAttachment[k] = v
|
invAttachment[k] = v
|
||||||
}
|
}
|
||||||
invo := invocation.NewRPCInvocation("OAuthYoutubeToken", args, invAttachment)
|
invo := invocation.NewRPCInvocation("OAuthCodeToToken", 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 _Cast_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(RefreshTokenReq)
|
||||||
|
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("RefreshToken", 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 _Cast_PublishMediaInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(PublishMediaInfoReq)
|
||||||
|
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("PublishMediaInfo", 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 _Cast_Test_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(emptypb.Empty)
|
||||||
|
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("Test", args, invAttachment)
|
||||||
if interceptor == nil {
|
if interceptor == nil {
|
||||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||||
return result, result.Error()
|
return result, result.Error()
|
||||||
@ -810,12 +933,24 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
Handler: _Cast_WorkInfo_Handler,
|
Handler: _Cast_WorkInfo_Handler,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
MethodName: "OAuthYoutubeUrl",
|
MethodName: "OAuthAccount",
|
||||||
Handler: _Cast_OAuthYoutubeUrl_Handler,
|
Handler: _Cast_OAuthAccount_Handler,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
MethodName: "OAuthYoutubeToken",
|
MethodName: "OAuthCodeToToken",
|
||||||
Handler: _Cast_OAuthYoutubeToken_Handler,
|
Handler: _Cast_OAuthCodeToToken_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "RefreshToken",
|
||||||
|
Handler: _Cast_RefreshToken_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "PublishMediaInfo",
|
||||||
|
Handler: _Cast_PublishMediaInfo_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "Test",
|
||||||
|
Handler: _Cast_Test_Handler,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc_go.StreamDesc{},
|
Streams: []grpc_go.StreamDesc{},
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"fonchain-fiee/cmd/config"
|
"fonchain-fiee/cmd/config"
|
||||||
"fonchain-fiee/pkg/cache"
|
"fonchain-fiee/pkg/cache"
|
||||||
|
"fonchain-fiee/pkg/common"
|
||||||
"fonchain-fiee/pkg/logger"
|
"fonchain-fiee/pkg/logger"
|
||||||
"fonchain-fiee/pkg/router"
|
"fonchain-fiee/pkg/router"
|
||||||
)
|
)
|
||||||
@ -55,6 +56,7 @@ func bootstrap() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cache.LoadRedis(redisConfig)
|
cache.LoadRedis(redisConfig)
|
||||||
|
common.Init()
|
||||||
//
|
//
|
||||||
//gpt.InitSet(configEnv.Ai.Host, configEnv.Ai.TelNum, configEnv.Ai.Password)
|
//gpt.InitSet(configEnv.Ai.Host, configEnv.Ai.TelNum, configEnv.Ai.Password)
|
||||||
return nil
|
return nil
|
||||||
|
@ -4,10 +4,11 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"fonchain-fiee/pkg/common"
|
"fonchain-fiee/pkg/common"
|
||||||
"github.com/BurntSushi/toml"
|
|
||||||
"gopkg.in/ini.v1"
|
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/BurntSushi/toml"
|
||||||
|
"gopkg.in/ini.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -108,15 +109,16 @@ type Redis struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type System struct {
|
type System struct {
|
||||||
Mode string
|
Mode string
|
||||||
AppMode string
|
AppMode string
|
||||||
Version string
|
Version string
|
||||||
HttpPort string
|
HttpPort string
|
||||||
Host string
|
Host string
|
||||||
RedirectUri string
|
RedirectUri string
|
||||||
Domain string
|
Domain string
|
||||||
ErpHost string
|
ErpHost string
|
||||||
FieeHost string
|
FieeHost string
|
||||||
|
AuthRedirectUrl string
|
||||||
}
|
}
|
||||||
type Oss struct {
|
type Oss struct {
|
||||||
AccessKeyId string
|
AccessKeyId string
|
||||||
|
36
conf/conf.ini
Normal file
36
conf/conf.ini
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
[system]
|
||||||
|
Domain = "fiee"
|
||||||
|
AppMode = "debug"
|
||||||
|
HttpPort = ":8085"
|
||||||
|
Host = "http://127.0.0.1:8085"
|
||||||
|
RedirectUri = "/api/redirect/url"
|
||||||
|
|
||||||
|
[bos]
|
||||||
|
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
|
||||||
|
Sk = "d2ecaa9d75114d3b9f42b99014198306"
|
||||||
|
BucketName = "dci-file-new"
|
||||||
|
BosUrl = ".bj.bcebos.com"
|
||||||
|
BosBaseDir = "fonchain-main"
|
||||||
|
BosHttp = "https://"
|
||||||
|
BosDomain = "cdns.fontree.cn"
|
||||||
|
[oss]
|
||||||
|
AccessKeyId = "${OSS_AK}"
|
||||||
|
AccessKeySecret = "${OSS_SK}"
|
||||||
|
Endpoint = "${OSS_ENDPOINTT}"
|
||||||
|
BucketName = "${OSS_BUCKETNAME}"
|
||||||
|
BaseDir = "fontree-fiee-test"
|
||||||
|
CdnHost = "${OSS_CDN}"
|
||||||
|
[redis]
|
||||||
|
RedisDB = "2"
|
||||||
|
RedisAddr = "127.0.0.1:6379"
|
||||||
|
RedisPW = ""
|
||||||
|
RedisDBNAme = "2"
|
||||||
|
|
||||||
|
|
||||||
|
[ai]
|
||||||
|
Host = "https://erpapi.fontree.cn"
|
||||||
|
TelNum = "18021272627"
|
||||||
|
Password = "Gy.123456"
|
||||||
|
|
||||||
|
[service]
|
||||||
|
IsHTTPS = false
|
15
data/policy.html
Normal file
15
data/policy.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>隐私政策</title>
|
||||||
|
<style>
|
||||||
|
body { font-family: Arial, sans-serif; line-height: 1.6; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>H5系统隐私政策</p><p>生效日期:2025年9月2日</p><p>1. 信息收集与使用</p><p>收集的个人信息类型</p><p>基础信息:手机号、微信昵称、头像、设备信息(IMEI、操作系统版本)。</p><p>支付信息:订单号、支付金额、交易时间(通过加密方式传输,不存储银行卡信息)。</p><p>自媒体平台授权信息,例如:</p><p>抖音:API接口权限(仅限内容同步)。</p><p>内容生成数据:用户输入的关键词、风格偏好、历史生成内容。</p><p>收集目的</p><p>账号验证与支付:手机号用于身份核验,支付信息用于完成交易。</p><p>内容发布:通过授权信息调用第三方平台API,执行用户指令。</p><p>2. 信息共享与转让</p><p>第三方平台接口:仅在用户授权范围内调用API,不共享用户平台账号密码。</p><p>支付合作方:与微信支付、支付宝等服务商共享订单信息以完成交易。</p><p>法律要求:如配合司法机关调查或响应政府要求,可能披露必要信息。</p><p>3. 用户权利</p><p>访问与控制:</p><p>可随时在“个人中心”查看历史生成内容、订单记录及授权状态。</p><p>删除与撤回:</p><p>可申请删除个人账户及生成内容(不包含已同步至第三方平台的内容)。</p><p>4. 数据安全</p><p>技术措施:采用HTTPS加密传输、数据库脱敏存储,定期进行安全漏洞检测。</p><p>第三方SDK:仅接入必要SDK(如微信登录、地图服务等),并签署数据保密协议。</p><p>5. 隐私政策更新</p><p>如涉及重大变更(如新增数据收集项),将通过短信/邮件通知并要求重新授权。</p><p>6. 联系我们</p><p>如有疑问,请通过以下方式联系:</p><p>客服邮箱:develop@fiee.com</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
15
data/service.html
Normal file
15
data/service.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>服务条款</title>
|
||||||
|
<style>
|
||||||
|
body { font-family: Arial, sans-serif; line-height: 1.6; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>服务条款</p><p>生效日期:2025年9月2日</p><p>1. 接受条款</p><p>通过注册或使用本系统(以下简称“服务”),您确认已阅读、理解并同意以下条款。若您不同意本条款,请立即停止使用本服务。</p><p>2. 服务内容</p><p>本系统提供自媒体内容生成与发布服务,用户可购买套餐后生成图文、短视频等原创内容,并通过系统接口同步至指定自媒体平台(如微信公众号、抖音、小红书等)。</p><p>服务包含AI辅助创作、内容优化建议、一键发布功能,具体内容以实际功能模块为准。</p><p>3. 用户权利与义务</p><p>账号与支付</p><p>注册需提供手机号或微信授权,购买套餐需通过系统支持的支付方式(如微信支付、支付宝)。</p><p>您需确保支付账户信息真实有效,因虚假信息导致的损失由您自行承担。</p><p>内容生成与发布</p><p>生成内容为原创作品,最终发布权归用户所有。</p><p>用户需对生成内容进行人工审核,确认无误后方可发布。因内容违规导致的平台处罚或法律纠纷,责任由用户承担。</p><p>系统不对用户未审核内容的合规性负责,但有权对明显违法内容(如涉黄、涉政)进行过滤拦截。</p><p>第三方平台接口</p><p>用户需授权系统调用其自媒体平台API(如tiktok开发者接口),授权范围限于内容发布及数据同步。</p><p>授权信息仅用于执行用户指令,系统不存储用户平台账号密码等敏感信息。</p><p>4. 套餐与退款</p><p>套餐有效期自购买成功日起计算,逾期未使用的套餐不支持退款。</p><p>如因系统故障或服务瑕疵导致无法正常使用,可联系客服协商退款。</p><p>5. 知识产权</p><p>由系统生成的内容(如文案、图片)默认无版权归属限制,但用户需遵守以下规则:</p><p>不得将内容用于商业用途(如转售、批量分发);</p><p>不得篡改系统生成内容的署名或标识;</p><p>若内容包含第三方素材(如音乐、图片),用户需自行确保使用合法性。</p><p>6. 责任限制</p><p>系统不对以下情形承担责任:</p><p>用户未审核内容导致的平台封禁、投诉或法律风险;</p><p>第三方平台接口变更或服务中断;</p><p>因不可抗力(如网络故障)导致的发布延迟。</p><p>7. 其他</p><p>本条款解释权归服务提供方所有,更新后将在系统内公示,用户继续使用即视为同意。</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -6,6 +6,8 @@ Host = "https://common.szjixun.cn"
|
|||||||
RedirectUri = "/api/redirect/url"
|
RedirectUri = "/api/redirect/url"
|
||||||
ErpHost = "http://114.218.158.24:9020"
|
ErpHost = "http://114.218.158.24:9020"
|
||||||
FieeHost = "http://114.218.158.24:9020"
|
FieeHost = "http://114.218.158.24:9020"
|
||||||
|
AuthRedirectUrl = "http://172.16.100.99:9028/media_account"
|
||||||
|
|
||||||
[bos]
|
[bos]
|
||||||
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
|
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
|
||||||
Sk = "d2ecaa9d75114d3b9f42b99014198306"
|
Sk = "d2ecaa9d75114d3b9f42b99014198306"
|
||||||
@ -15,12 +17,12 @@ BosBaseDir = "fiee"
|
|||||||
BosHttp = "https://"
|
BosHttp = "https://"
|
||||||
BosDomain = "cdns.fontree.cn"
|
BosDomain = "cdns.fontree.cn"
|
||||||
[oss]
|
[oss]
|
||||||
AccessKeyId = "LTAI5tLz1fSK53FQAEC9uNSb"
|
AccessKeyId = "OSS_AK"
|
||||||
AccessKeySecret = "oGB9chrQzQzITXR2IGv37Ji5WxZh4j"
|
AccessKeySecret = "OSS_SK"
|
||||||
Endpoint = "oss-cn-hangzhou.aliyuncs.com"
|
Endpoint = "OSS_ENDPOINTT"
|
||||||
BucketName = "fontree-test"
|
BucketName = "OSS_BUCKETNAME"
|
||||||
BaseDir = "fiee"
|
BaseDir = "fontree-fiee-test"
|
||||||
CdnHost = "https://cdn-test.szjixun.cn"
|
CdnHost = "OSS_CDN"
|
||||||
|
|
||||||
[redis]
|
[redis]
|
||||||
RedisDB = "2"
|
RedisDB = "2"
|
||||||
|
@ -4,7 +4,7 @@ dubbo:
|
|||||||
protocol: zookeeper
|
protocol: zookeeper
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
# address: 121.229.45.214:9004
|
# address: 121.229.45.214:9004
|
||||||
address: 172.16.100.93:2181
|
address: 127.0.0.1:2181
|
||||||
# address: 127.0.0.1:2181
|
# address: 127.0.0.1:2181
|
||||||
# address: 114.218.158.24:2181
|
# address: 114.218.158.24:2181
|
||||||
consumer:
|
consumer:
|
||||||
|
@ -6,6 +6,7 @@ Host = "https://common.szjixun.cn"
|
|||||||
RedirectUri = "/api/redirect/url"
|
RedirectUri = "/api/redirect/url"
|
||||||
ErpHost = "https://erpapi.fontree.cn"
|
ErpHost = "https://erpapi.fontree.cn"
|
||||||
FieeHost = "https://erpapi.fiee.com"
|
FieeHost = "https://erpapi.fiee.com"
|
||||||
|
AuthRedirectUrl = "https://erp.fiee.com/media_account"
|
||||||
[bos]
|
[bos]
|
||||||
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
|
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
|
||||||
Sk = "d2ecaa9d75114d3b9f42b99014198306"
|
Sk = "d2ecaa9d75114d3b9f42b99014198306"
|
||||||
@ -26,12 +27,12 @@ TelNum = "18021272627"
|
|||||||
Password = "Gy.123456"
|
Password = "Gy.123456"
|
||||||
|
|
||||||
[oss]
|
[oss]
|
||||||
AccessKeyId = "LTAI5tHfjSmWXHqfWgaL7Uo5"
|
AccessKeyId = "OSS_AK"
|
||||||
AccessKeySecret = "kOPctFZ3DHsbdSSym1fLyDK39hkzPI"
|
AccessKeySecret = "OSS_SK"
|
||||||
Endpoint = "oss-cn-hangzhou.aliyuncs.com"
|
Endpoint = "OSS_ENDPOINTT"
|
||||||
BucketName = "erp-k8s-store"
|
BucketName = "OSS_BUCKETNAME"
|
||||||
BaseDir = "fiee"
|
BaseDir = "fontree-fiee"
|
||||||
CdnHost = "https://e-cdn.fontree.cn"
|
CdnHost = "OSS_CDN"
|
||||||
|
|
||||||
[stripe]
|
[stripe]
|
||||||
Webhookkey = "whsec_Mol32WD1KcKHUdYsSwap0LR03q2g9qNY"
|
Webhookkey = "whsec_Mol32WD1KcKHUdYsSwap0LR03q2g9qNY"
|
||||||
|
@ -6,6 +6,8 @@ Host = "https://common.szjixun.cn"
|
|||||||
RedirectUri = "/api/redirect/url"
|
RedirectUri = "/api/redirect/url"
|
||||||
ErpHost = "http://114.218.158.24:9020"
|
ErpHost = "http://114.218.158.24:9020"
|
||||||
FieeHost = "http://114.218.158.24:9020"
|
FieeHost = "http://114.218.158.24:9020"
|
||||||
|
FieeApiHost = "https://saas-test.szjixun.cn"
|
||||||
|
AuthRedirectUrl = "http://172.16.100.99:9028/media_account"
|
||||||
[bos]
|
[bos]
|
||||||
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
|
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
|
||||||
Sk = "d2ecaa9d75114d3b9f42b99014198306"
|
Sk = "d2ecaa9d75114d3b9f42b99014198306"
|
||||||
@ -15,20 +17,12 @@ BosBaseDir = "fiee"
|
|||||||
BosHttp = "https://"
|
BosHttp = "https://"
|
||||||
BosDomain = "cdns.fontree.cn"
|
BosDomain = "cdns.fontree.cn"
|
||||||
[oss]
|
[oss]
|
||||||
AccessKeyId = "LTAI5tLz1fSK53FQAEC9uNSb"
|
AccessKeyId = "OSS_AK"
|
||||||
AccessKeySecret = "oGB9chrQzQzITXR2IGv37Ji5WxZh4j"
|
AccessKeySecret = "OSS_SK"
|
||||||
Endpoint = "oss-cn-hangzhou.aliyuncs.com"
|
Endpoint = "OSS_ENDPOINTT"
|
||||||
BucketName = "fontree-test"
|
BucketName = "OSS_BUCKETNAME"
|
||||||
BaseDir = "fiee"
|
BaseDir = "fontree-fiee-test"
|
||||||
CdnHost = "https://cdn-test.szjixun.cn"
|
CdnHost = "OSS_CDN"
|
||||||
|
|
||||||
[oss]
|
|
||||||
AccessKeyId="LTAI5tLz1fSK53FQAEC9uNSb"
|
|
||||||
AccessKeysecret ="oGB9chrQzQzITXR2IGv37Ji5WxZh4j"
|
|
||||||
Endpoint = "oss-cn-hangzhou.aliyuncs.com"
|
|
||||||
BucketName = "fontree-test"
|
|
||||||
BaseDir = "fiee"
|
|
||||||
CdnHost = "https://cdn-test.szjixun.cn"
|
|
||||||
|
|
||||||
[redis]
|
[redis]
|
||||||
RedisDB = "2"
|
RedisDB = "2"
|
||||||
|
31
go.mod
31
go.mod
@ -1,8 +1,8 @@
|
|||||||
module fonchain-fiee
|
module fonchain-fiee
|
||||||
|
|
||||||
go 1.21.3
|
go 1.23.0
|
||||||
|
|
||||||
toolchain go1.23.6
|
toolchain go1.23.10
|
||||||
|
|
||||||
replace (
|
replace (
|
||||||
//github.com/fonchain_enterprise/utils/objstorage => ../../tyfon-新/utils/objstorage
|
//github.com/fonchain_enterprise/utils/objstorage => ../../tyfon-新/utils/objstorage
|
||||||
@ -89,10 +89,10 @@ require (
|
|||||||
go.uber.org/atomic v1.9.0 // indirect
|
go.uber.org/atomic v1.9.0 // indirect
|
||||||
go.uber.org/multierr v1.6.0 // indirect
|
go.uber.org/multierr v1.6.0 // indirect
|
||||||
go.uber.org/zap v1.21.0
|
go.uber.org/zap v1.21.0
|
||||||
golang.org/x/crypto v0.19.0 // indirect
|
golang.org/x/crypto v0.38.0 // indirect
|
||||||
golang.org/x/net v0.21.0 // indirect
|
golang.org/x/net v0.40.0 // indirect
|
||||||
golang.org/x/sys v0.18.0 // indirect
|
golang.org/x/sys v0.33.0 // indirect
|
||||||
golang.org/x/text v0.14.0 // indirect
|
golang.org/x/text v0.25.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 // indirect
|
google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 // indirect
|
||||||
google.golang.org/grpc v1.47.0 // indirect
|
google.golang.org/grpc v1.47.0 // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||||
@ -109,12 +109,16 @@ require (
|
|||||||
github.com/fonchain_enterprise/utils/objstorage v0.0.0-00010101000000-000000000000
|
github.com/fonchain_enterprise/utils/objstorage v0.0.0-00010101000000-000000000000
|
||||||
github.com/gin-contrib/pprof v1.4.0
|
github.com/gin-contrib/pprof v1.4.0
|
||||||
github.com/go-redis/redis v6.15.9+incompatible
|
github.com/go-redis/redis v6.15.9+incompatible
|
||||||
|
github.com/mholt/archiver v3.1.1+incompatible
|
||||||
|
github.com/natefinch/lumberjack v2.0.0+incompatible
|
||||||
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd
|
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd
|
||||||
github.com/signintech/gopdf v0.29.2
|
github.com/signintech/gopdf v0.29.2
|
||||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||||
github.com/spf13/viper v1.7.1
|
github.com/spf13/viper v1.7.1
|
||||||
|
github.com/tealeg/xlsx v1.0.5
|
||||||
github.com/u2takey/ffmpeg-go v0.5.0
|
github.com/u2takey/ffmpeg-go v0.5.0
|
||||||
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69
|
github.com/xuri/excelize/v2 v2.9.1
|
||||||
|
golang.org/x/image v0.25.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@ -134,6 +138,7 @@ require (
|
|||||||
github.com/coreos/go-semver v0.3.0 // indirect
|
github.com/coreos/go-semver v0.3.0 // indirect
|
||||||
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
||||||
github.com/dorlolo/simpleRequest v1.2.7 // indirect
|
github.com/dorlolo/simpleRequest v1.2.7 // indirect
|
||||||
|
github.com/dsnet/compress v0.0.1 // indirect
|
||||||
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
|
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
|
||||||
github.com/emicklei/go-restful/v3 v3.7.4 // indirect
|
github.com/emicklei/go-restful/v3 v3.7.4 // indirect
|
||||||
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect
|
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect
|
||||||
@ -157,13 +162,15 @@ require (
|
|||||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||||
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
|
github.com/nwaples/rardecode v1.1.3 // indirect
|
||||||
github.com/nxadm/tail v1.4.11 // indirect
|
github.com/nxadm/tail v1.4.11 // indirect
|
||||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||||
github.com/onsi/gomega v1.18.1 // indirect
|
github.com/onsi/gomega v1.18.1 // indirect
|
||||||
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 // indirect
|
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 // indirect
|
||||||
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
|
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
|
||||||
github.com/polarismesh/polaris-go v1.1.0 // indirect
|
github.com/polarismesh/polaris-go v1.1.0 // indirect
|
||||||
|
github.com/richardlehane/mscfb v1.0.4 // indirect
|
||||||
|
github.com/richardlehane/msoleps v1.0.4 // indirect
|
||||||
github.com/shirou/gopsutil/v3 v3.21.6 // indirect
|
github.com/shirou/gopsutil/v3 v3.21.6 // indirect
|
||||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||||
github.com/smartystreets/assertions v1.1.1 // indirect
|
github.com/smartystreets/assertions v1.1.1 // indirect
|
||||||
@ -173,11 +180,15 @@ require (
|
|||||||
github.com/spf13/jwalterweatherman v1.0.0 // indirect
|
github.com/spf13/jwalterweatherman v1.0.0 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
github.com/subosito/gotenv v1.2.0 // indirect
|
github.com/subosito/gotenv v1.2.0 // indirect
|
||||||
github.com/tealeg/xlsx v1.0.5 // indirect
|
github.com/tiendc/go-deepcopy v1.6.0 // indirect
|
||||||
github.com/tklauser/go-sysconf v0.3.6 // indirect
|
github.com/tklauser/go-sysconf v0.3.6 // indirect
|
||||||
github.com/tklauser/numcpus v0.2.2 // indirect
|
github.com/tklauser/numcpus v0.2.2 // indirect
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
github.com/u2takey/go-utils v0.3.1 // indirect
|
github.com/u2takey/go-utils v0.3.1 // indirect
|
||||||
|
github.com/ulikunitz/xz v0.5.12 // indirect
|
||||||
|
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
|
||||||
|
github.com/xuri/efp v0.0.1 // indirect
|
||||||
|
github.com/xuri/nfp v0.0.1 // indirect
|
||||||
github.com/zouyx/agollo/v3 v3.4.5 // indirect
|
github.com/zouyx/agollo/v3 v3.4.5 // indirect
|
||||||
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
|
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
|
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
|
||||||
@ -186,7 +197,7 @@ require (
|
|||||||
go.opentelemetry.io/otel/trace v1.7.0 // indirect
|
go.opentelemetry.io/otel/trace v1.7.0 // indirect
|
||||||
golang.org/x/arch v0.3.0 // indirect
|
golang.org/x/arch v0.3.0 // indirect
|
||||||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
|
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
|
||||||
golang.org/x/sync v0.1.0 // indirect
|
golang.org/x/sync v0.14.0 // indirect
|
||||||
golang.org/x/time v0.3.0 // indirect
|
golang.org/x/time v0.3.0 // indirect
|
||||||
google.golang.org/appengine v1.6.6 // indirect
|
google.golang.org/appengine v1.6.6 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
54
go.sum
54
go.sum
@ -190,6 +190,9 @@ github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1
|
|||||||
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
|
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
|
||||||
github.com/dorlolo/simpleRequest v1.2.7 h1:I6AlEhMBSZPNQ4QjpCevhpxsPRDa3lgDOxJYYfmPTU8=
|
github.com/dorlolo/simpleRequest v1.2.7 h1:I6AlEhMBSZPNQ4QjpCevhpxsPRDa3lgDOxJYYfmPTU8=
|
||||||
github.com/dorlolo/simpleRequest v1.2.7/go.mod h1:koVT8DQu+JK40UoMNBQjt+zomlCW8FqE0ffEzjTOWYY=
|
github.com/dorlolo/simpleRequest v1.2.7/go.mod h1:koVT8DQu+JK40UoMNBQjt+zomlCW8FqE0ffEzjTOWYY=
|
||||||
|
github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q=
|
||||||
|
github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo=
|
||||||
|
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
|
||||||
github.com/dubbogo/go-zookeeper v1.0.3/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
|
github.com/dubbogo/go-zookeeper v1.0.3/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
|
||||||
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 h1:XoR8SSVziXe698dt4uZYDfsmHpKLemqAgFyndQsq5Kw=
|
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 h1:XoR8SSVziXe698dt4uZYDfsmHpKLemqAgFyndQsq5Kw=
|
||||||
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
|
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
|
||||||
@ -537,6 +540,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
|
|||||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||||
|
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
|
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||||
@ -587,6 +592,8 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
|
|||||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||||
|
github.com/mholt/archiver v3.1.1+incompatible h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU=
|
||||||
|
github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU=
|
||||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||||
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
||||||
@ -641,6 +648,8 @@ github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6
|
|||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk=
|
github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk=
|
||||||
|
github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc=
|
||||||
|
github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
|
||||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||||
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
|
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
|
||||||
@ -751,6 +760,11 @@ github.com/prometheus/statsd_exporter v0.21.0/go.mod h1:rbT83sZq2V+p73lHhPZfMc3M
|
|||||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||||
github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
|
github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA=
|
||||||
|
github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM=
|
||||||
|
github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
|
||||||
|
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
|
||||||
|
github.com/richardlehane/msoleps v1.0.4 h1:WuESlvhX3gH2IHcd8UqyCuFY5yiq/GR/yqaSM/9/g00=
|
||||||
|
github.com/richardlehane/msoleps v1.0.4/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
|
||||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||||
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
||||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||||
@ -833,8 +847,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
|
|
||||||
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
||||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||||
github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
|
github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
|
||||||
@ -842,6 +857,8 @@ github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCn
|
|||||||
github.com/tebeka/strftime v0.1.3/go.mod h1:7wJm3dZlpr4l/oVK0t1HYIc4rMzQ2XJlOMIUJUJH6XQ=
|
github.com/tebeka/strftime v0.1.3/go.mod h1:7wJm3dZlpr4l/oVK0t1HYIc4rMzQ2XJlOMIUJUJH6XQ=
|
||||||
github.com/tevid/gohamcrest v1.1.1 h1:ou+xSqlIw1xfGTg1uq1nif/htZ2S3EzRqLm2BP+tYU0=
|
github.com/tevid/gohamcrest v1.1.1 h1:ou+xSqlIw1xfGTg1uq1nif/htZ2S3EzRqLm2BP+tYU0=
|
||||||
github.com/tevid/gohamcrest v1.1.1/go.mod h1:3UvtWlqm8j5JbwYZh80D/PVBt0mJ1eJiYgZMibh0H/k=
|
github.com/tevid/gohamcrest v1.1.1/go.mod h1:3UvtWlqm8j5JbwYZh80D/PVBt0mJ1eJiYgZMibh0H/k=
|
||||||
|
github.com/tiendc/go-deepcopy v1.6.0 h1:0UtfV/imoCwlLxVsyfUd4hNHnB3drXsfle+wzSCA5Wo=
|
||||||
|
github.com/tiendc/go-deepcopy v1.6.0/go.mod h1:toXoeQoUqXOOS/X4sKuiAoSk6elIdqc0pN7MTgOOo2I=
|
||||||
github.com/tklauser/go-sysconf v0.3.6 h1:oc1sJWvKkmvIxhDHeKWvZS4f6AW+YcoguSfRF2/Hmo4=
|
github.com/tklauser/go-sysconf v0.3.6 h1:oc1sJWvKkmvIxhDHeKWvZS4f6AW+YcoguSfRF2/Hmo4=
|
||||||
github.com/tklauser/go-sysconf v0.3.6/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI=
|
github.com/tklauser/go-sysconf v0.3.6/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI=
|
||||||
github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA=
|
github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA=
|
||||||
@ -871,10 +888,21 @@ github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxW
|
|||||||
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
|
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
|
||||||
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
|
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
|
||||||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||||
|
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
|
||||||
|
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
|
||||||
|
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||||
|
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo=
|
||||||
|
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
|
github.com/xuri/efp v0.0.1 h1:fws5Rv3myXyYni8uwj2qKjVaRP30PdjeYe2Y6FDsCL8=
|
||||||
|
github.com/xuri/efp v0.0.1/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
|
||||||
|
github.com/xuri/excelize/v2 v2.9.1 h1:VdSGk+rraGmgLHGFaGG9/9IWu1nj4ufjJ7uwMDtj8Qw=
|
||||||
|
github.com/xuri/excelize/v2 v2.9.1/go.mod h1:x7L6pKz2dvo9ejrRuD8Lnl98z4JLt0TGAwjhW+EiP8s=
|
||||||
|
github.com/xuri/nfp v0.0.1 h1:MDamSGatIvp8uOmDP8FnmjuQpu90NzdJxo7242ANR9Q=
|
||||||
|
github.com/xuri/nfp v0.0.1/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
|
||||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
@ -960,8 +988,8 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh
|
|||||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
|
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
|
||||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
||||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@ -980,8 +1008,8 @@ golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86h
|
|||||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||||
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69 h1:Lj6HJGCSn5AjxRAH2+r35Mir4icalbqku+CLUtjnvXY=
|
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
|
||||||
golang.org/x/image v0.0.0-20220902085622-e7cb96979f69/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY=
|
golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs=
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
@ -1055,8 +1083,8 @@ golang.org/x/net v0.0.0-20211105192438-b53810dc28af/go.mod h1:9nx3DQGgdP8bBQD5qx
|
|||||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
@ -1077,8 +1105,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
|
|||||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-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-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@ -1157,8 +1185,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
@ -1172,8 +1200,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.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.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-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-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
11
pkg/common/file.go
Normal file
11
pkg/common/file.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package common
|
||||||
|
|
||||||
|
import "fonchain-fiee/pkg/utils"
|
||||||
|
|
||||||
|
func Init() {
|
||||||
|
_ = utils.CreateDirPath("./runtime")
|
||||||
|
utils.CopyFile("./data/policy.html", "./runtime")
|
||||||
|
utils.CopyFile("./data/service.html", "./runtime")
|
||||||
|
utils.CopyFile("../data/policy.html", "./runtime")
|
||||||
|
utils.CopyFile("../data/service.html", "./runtime")
|
||||||
|
}
|
@ -4,9 +4,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"fonchain-fiee/pkg/common"
|
"fonchain-fiee/pkg/common"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
"go.uber.org/zap"
|
||||||
"gopkg.in/ini.v1"
|
"gopkg.in/ini.v1"
|
||||||
"os"
|
"os"
|
||||||
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -249,5 +252,63 @@ func Viper(iniConf string) (err error) {
|
|||||||
panic("viper.Unmarshal failed" + err.Error())
|
panic("viper.Unmarshal failed" + err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
traverseFields(reflect.ValueOf(*ConfigData), "", ConfigData)
|
||||||
|
zap.L().Info("ConfigData", zap.Any("ConfigData", ConfigData))
|
||||||
|
fmt.Printf("ConfigData--%+v", ConfigData)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
func traverseFields(value reflect.Value, prefix string, configPtr interface{}) {
|
||||||
|
valueType := value.Type()
|
||||||
|
prefixEnv := "${"
|
||||||
|
suffixEnv := "}"
|
||||||
|
// 遍历结构体的字段
|
||||||
|
for i := 0; i < valueType.NumField(); i++ {
|
||||||
|
field := valueType.Field(i)
|
||||||
|
fieldValue := value.Field(i)
|
||||||
|
// 拼接字段名(带有前缀)
|
||||||
|
fieldName := prefix + field.Name
|
||||||
|
// 判断字段的类型
|
||||||
|
if fieldValue.Kind() == reflect.Struct {
|
||||||
|
// 递归遍历嵌套结构体字段
|
||||||
|
traverseFields(fieldValue, fieldName+".", configPtr)
|
||||||
|
} else {
|
||||||
|
// 获取字段的值
|
||||||
|
fieldValueStr := fmt.Sprintf("%v", fieldValue.Interface())
|
||||||
|
// 判断是不是需要通过环境变量获取
|
||||||
|
if len(fieldValueStr) > 3 && strings.HasPrefix(fieldValueStr, prefixEnv) && strings.HasSuffix(fieldValueStr, suffixEnv) {
|
||||||
|
end := len(fieldValueStr) - len(suffixEnv)
|
||||||
|
var hasDefault bool
|
||||||
|
if strings.Index(fieldValueStr, "|") > 0 {
|
||||||
|
hasDefault = true
|
||||||
|
end = strings.Index(fieldValueStr, "|")
|
||||||
|
}
|
||||||
|
envStr := fieldValueStr[len(prefixEnv):end]
|
||||||
|
getValue := os.Getenv(envStr)
|
||||||
|
if getValue == "" && hasDefault {
|
||||||
|
getValue = fieldValueStr[end+1 : len(fieldValueStr)-len(suffixEnv)]
|
||||||
|
}
|
||||||
|
setSubFieldValue(configPtr, fieldName, getValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func setSubFieldValue(configPtr interface{}, fieldPath string, newValue interface{}) {
|
||||||
|
value := reflect.ValueOf(configPtr).Elem()
|
||||||
|
fields := strings.Split(fieldPath, ".")
|
||||||
|
for _, field := range fields {
|
||||||
|
value = value.FieldByName(field)
|
||||||
|
if !value.IsValid() {
|
||||||
|
return // 字段不存在,直接返回
|
||||||
|
}
|
||||||
|
if value.Kind() == reflect.Ptr {
|
||||||
|
value = value.Elem() // 解引用指针类型的字段
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 检查字段是否可设置
|
||||||
|
if value.CanSet() {
|
||||||
|
// 根据字段类型,将新值转换为对应类型并设置字段的值
|
||||||
|
newValue := reflect.ValueOf(newValue).Convert(value.Type())
|
||||||
|
value.Set(newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -129,7 +129,7 @@ func MakeThumbnail(imagePath, savePath string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *Upload) PutBos(filePath string, mediaType string, needRemove bool) (url string, err error) {
|
func (u *Upload) PutBos(filePath string, mediaType string, needRemove bool) (url string, err error) {
|
||||||
BOSClient, err := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint)
|
BOSClient, err := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("PutBos NewOOS err ", err)
|
logger.Errorf("PutBos NewOOS err ", err)
|
||||||
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
||||||
@ -148,14 +148,14 @@ func (u *Upload) PutBos(filePath string, mediaType string, needRemove bool) (url
|
|||||||
}
|
}
|
||||||
filePath = strings.Replace(filePath, "./runtime", "", 1)
|
filePath = strings.Replace(filePath, "./runtime", "", 1)
|
||||||
var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
||||||
_, err = BOSClient.PutObjectFromBytes(config.ConfigData.Oss.BucketName, objectName, fileBytes)
|
_, err = BOSClient.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), objectName, fileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("PutBos PutObject err %+v", err.Error())
|
logger.Errorf("PutBos PutObject err %+v", err.Error())
|
||||||
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
||||||
url = fmt.Sprintf("%s/%s", config.ConfigData.Oss.CdnHost, objectName)
|
url = fmt.Sprintf("%s/%s", os.Getenv(config.ConfigData.Oss.CdnHost), objectName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,9 +89,10 @@ func CheckWebLogin(provider *account.AccountClientImpl) gin.HandlerFunc {
|
|||||||
service.NotLoginRes(ctx, logic.ConvertLoginMsg(ctx, e.ErrNotLogin))
|
service.NotLoginRes(ctx, logic.ConvertLoginMsg(ctx, e.ErrNotLogin))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
fmt.Println("authorization", authorization)
|
||||||
jwt, err := secret.GetJwtFromStr(authorization)
|
jwt, err := secret.GetJwtFromStr(authorization)
|
||||||
|
fmt.Println("jwt", jwt)
|
||||||
|
fmt.Println("jwt_err", err)
|
||||||
logger.Info("---------end帐号转jwt:时间:", time.Now().Sub(startTime))
|
logger.Info("---------end帐号转jwt:时间:", time.Now().Sub(startTime))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.NotLoginRes(ctx, err.Error())
|
service.NotLoginRes(ctx, err.Error())
|
||||||
@ -107,19 +108,23 @@ func CheckWebLogin(provider *account.AccountClientImpl) gin.HandlerFunc {
|
|||||||
info, err := service.AccountProvider.DecryptJwt(ctx, &req)
|
info, err := service.AccountProvider.DecryptJwt(ctx, &req)
|
||||||
logger.Info("---------end帐号微服务解密:时间:", time.Now().Sub(startTime))
|
logger.Info("---------end帐号微服务解密:时间:", time.Now().Sub(startTime))
|
||||||
|
|
||||||
|
fmt.Println("DecryptJwt", info)
|
||||||
|
fmt.Println("DecryptJwtErr:----->", err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.NotLoginRes(ctx, err.Error())
|
service.NotLoginRes(ctx, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//if info.OfflineCode == e.OfflineSqueeze {
|
//if info.OfflineCode == e.OfflineSqueeze {
|
||||||
// service.Error(ctx, e.NotLoginSqueeze, errors.New(e.ErrOfflineSqueeze))
|
// service.Error(ctx, e.NotLoginSqueeze, errors.New(e.ErrOfflineSqueeze))
|
||||||
// return
|
// return
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if info.IsOffline == true {
|
if info.IsOffline == true {
|
||||||
service.ErrorWeb(ctx, e.NotLogin, errors.New(logic.ConvertOfflineMsg(ctx, e.ErrOffline)))
|
//如果是来自体制外的请求,过滤挤掉校验
|
||||||
return
|
if !(ctx != nil && (ctx.GetHeader("origin") == "https://erp-out.szjixun.cn")) {
|
||||||
|
service.ErrorWeb(ctx, e.NotLogin, errors.New(logic.ConvertOfflineMsg(ctx, e.ErrOffline)))
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//1 获取用户的账号信息
|
//1 获取用户的账号信息
|
||||||
@ -130,7 +135,8 @@ func CheckWebLogin(provider *account.AccountClientImpl) gin.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
infoRes, err := service.AccountProvider.Info(ctx, infoReq)
|
infoRes, err := service.AccountProvider.Info(ctx, infoReq)
|
||||||
|
fmt.Println("infoRes", infoRes)
|
||||||
|
fmt.Println("infoResErr", err)
|
||||||
logger.Info("---------end帐号info时间:", time.Now().Sub(startTime))
|
logger.Info("---------end帐号info时间:", time.Now().Sub(startTime))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -4,11 +4,12 @@ import (
|
|||||||
"fonchain-fiee/pkg/middleware"
|
"fonchain-fiee/pkg/middleware"
|
||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
serviceCast "fonchain-fiee/pkg/service/cast"
|
serviceCast "fonchain-fiee/pkg/service/cast"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MediaRouter(r *gin.RouterGroup) {
|
func MediaRouter(r *gin.RouterGroup) {
|
||||||
//noAuth := r.Group("")
|
noAuth := r.Group("")
|
||||||
auth := r.Group("")
|
auth := r.Group("")
|
||||||
auth.Use(middleware.CheckWebLogin(service.AccountProvider))
|
auth.Use(middleware.CheckWebLogin(service.AccountProvider))
|
||||||
media := auth.Group("media")
|
media := auth.Group("media")
|
||||||
@ -17,12 +18,14 @@ func MediaRouter(r *gin.RouterGroup) {
|
|||||||
media.POST("unbind-manager", serviceCast.UnbindManager)
|
media.POST("unbind-manager", serviceCast.UnbindManager)
|
||||||
media.POST("bind-manager", serviceCast.BindManager)
|
media.POST("bind-manager", serviceCast.BindManager)
|
||||||
media.POST("update-account", serviceCast.UpdateMediaAccount)
|
media.POST("update-account", serviceCast.UpdateMediaAccount)
|
||||||
media.POST("oauth-url", serviceCast.OAuthUrl)
|
media.POST("oauth-account", serviceCast.OAuthAccount)
|
||||||
|
media.POST("refresh-token", serviceCast.RefreshToken)
|
||||||
}
|
}
|
||||||
mediaNoLogin := r.Group("media")
|
mediaNoLogin := r.Group("media")
|
||||||
{
|
{
|
||||||
mediaNoLogin.GET("oauth2callback", serviceCast.OAuth2Callback)
|
mediaNoLogin.GET("oauth2callback", serviceCast.OAuth2Callback)
|
||||||
mediaNoLogin.GET("test", serviceCast.Test)
|
mediaNoLogin.Any("test", serviceCast.Test)
|
||||||
|
//mediaNoLogin.GET("dmoauth2callback", serviceCast.DMOAuth2Callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
work := auth.Group("work")
|
work := auth.Group("work")
|
||||||
@ -35,5 +38,11 @@ func MediaRouter(r *gin.RouterGroup) {
|
|||||||
work.POST("republish", serviceCast.RePublish)
|
work.POST("republish", serviceCast.RePublish)
|
||||||
work.POST("delete", serviceCast.DelWork)
|
work.POST("delete", serviceCast.DelWork)
|
||||||
work.POST("remind", serviceCast.Remind)
|
work.POST("remind", serviceCast.Remind)
|
||||||
|
work.POST("publish-info", serviceCast.PublishInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
social := noAuth.Group("social")
|
||||||
|
{
|
||||||
|
social.GET("tiktok-redirect", serviceCast.TikTokRedirect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"fonchain-fiee/pkg/service/auth"
|
"fonchain-fiee/pkg/service/auth"
|
||||||
"fonchain-fiee/pkg/service/file"
|
"fonchain-fiee/pkg/service/file"
|
||||||
"fonchain-fiee/pkg/service/governance"
|
"fonchain-fiee/pkg/service/governance"
|
||||||
|
imports "fonchain-fiee/pkg/service/import"
|
||||||
"fonchain-fiee/pkg/service/lang"
|
"fonchain-fiee/pkg/service/lang"
|
||||||
"fonchain-fiee/pkg/service/pressreleases"
|
"fonchain-fiee/pkg/service/pressreleases"
|
||||||
"fonchain-fiee/pkg/service/qr"
|
"fonchain-fiee/pkg/service/qr"
|
||||||
@ -134,6 +135,8 @@ func NewRouter() *gin.Engine {
|
|||||||
v1.POST("aschat/autoReplyRuler/update", asChat.Handler.UpdateChatAutoReplyRuler)
|
v1.POST("aschat/autoReplyRuler/update", asChat.Handler.UpdateChatAutoReplyRuler)
|
||||||
v1.POST("aschat/autoReplyRuler/detail", asChat.Handler.GetChatAutoReplyRulerDetail)
|
v1.POST("aschat/autoReplyRuler/detail", asChat.Handler.GetChatAutoReplyRulerDetail)
|
||||||
v1.POST("aschat/autoReplyRuler/query", asChat.Handler.GetChatAutoReplyRulerList)
|
v1.POST("aschat/autoReplyRuler/query", asChat.Handler.GetChatAutoReplyRulerList)
|
||||||
|
v1.POST("aschat/autoReplyRuler/userSwitch/get", asChat.ChatHandlerIns.UserSwitchAutoReplyStatus) //获取自动回复开关状态
|
||||||
|
v1.POST("aschat/autoReplyRuler/userSwitch/set", asChat.ChatHandlerIns.SetSwitchAutoReplyStatus) //设置自动回复开关状态
|
||||||
|
|
||||||
v1.POST("/test/user/log/erp", asChat.Handler.ErpLoginDemo)
|
v1.POST("/test/user/log/erp", asChat.Handler.ErpLoginDemo)
|
||||||
v1.POST("/test/user/log/fiee", asChat.Handler.FieeLoginDemo)
|
v1.POST("/test/user/log/fiee", asChat.Handler.FieeLoginDemo)
|
||||||
@ -184,6 +187,15 @@ func NewRouter() *gin.Engine {
|
|||||||
pressreleasesRouteLogin.POST("/delete", pressreleases.Delete)
|
pressreleasesRouteLogin.POST("/delete", pressreleases.Delete)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
importRoute := v1.Group("/import")
|
||||||
|
importRoute.Use(middleware.CheckWebLogin(service.AccountProvider))
|
||||||
|
importRoute.POST("data/bind", imports.ImportBind)
|
||||||
|
importRoute.POST("data/publish", imports.ImportPublish)
|
||||||
|
importRoute.POST("data/publish2", imports.ImportPublishV2)
|
||||||
|
importRoute.POST("data/publish3", imports.ImportPublishV3)
|
||||||
|
importRoute.POST("data/confirm", imports.WorkConfirm)
|
||||||
|
}
|
||||||
//静态文件
|
//静态文件
|
||||||
r.StaticFS("/api/static", http.Dir("./runtime"))
|
r.StaticFS("/api/static", http.Dir("./runtime"))
|
||||||
r.NoRoute(func(c *gin.Context) {
|
r.NoRoute(func(c *gin.Context) {
|
||||||
|
@ -17,6 +17,7 @@ import (
|
|||||||
"github.com/goccy/go-json"
|
"github.com/goccy/go-json"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"log"
|
"log"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -25,6 +26,7 @@ import (
|
|||||||
const CacheChatRecordKey = "fiee:chatRecord"
|
const CacheChatRecordKey = "fiee:chatRecord"
|
||||||
const CacheSessionKey = "fiee:chatSession"
|
const CacheSessionKey = "fiee:chatSession"
|
||||||
const CacheNewMsgStatKey = "fiee:newMsgStat"
|
const CacheNewMsgStatKey = "fiee:newMsgStat"
|
||||||
|
const CacheAutoReplySwitchKey = "fiee:AutoReplySwitch"
|
||||||
|
|
||||||
var chatCacheLocker sync.RWMutex
|
var chatCacheLocker sync.RWMutex
|
||||||
|
|
||||||
@ -248,3 +250,37 @@ func (cr ChatCache) coverOwnerNewMessageStat(ctx context.Context, ownerId int64,
|
|||||||
err = cache.RedisClient.Set(cr.GetNewMsgStatCacheKey(ownerId), value, 0).Err()
|
err = cache.RedisClient.Set(cr.GetNewMsgStatCacheKey(ownerId), value, 0).Err()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------用户自动回复开关
|
||||||
|
// erp获取最新的消息统计
|
||||||
|
func (cr ChatCache) GetCacheAutoReplySwitchKey(userId int64) string {
|
||||||
|
return fmt.Sprintf("%s:%d", CacheAutoReplySwitchKey, userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cr ChatCache) SetAutoReplySwitch(ctx context.Context, ownerId int64, enableAutoReply bool) {
|
||||||
|
//chatCacheLocker.RLock()
|
||||||
|
//defer chatCacheLocker.RUnlock()
|
||||||
|
err := cache.RedisClient.Set(cr.GetCacheAutoReplySwitchKey(ownerId), enableAutoReply, 0).Err()
|
||||||
|
if err != nil {
|
||||||
|
log.Print("保存用户会话失败", zap.Error(err))
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cr ChatCache) GetAutoReplySwitch(ctx context.Context, ownerId int64) (enableAutoReply bool) {
|
||||||
|
//chatCacheLocker.RLock()
|
||||||
|
//defer chatCacheLocker.RUnlock()
|
||||||
|
val, err := cache.RedisClient.Get(cr.GetCacheAutoReplySwitchKey(ownerId)).Bytes()
|
||||||
|
if err != nil {
|
||||||
|
log.Print("获取自动回复开关查询失败", zap.Error(err), zap.Int64("ownerId", ownerId))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 解析缓存值为布尔值
|
||||||
|
boolVal, err := strconv.ParseBool(string(val))
|
||||||
|
if err != nil {
|
||||||
|
log.Print("解析自动回复开关值失败", zap.Error(err), zap.String("value", string(val)), zap.Int64("ownerId", ownerId))
|
||||||
|
return true // 解析失败时也返回默认值true
|
||||||
|
}
|
||||||
|
|
||||||
|
return boolVal
|
||||||
|
}
|
||||||
|
@ -35,6 +35,7 @@ type NewMessageRequest struct {
|
|||||||
SessionId string `json:"sessionId"`
|
SessionId string `json:"sessionId"`
|
||||||
Message
|
Message
|
||||||
AtUserId int64 `json:"atUserId"` //指定发送给sessionId中的某一个用户
|
AtUserId int64 `json:"atUserId"` //指定发送给sessionId中的某一个用户
|
||||||
|
//EnableAutoReply bool `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 服务端接收到消息后,使用websocket发送给userId关联的客户端,通知客户端有新消息,然后调用接口获取消息
|
// 服务端接收到消息后,使用websocket发送给userId关联的客户端,通知客户端有新消息,然后调用接口获取消息
|
||||||
@ -218,3 +219,7 @@ type UserDetailResp struct {
|
|||||||
Phone string `json:"phone"`
|
Phone string `json:"phone"`
|
||||||
GroupPhoto string `json:"groupPhoto"`
|
GroupPhoto string `json:"groupPhoto"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UserSwitchAutoReplyReq struct {
|
||||||
|
EnableAutoReply bool `json:"enableAutoReply"`
|
||||||
|
}
|
||||||
|
@ -612,3 +612,54 @@ func (cr ChatHandler) UserDetail(c *gin.Context) {
|
|||||||
|
|
||||||
service.Success(c, detail)
|
service.Success(c, detail)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *ChatHandler) UserSwitchAutoReplyStatus(c *gin.Context) {
|
||||||
|
chatUser, code := jwt.ParseToChatUser(c)
|
||||||
|
if code != 0 {
|
||||||
|
service.ErrWithCode(c, code)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var req dto.UserSwitchAutoReplyReq
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
enable := a.cache.GetAutoReplySwitch(c, chatUser.ID)
|
||||||
|
var resp = map[string]any{
|
||||||
|
"enableAutoReply": enable,
|
||||||
|
}
|
||||||
|
service.Success(c, resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *ChatHandler) SetSwitchAutoReplyStatus(c *gin.Context) {
|
||||||
|
chatUser, code := jwt.ParseToChatUser(c)
|
||||||
|
if code != 0 {
|
||||||
|
service.ErrWithCode(c, code)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var req dto.UserSwitchAutoReplyReq
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
a.cache.SetAutoReplySwitch(c, chatUser.ID, req.EnableAutoReply)
|
||||||
|
msg := dto.Message{
|
||||||
|
MsgType: 1,
|
||||||
|
LocalStamp: time.Now().Unix(),
|
||||||
|
}
|
||||||
|
if req.EnableAutoReply {
|
||||||
|
msg.Text = "已退出人工"
|
||||||
|
} else {
|
||||||
|
msg.Text = "已进入人工,不会接收自动消息"
|
||||||
|
}
|
||||||
|
err := logic.NewMessage(c, &a.cache, chatUser, dto.NewMessageRequest{
|
||||||
|
Robot: true,
|
||||||
|
SessionId: fmt.Sprintf("%d", chatUser.ID),
|
||||||
|
Message: msg,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
service.Success(c)
|
||||||
|
}
|
||||||
|
@ -165,29 +165,17 @@ func (r *Robot) Run() {
|
|||||||
fmt.Printf("robot listen event:%#v\n", event)
|
fmt.Printf("robot listen event:%#v\n", event)
|
||||||
r.mu.Lock()
|
r.mu.Lock()
|
||||||
//加入聊天室规则
|
//加入聊天室规则
|
||||||
hasHit := false
|
enableAutoReply := false
|
||||||
for _, rule := range r.joinSessionRules {
|
if event.Client != nil {
|
||||||
hit := rule.Hit(event, r.Info)
|
enableAutoReply = new(chatCache.ChatCache).GetAutoReplySwitch(context.Background(), event.Client.UserId)
|
||||||
fmt.Printf("规则【%s】校验结果:%v\n", rule.GetTitle(), hit)
|
|
||||||
if hit {
|
|
||||||
hasHit = true
|
|
||||||
if rule.RunTime().IsZero() {
|
|
||||||
err := rule.Run(r.cache)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("robot 执行任务失败:%v\n", err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
r.RegisterDelayTask(rule)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if !hasHit {
|
if enableAutoReply {
|
||||||
for _, rule := range r.keywordsRules {
|
hasHit := false
|
||||||
|
for _, rule := range r.joinSessionRules {
|
||||||
hit := rule.Hit(event, r.Info)
|
hit := rule.Hit(event, r.Info)
|
||||||
fmt.Printf("规则【%s】校验结果:%v\n", rule.GetTitle(), hit)
|
fmt.Printf("规则【%s】校验结果:%v\n", rule.GetTitle(), hit)
|
||||||
if hit {
|
if hit {
|
||||||
hasHit = true
|
hasHit = true
|
||||||
fmt.Println("命中规则:", rule.GetTitle())
|
|
||||||
if rule.RunTime().IsZero() {
|
if rule.RunTime().IsZero() {
|
||||||
err := rule.Run(r.cache)
|
err := rule.Run(r.cache)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -198,21 +186,39 @@ func (r *Robot) Run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if !hasHit {
|
||||||
if !hasHit {
|
for _, rule := range r.keywordsRules {
|
||||||
for _, rule := range r.noReplyAfterRules {
|
hit := rule.Hit(event, r.Info)
|
||||||
hit := rule.Hit(event, r.Info)
|
fmt.Printf("规则【%s】校验结果:%v\n", rule.GetTitle(), hit)
|
||||||
fmt.Printf("规则【%s】校验结果:%v\n", rule.GetTitle(), hit)
|
if hit {
|
||||||
if hit {
|
hasHit = true
|
||||||
hasHit = true
|
fmt.Println("命中规则:", rule.GetTitle())
|
||||||
fmt.Println("命中规则:", rule.GetTitle())
|
if rule.RunTime().IsZero() {
|
||||||
if rule.RunTime().IsZero() {
|
err := rule.Run(r.cache)
|
||||||
err := rule.Run(r.cache)
|
if err != nil {
|
||||||
if err != nil {
|
log.Printf("robot 执行任务失败:%v\n", err)
|
||||||
log.Printf("robot 执行任务失败:%v\n", err)
|
}
|
||||||
|
} else {
|
||||||
|
r.RegisterDelayTask(rule)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !hasHit {
|
||||||
|
for _, rule := range r.noReplyAfterRules {
|
||||||
|
hit := rule.Hit(event, r.Info)
|
||||||
|
fmt.Printf("规则【%s】校验结果:%v\n", rule.GetTitle(), hit)
|
||||||
|
if hit {
|
||||||
|
hasHit = true
|
||||||
|
fmt.Println("命中规则:", rule.GetTitle())
|
||||||
|
if rule.RunTime().IsZero() {
|
||||||
|
err := rule.Run(r.cache)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("robot 执行任务失败:%v\n", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
r.RegisterDelayTask(rule)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
r.RegisterDelayTask(rule)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,13 @@ import (
|
|||||||
"fonchain-fiee/pkg/service/bundle/logic"
|
"fonchain-fiee/pkg/service/bundle/logic"
|
||||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||||
"fonchain-fiee/pkg/service/upload"
|
"fonchain-fiee/pkg/service/upload"
|
||||||
"github.com/360EntSecGroup-Skylar/excelize"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/gin-gonic/gin/binding"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/360EntSecGroup-Skylar/excelize"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/gin-gonic/gin/binding"
|
||||||
)
|
)
|
||||||
|
|
||||||
func DeleteBundleOrder(c *gin.Context) {
|
func DeleteBundleOrder(c *gin.Context) {
|
||||||
@ -502,6 +503,7 @@ func OrderRecordsListV2(c *gin.Context) {
|
|||||||
if u, ok := userMap[item.CustomerId]; ok {
|
if u, ok := userMap[item.CustomerId]; ok {
|
||||||
item.CustomerName = u.Name
|
item.CustomerName = u.Name
|
||||||
item.TelNum = u.TelNum
|
item.TelNum = u.TelNum
|
||||||
|
item.SubNum = u.SubNum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -583,6 +585,7 @@ func OrderRecordsListDownload(c *gin.Context) {
|
|||||||
if u, ok := userMap[item.CustomerId]; ok {
|
if u, ok := userMap[item.CustomerId]; ok {
|
||||||
item.CustomerName = u.Name
|
item.CustomerName = u.Name
|
||||||
item.TelNum = u.TelNum
|
item.TelNum = u.TelNum
|
||||||
|
item.SubNum = u.SubNum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -606,8 +609,8 @@ func exportExcel(orderList []*bundle.OrderBundleRecordInfo) (*excelize.File, err
|
|||||||
f.SetSheetName("Sheet1", sheetName)
|
f.SetSheetName("Sheet1", sheetName)
|
||||||
|
|
||||||
headers := []string{
|
headers := []string{
|
||||||
"套餐订单号", "套餐类型", "套餐付款状态", "艺人手机号", "艺人", "套餐订单创建时间", "套餐支付时间", "套餐金额",
|
"套餐订单号", "套餐类型", "套餐付款状态", "艺人手机号", "用户编号", "艺人", "套餐订单创建时间", "套餐支付时间", "套餐金额",
|
||||||
"增值服务订单号", "增值税服务金额", "结算金额", "币种", "手续费", "增值订单创建时间", "增值付款状态",
|
"增值服务订单号", "增值税服务金额", "支付金额", "币种", "手续费", "增值订单创建时间", "增值付款状态",
|
||||||
}
|
}
|
||||||
for i, h := range headers {
|
for i, h := range headers {
|
||||||
cell := fmt.Sprintf("%s%d", string(rune('A'+i)), 1)
|
cell := fmt.Sprintf("%s%d", string(rune('A'+i)), 1)
|
||||||
@ -636,22 +639,22 @@ func exportExcel(orderList []*bundle.OrderBundleRecordInfo) (*excelize.File, err
|
|||||||
f.SetCellValue(sheetName, fmt.Sprintf("B%d", rowIndex), bundleInfo.BundleName)
|
f.SetCellValue(sheetName, fmt.Sprintf("B%d", rowIndex), bundleInfo.BundleName)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("C%d", rowIndex), GetPayStatusText(bundleInfo.PayStatus))
|
f.SetCellValue(sheetName, fmt.Sprintf("C%d", rowIndex), GetPayStatusText(bundleInfo.PayStatus))
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("D%d", rowIndex), bundleInfo.TelNum)
|
f.SetCellValue(sheetName, fmt.Sprintf("D%d", rowIndex), bundleInfo.TelNum)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("E%d", rowIndex), bundleInfo.CustomerName)
|
f.SetCellValue(sheetName, fmt.Sprintf("E%d", rowIndex), bundleInfo.SubNum)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("F%d", rowIndex), bundleInfo.BundleCreateAt)
|
f.SetCellValue(sheetName, fmt.Sprintf("F%d", rowIndex), bundleInfo.CustomerName)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("G%d", rowIndex), bundleInfo.PayTime)
|
f.SetCellValue(sheetName, fmt.Sprintf("G%d", rowIndex), bundleInfo.BundleCreateAt)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("H%d", rowIndex), bundleInfo.Amount)
|
f.SetCellValue(sheetName, fmt.Sprintf("H%d", rowIndex), bundleInfo.PayTime)
|
||||||
|
f.SetCellValue(sheetName, fmt.Sprintf("I%d", rowIndex), bundleInfo.Amount)
|
||||||
|
|
||||||
if addCount > 0 {
|
if addCount > 0 {
|
||||||
for i, add := range bundleInfo.AddBundleInfo {
|
for i, add := range bundleInfo.AddBundleInfo {
|
||||||
r := rowIndex + i
|
r := rowIndex + i
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("I%d", r), add.OrderAddNo)
|
f.SetCellValue(sheetName, fmt.Sprintf("J%d", r), add.OrderAddNo)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("J%d", r), add.Amount)
|
f.SetCellValue(sheetName, fmt.Sprintf("K%d", r), add.Amount)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("K%d", r), add.SettlementAmount)
|
f.SetCellValue(sheetName, fmt.Sprintf("L%d", r), add.SettlementAmount)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("L%d", r), GetCurrencyTypeText(add.CurrencyType))
|
f.SetCellValue(sheetName, fmt.Sprintf("M%d", r), GetCurrencyTypeText(add.CurrencyType))
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("M%d", r), add.HandlingFee)
|
f.SetCellValue(sheetName, fmt.Sprintf("N%d", r), add.HandlingFee)
|
||||||
//f.SetCellValue(sheetName, fmt.Sprintf("N%d", r), add.ExchangeRate)
|
f.SetCellValue(sheetName, fmt.Sprintf("O%d", r), add.OrderAddCreateAt)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("N%d", r), add.OrderAddCreateAt)
|
f.SetCellValue(sheetName, fmt.Sprintf("P%d", r), GetPayStatusText(add.AddPayStatus))
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("O%d", r), GetPayStatusText(add.AddPayStatus))
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for i := 8; i <= 15; i++ {
|
for i := 8; i <= 15; i++ {
|
||||||
|
@ -11,10 +11,11 @@ import (
|
|||||||
"fonchain-fiee/pkg/service/bundle/logic"
|
"fonchain-fiee/pkg/service/bundle/logic"
|
||||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||||
"fonchain-fiee/pkg/utils"
|
"fonchain-fiee/pkg/utils"
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/gin-gonic/gin/binding"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/gin-gonic/gin/binding"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetReconciliationList(c *gin.Context) {
|
func GetReconciliationList(c *gin.Context) {
|
||||||
@ -23,11 +24,61 @@ func GetReconciliationList(c *gin.Context) {
|
|||||||
service.Error(c, err)
|
service.Error(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
res := &bundle.GetReconciliationListResp{}
|
||||||
|
// Step 1: 如果有姓名/电话筛选,先查用户列表
|
||||||
|
if req.UserName != "" {
|
||||||
|
userListResp, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
|
||||||
|
BlurNameTel: req.UserName,
|
||||||
|
Domain: "app",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(userListResp.UserList) == 0 {
|
||||||
|
// 没查到用户,直接返回空结果
|
||||||
|
res.Page = req.Page
|
||||||
|
res.PageSize = req.PageSize
|
||||||
|
res.Total = 0
|
||||||
|
service.Success(c, res)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提取用户ID列表
|
||||||
|
for _, u := range userListResp.UserList {
|
||||||
|
req.UserIDS = append(req.UserIDS, u.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
req.UserName = ""
|
||||||
detail, detailErr := service.BundleProvider.GetReconciliationList(context.Background(), &req)
|
detail, detailErr := service.BundleProvider.GetReconciliationList(context.Background(), &req)
|
||||||
if detailErr != nil {
|
if detailErr != nil {
|
||||||
service.Error(c, detailErr)
|
service.Error(c, detailErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var userIds []int64
|
||||||
|
for _, u := range detail.List {
|
||||||
|
userIds = append(userIds, int64(u.UserID))
|
||||||
|
}
|
||||||
|
userListResp, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
|
||||||
|
Ids: userIds,
|
||||||
|
Domain: "app",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
userMap := make(map[int64]*accountFiee.UserListInfo, len(userListResp.UserList))
|
||||||
|
if len(userListResp.UserList) > 0 {
|
||||||
|
for _, u := range userListResp.UserList {
|
||||||
|
userMap[int64(u.Id)] = u
|
||||||
|
}
|
||||||
|
for _, u := range detail.List {
|
||||||
|
if user, ok := userMap[int64(u.UserID)]; ok {
|
||||||
|
u.SubNum = user.SubNum
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
service.Success(c, detail)
|
service.Success(c, detail)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -39,13 +90,61 @@ func GetReconciliationListDownload(c *gin.Context) {
|
|||||||
service.Error(c, err)
|
service.Error(c, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
res := &bundle.GetReconciliationListResp{}
|
||||||
|
if req.UserName != "" {
|
||||||
|
userListResp, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
|
||||||
|
BlurNameTel: req.UserName,
|
||||||
|
Domain: "app",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(userListResp.UserList) == 0 {
|
||||||
|
// 没查到用户,直接返回空结果
|
||||||
|
res.Page = req.Page
|
||||||
|
res.PageSize = req.PageSize
|
||||||
|
res.Total = 0
|
||||||
|
service.Success(c, res)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提取用户ID列表
|
||||||
|
for _, u := range userListResp.UserList {
|
||||||
|
req.UserIDS = append(req.UserIDS, u.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
detail, detailErr := service.BundleProvider.GetReconciliationList(context.Background(), &req)
|
detail, detailErr := service.BundleProvider.GetReconciliationList(context.Background(), &req)
|
||||||
if detailErr != nil {
|
if detailErr != nil {
|
||||||
service.Error(c, detailErr)
|
service.Error(c, detailErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var userIds []int64
|
||||||
|
for _, u := range detail.List {
|
||||||
|
userIds = append(userIds, int64(u.UserID))
|
||||||
|
}
|
||||||
|
userListResp, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
|
||||||
|
Ids: userIds,
|
||||||
|
Domain: "app",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
userMap := make(map[int64]*accountFiee.UserListInfo, len(userListResp.UserList))
|
||||||
|
if len(userListResp.UserList) > 0 {
|
||||||
|
for _, u := range userListResp.UserList {
|
||||||
|
userMap[int64(u.Id)] = u
|
||||||
|
}
|
||||||
|
for _, u := range detail.List {
|
||||||
|
if user, ok := userMap[int64(u.UserID)]; ok {
|
||||||
|
u.SubNum = user.SubNum
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
titleList := []string{
|
titleList := []string{
|
||||||
"关联套餐订单号", "关联增值服务订单号", "对账单创建时间", "艺人", "艺人手机号", "套餐", "支付金额", "币种", "支付渠道", "支付时间", "支付状态", "流水号",
|
"关联套餐订单号", "关联增值服务订单号", "用户编号", "艺人", "艺人手机号", "套餐", "支付金额", "手续费", "币种", "支付渠道", "支付时间", "支付状态", "流水号",
|
||||||
}
|
}
|
||||||
var dataList []interface{}
|
var dataList []interface{}
|
||||||
|
|
||||||
@ -59,11 +158,13 @@ func GetReconciliationListDownload(c *gin.Context) {
|
|||||||
data := []any{
|
data := []any{
|
||||||
i.BundleOrderOn,
|
i.BundleOrderOn,
|
||||||
i.BundleAddOrderOn,
|
i.BundleAddOrderOn,
|
||||||
i.CreationTime,
|
//i.CreationTime,
|
||||||
|
i.SubNum,
|
||||||
i.UserName,
|
i.UserName,
|
||||||
i.UserTel,
|
i.UserTel,
|
||||||
i.BundleName,
|
i.BundleName,
|
||||||
i.PayAmount,
|
i.PayAmount,
|
||||||
|
i.HandlingFee,
|
||||||
currencyType,
|
currencyType,
|
||||||
payChannel,
|
payChannel,
|
||||||
i.PayTime,
|
i.PayTime,
|
||||||
@ -174,20 +275,28 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
|||||||
var expirationDay string
|
var expirationDay string
|
||||||
numMap := make(map[string]int32)
|
numMap := make(map[string]int32)
|
||||||
numMap["3150.00"] = 3
|
numMap["3150.00"] = 3
|
||||||
|
numMap["4200.00"] = 5
|
||||||
numMap["5600.00"] = 8
|
numMap["5600.00"] = 8
|
||||||
numMap["6500.00"] = 10
|
numMap["6500.00"] = 10
|
||||||
numMap["8500.00"] = 15
|
numMap["8500.00"] = 15
|
||||||
numMap["10500.00"] = 20
|
numMap["10500.00"] = 20
|
||||||
numMap["11500.00"] = 25
|
numMap["11500.00"] = 25
|
||||||
numMap["14100.00"] = 30
|
numMap["14100.00"] = 30
|
||||||
|
numMap["16200.00"] = 35
|
||||||
|
numMap["18300.00"] = 40
|
||||||
|
numMap["26700.00"] = 60
|
||||||
incrMap := make(map[string]float32)
|
incrMap := make(map[string]float32)
|
||||||
incrMap["3150.00"] = 1650
|
incrMap["3150.00"] = 1650
|
||||||
|
incrMap["4200.00"] = 2700
|
||||||
incrMap["5600.00"] = 4100
|
incrMap["5600.00"] = 4100
|
||||||
incrMap["6500.00"] = 5000
|
incrMap["6500.00"] = 5000
|
||||||
incrMap["8500.00"] = 7000
|
incrMap["8500.00"] = 7000
|
||||||
incrMap["10500.00"] = 9000
|
incrMap["10500.00"] = 9000
|
||||||
incrMap["11500.00"] = 10000
|
incrMap["11500.00"] = 10000
|
||||||
incrMap["14100.00"] = 12600
|
incrMap["14100.00"] = 12600
|
||||||
|
incrMap["16200.00"] = 14700
|
||||||
|
incrMap["18300.00"] = 16800
|
||||||
|
incrMap["26700.00"] = 25200
|
||||||
addTotalPrice = incrMap[unfinishInfo.OrderPayAmount]
|
addTotalPrice = incrMap[unfinishInfo.OrderPayAmount]
|
||||||
fmt.Println("incrMap:", incrMap)
|
fmt.Println("incrMap:", incrMap)
|
||||||
fmt.Println("unfinishInfo.OrderPayAmount:", unfinishInfo.OrderPayAmount)
|
fmt.Println("unfinishInfo.OrderPayAmount:", unfinishInfo.OrderPayAmount)
|
||||||
@ -249,7 +358,7 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
|||||||
)
|
)
|
||||||
// 当前 未将 签名 写入合同中 todo 金额和有效时间待修改
|
// 当前 未将 签名 写入合同中 todo 金额和有效时间待修改
|
||||||
contract := "https://e-cdn.fontree.cn/fonchain-main/prod/file/saas/contract/template-25032801.pdf"
|
contract := "https://e-cdn.fontree.cn/fonchain-main/prod/file/saas/contract/template-25032801.pdf"
|
||||||
expirationDay = t.AddDate(10, 0, 0).Format("2006-01-02")
|
expirationDay = t.AddDate(1, 0, 0).Format("2006-01-02")
|
||||||
signContract, signContractErr := logic.SignContractV2(userReq.UserNum, contract, TotalPrice, expirationDay)
|
signContract, signContractErr := logic.SignContractV2(userReq.UserNum, contract, TotalPrice, expirationDay)
|
||||||
if signContractErr != nil {
|
if signContractErr != nil {
|
||||||
service.Error(c, signContractErr)
|
service.Error(c, signContractErr)
|
||||||
@ -330,6 +439,7 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
|||||||
PayTime: unfinishInfo.PayTime,
|
PayTime: unfinishInfo.PayTime,
|
||||||
UserID: uint64(userResp.UserId),
|
UserID: uint64(userResp.UserId),
|
||||||
SerialNumber: unfinishInfo.OrderNo,
|
SerialNumber: unfinishInfo.OrderNo,
|
||||||
|
HandlingFee: unfinishInfo.OrderFeeAmount,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("=============== antom创建支付,创建对账单报错:", err)
|
fmt.Println("=============== antom创建支付,创建对账单报错:", err)
|
||||||
|
@ -3,6 +3,7 @@ package cast
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"fonchain-fiee/api/accountFiee"
|
"fonchain-fiee/api/accountFiee"
|
||||||
"fonchain-fiee/api/bundle"
|
"fonchain-fiee/api/bundle"
|
||||||
"fonchain-fiee/api/cast"
|
"fonchain-fiee/api/cast"
|
||||||
@ -10,9 +11,13 @@ import (
|
|||||||
"fonchain-fiee/pkg/e"
|
"fonchain-fiee/pkg/e"
|
||||||
modelCast "fonchain-fiee/pkg/model/cast"
|
modelCast "fonchain-fiee/pkg/model/cast"
|
||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"strconv"
|
"google.golang.org/protobuf/types/known/emptypb"
|
||||||
)
|
)
|
||||||
|
|
||||||
func MediaUserList(ctx *gin.Context) {
|
func MediaUserList(ctx *gin.Context) {
|
||||||
@ -160,9 +165,10 @@ func UpdateMediaAccount(ctx *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func OAuthUrl(ctx *gin.Context) {
|
// 账号授权
|
||||||
var req *cast.OAuthYoutubeUrlReq
|
func OAuthAccount(ctx *gin.Context) {
|
||||||
var resp *cast.OAuthYoutubeUrlResp
|
var req *cast.OAuthAccountReq
|
||||||
|
var resp *cast.OAuthAccountResp
|
||||||
var err error
|
var err error
|
||||||
if err = ctx.ShouldBind(&req); err != nil {
|
if err = ctx.ShouldBind(&req); err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
@ -172,7 +178,7 @@ func OAuthUrl(ctx *gin.Context) {
|
|||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if resp, err = service.CastProvider.OAuthYoutubeUrl(ctx, req); err != nil {
|
if resp, err = service.CastProvider.OAuthAccount(ctx, req); err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -181,15 +187,63 @@ func OAuthUrl(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func OAuth2Callback(ctx *gin.Context) {
|
func OAuth2Callback(ctx *gin.Context) {
|
||||||
|
var (
|
||||||
|
platformIds string
|
||||||
|
userID string
|
||||||
|
)
|
||||||
code := ctx.Query("code")
|
code := ctx.Query("code")
|
||||||
state := ctx.Query("state")
|
state := ctx.Query("state")
|
||||||
//scope := ctx.Query("scope")
|
stateMM, _ := url.ParseQuery(state)
|
||||||
resp, err := service.CastProvider.OAuthYoutubeToken(ctx, &cast.OAuthYoutubeTokenReq{
|
if len(stateMM["platform_id"]) > 0 {
|
||||||
MediaAccountUuid: state,
|
platformIds = stateMM["platform_id"][0]
|
||||||
Code: code,
|
}
|
||||||
//scope: scope,
|
if len(stateMM["user_id"]) > 0 {
|
||||||
})
|
userID = stateMM["user_id"][0]
|
||||||
|
}
|
||||||
|
platformID, _ := strconv.ParseInt(platformIds, 10, 64)
|
||||||
|
req := &cast.OAuthCodeToTokenReq{
|
||||||
|
Code: code,
|
||||||
|
UserID: userID,
|
||||||
|
}
|
||||||
|
switch platformID {
|
||||||
|
case int64(cast.PlatformIDENUM_DM):
|
||||||
|
req.PlatformID = cast.PlatformIDENUM_DM
|
||||||
|
case int64(cast.PlatformIDENUM_TIKTOK):
|
||||||
|
req.PlatformID = cast.PlatformIDENUM_TIKTOK
|
||||||
|
default:
|
||||||
|
service.Error(ctx, errors.New(e.GetMsg(e.InvalidParams)))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
zap.L().Info("OAuth2Callback", zap.Any("req", req), zap.Any("code", code), zap.Any("state", state))
|
||||||
|
_, err := service.CastProvider.OAuthCodeToToken(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
zap.L().Info("OAuth2Callback error", zap.Error(err))
|
||||||
|
|
||||||
|
ctx.Redirect(http.StatusFound, fmt.Sprintf("%s?%s", config.AppConfig.System.AuthRedirectUrl, "status=1"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// TODO 跳转到前端页面
|
||||||
|
ctx.Redirect(http.StatusFound, fmt.Sprintf("%s?%s", config.AppConfig.System.AuthRedirectUrl, "status=0"))
|
||||||
|
//service.Success(ctx, map[string]interface{}{
|
||||||
|
// "req": req,
|
||||||
|
// "resp": resp,
|
||||||
|
//})
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func RefreshToken(ctx *gin.Context) {
|
||||||
|
var req *cast.RefreshTokenReq
|
||||||
|
var resp *cast.RefreshTokenResp
|
||||||
|
var err error
|
||||||
|
if err = ctx.ShouldBind(&req); err != nil {
|
||||||
|
service.Error(ctx, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = req.Validate(); err != nil {
|
||||||
|
service.Error(ctx, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if resp, err = service.CastProvider.RefreshToken(ctx, req); err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -198,6 +252,6 @@ func OAuth2Callback(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Test(ctx *gin.Context) {
|
func Test(ctx *gin.Context) {
|
||||||
service.Success(ctx, nil)
|
service.CastProvider.Test(ctx, &emptypb.Empty{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
package cast
|
|
38
pkg/service/cast/social.go
Normal file
38
pkg/service/cast/social.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package cast
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"fonchain-fiee/pkg/service"
|
||||||
|
"net/url"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TikTokRedirect(ctx *gin.Context) {
|
||||||
|
var state, decodeParams, code string
|
||||||
|
var err error
|
||||||
|
var values url.Values
|
||||||
|
fmt.Println(code)
|
||||||
|
state = ctx.Query("state")
|
||||||
|
decodeParams, err = url.QueryUnescape(state)
|
||||||
|
values, err = url.ParseQuery(decodeParams)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(ctx, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch values.Get("source") {
|
||||||
|
case "authcode":
|
||||||
|
code = ctx.Query("code")
|
||||||
|
/*resp, _err := service.CastProvider.OAuthTikTokToken(ctx, &cast.OAuthTikTokTokenReq{
|
||||||
|
Code: code,
|
||||||
|
UserID: values.Get("userid"),
|
||||||
|
})
|
||||||
|
if _err != nil {
|
||||||
|
service.Error(ctx, _err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
service.Success(ctx, resp)*/
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
@ -11,9 +11,12 @@ import (
|
|||||||
"fonchain-fiee/pkg/e"
|
"fonchain-fiee/pkg/e"
|
||||||
modelCast "fonchain-fiee/pkg/model/cast"
|
modelCast "fonchain-fiee/pkg/model/cast"
|
||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
|
"fonchain-fiee/pkg/utils/stime"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdateWorkImage(ctx *gin.Context) {
|
func UpdateWorkImage(ctx *gin.Context) {
|
||||||
@ -30,6 +33,7 @@ func UpdateWorkImage(ctx *gin.Context) {
|
|||||||
ID: artistId,
|
ID: artistId,
|
||||||
Domain: "app",
|
Domain: "app",
|
||||||
})
|
})
|
||||||
|
zap.L().Info("UpdateWorkImage infoResp", zap.Any("infoResp", infoResp))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
return
|
return
|
||||||
@ -50,7 +54,9 @@ func UpdateWorkImage(ctx *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
newCtx := NewCtxWithUserInfo(ctx)
|
newCtx := NewCtxWithUserInfo(ctx)
|
||||||
|
req.Source = 1
|
||||||
resp, err := service.CastProvider.UpdateWorkImage(newCtx, req)
|
resp, err := service.CastProvider.UpdateWorkImage(newCtx, req)
|
||||||
|
zap.L().Info("UpdateWorkImage resp", zap.Any("resp", resp))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
return
|
return
|
||||||
@ -73,6 +79,7 @@ func UpdateWorkVideo(ctx *gin.Context) {
|
|||||||
ID: artistId,
|
ID: artistId,
|
||||||
Domain: "app",
|
Domain: "app",
|
||||||
})
|
})
|
||||||
|
zap.L().Info("UpdateWorkVideo", zap.Any("infoResp", infoResp))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
return
|
return
|
||||||
@ -93,7 +100,9 @@ func UpdateWorkVideo(ctx *gin.Context) {
|
|||||||
req.ArtistPhone = infoResp.TelNum
|
req.ArtistPhone = infoResp.TelNum
|
||||||
req.ArtistPhoneAreaCode = infoResp.TelAreaCode
|
req.ArtistPhoneAreaCode = infoResp.TelAreaCode
|
||||||
newCtx := NewCtxWithUserInfo(ctx)
|
newCtx := NewCtxWithUserInfo(ctx)
|
||||||
|
req.Source = 1
|
||||||
resp, err := service.CastProvider.UpdateWorkVideo(newCtx, req)
|
resp, err := service.CastProvider.UpdateWorkVideo(newCtx, req)
|
||||||
|
zap.L().Info("UpdateWorkVideo", zap.Any("resp", resp))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
return
|
return
|
||||||
@ -143,6 +152,14 @@ func WorkList(ctx *gin.Context) {
|
|||||||
approvalID, _ := strconv.ParseUint(v.ApprovalID, 10, 64)
|
approvalID, _ := strconv.ParseUint(v.ApprovalID, 10, 64)
|
||||||
workUuidApprovalIDMap[int(approvalID)] = v.WorkUuid
|
workUuidApprovalIDMap[int(approvalID)] = v.WorkUuid
|
||||||
}
|
}
|
||||||
|
statusUpdateDate, _ := stime.DatetimeToTimes(v.StatusUpdateTime, "2006-01-02 15:04:05")
|
||||||
|
if v.WorkStatus == 6 && (time.Now().Unix()-int64(statusUpdateDate) < 300) {
|
||||||
|
go func() {
|
||||||
|
_, _ = service.CastProvider.PublishMediaInfo(context.Background(), &cast.PublishMediaInfoReq{
|
||||||
|
WorkUuid: v.WorkUuid,
|
||||||
|
})
|
||||||
|
}()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if len(workUuidApprovalIDMap) > 0 {
|
if len(workUuidApprovalIDMap) > 0 {
|
||||||
_ = RefreshWorkApprovalStatus(ctx, workUuidApprovalIDMap)
|
_ = RefreshWorkApprovalStatus(ctx, workUuidApprovalIDMap)
|
||||||
@ -173,8 +190,10 @@ func WorkDetail(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CheckUserBundleBalance(userID int32, balanceType modelCast.BalanceTypeEnum) (err error) {
|
func CheckUserBundleBalance(userID int32, balanceType modelCast.BalanceTypeEnum) (err error) {
|
||||||
|
zap.L().Info("CheckUserBundleBalance", zap.Any("userID", userID))
|
||||||
resp, err := service.BundleProvider.GetBundleBalanceByUserId(context.Background(), &bundle.GetBundleBalanceByUserIdReq{UserId: userID})
|
resp, err := service.BundleProvider.GetBundleBalanceByUserId(context.Background(), &bundle.GetBundleBalanceByUserIdReq{UserId: userID})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
zap.L().Error("CheckUserBundleBalance", zap.Any("err", err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
zap.L().Info("CheckUserBundleBalance", zap.Any("resp", resp))
|
zap.L().Info("CheckUserBundleBalance", zap.Any("resp", resp))
|
||||||
@ -203,6 +222,7 @@ func RePublish(ctx *gin.Context) {
|
|||||||
var (
|
var (
|
||||||
req *cast.RePublishReq
|
req *cast.RePublishReq
|
||||||
resp *cast.RePublishResp
|
resp *cast.RePublishResp
|
||||||
|
//workInfoResp *cast.WorkInfoResp
|
||||||
)
|
)
|
||||||
var err error
|
var err error
|
||||||
if err = ctx.ShouldBind(&req); err != nil {
|
if err = ctx.ShouldBind(&req); err != nil {
|
||||||
@ -210,32 +230,43 @@ func RePublish(ctx *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
newCtx := NewCtxWithUserInfo(ctx)
|
newCtx := NewCtxWithUserInfo(ctx)
|
||||||
resp, err = service.CastProvider.RePublish(newCtx, req)
|
/* workInfoResp, err = service.CastProvider.WorkInfo(context.Background(), &cast.WorkInfoReq{
|
||||||
if err != nil {
|
WorkUuid: req.WorkUuid,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
service.Error(ctx, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Println(workInfoResp)*/
|
||||||
|
/*artistID, _ := strconv.ParseInt(workInfoResp.ArtistUuid, 10, 64)
|
||||||
|
if err = CheckUserBundleBalance(int32(artistID), modelCast.BalanceTypeVideoValue); err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
artistID, _ := strconv.ParseUint(resp.ArtistUuid, 10, 64)
|
|
||||||
balanceReq := &bundle.AddBundleBalanceReq{
|
balanceReq := &bundle.AddBundleBalanceReq{
|
||||||
UserId: int32(artistID),
|
UserId: int32(artistID),
|
||||||
}
|
}
|
||||||
if resp.WorkCategory == 1 {
|
if workInfoResp.WorkCategory == 1 {
|
||||||
balanceReq.ImageConsumptionNumber = 1
|
balanceReq.ImageConsumptionNumber = 1
|
||||||
}
|
}
|
||||||
if resp.WorkCategory == 2 {
|
if workInfoResp.WorkCategory == 2 {
|
||||||
balanceReq.VideoConsumptionNumber = 1
|
balanceReq.VideoConsumptionNumber = 1
|
||||||
}
|
}
|
||||||
_, err = service.BundleProvider.AddBundleBalance(context.Background(), balanceReq)
|
_, err = service.BundleProvider.AddBundleBalance(context.Background(), balanceReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
//FIXME 进行回滚
|
return
|
||||||
|
}*/
|
||||||
|
resp, err = service.CastProvider.RePublish(newCtx, req)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(ctx, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
service.Success(ctx, nil)
|
service.Success(ctx, resp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改余量我还需要调用吗
|
// 修改余量我还需要调用吗
|
||||||
func UserBundleBalanceCost() {
|
func UserBundleBalanceCost() {
|
||||||
service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{})
|
service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{})
|
||||||
}
|
}
|
||||||
@ -361,3 +392,20 @@ func Remind(ctx *gin.Context) {
|
|||||||
service.Success(ctx, nil)
|
service.Success(ctx, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PublishInfo(ctx *gin.Context) {
|
||||||
|
var req *cast.PublishMediaInfoReq
|
||||||
|
var resp *cast.PublishMediaInfoResp
|
||||||
|
var err error
|
||||||
|
if err = ctx.ShouldBind(&req); err != nil {
|
||||||
|
service.Error(ctx, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
resp, err = service.CastProvider.PublishMediaInfo(context.Background(), req)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(ctx, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
service.Success(ctx, resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
89
pkg/service/import/artist.go
Normal file
89
pkg/service/import/artist.go
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
package imports
|
||||||
|
|
||||||
|
import (
|
||||||
|
apiCast "fonchain-fiee/api/cast"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AccountInfo struct {
|
||||||
|
NickName string `json:"nickName"`
|
||||||
|
AccountId string `json:"accountId"`
|
||||||
|
}
|
||||||
|
type ArtistAccount struct {
|
||||||
|
Index string `json:"index"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
SubNum string `json:"subNum"`
|
||||||
|
Account map[apiCast.PlatformIDENUM]AccountInfo `json:"account"`
|
||||||
|
}
|
||||||
|
type ArtistMedia struct {
|
||||||
|
Id string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
SubNum string `json:"subNum"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Img string `json:"img"`
|
||||||
|
Video string `json:"video"`
|
||||||
|
Youtube string `json:"youtube"`
|
||||||
|
Instagram string `json:"instagram"`
|
||||||
|
TikTok string `json:"tiktok"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FailedRecord struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
}
|
||||||
|
type ArtistVideoDetail struct {
|
||||||
|
Id string `json:"id"`
|
||||||
|
ArtistName string `json:"artistName"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
WorkUuid string `json:"workUuid"`
|
||||||
|
Youtube string `json:"youtube"`
|
||||||
|
Instagram string `json:"instagram"`
|
||||||
|
TikTok string `json:"tiktok"`
|
||||||
|
ArtistId string `json:"artistId"`
|
||||||
|
SubNum string `json:"subNum"`
|
||||||
|
}
|
||||||
|
type CreateRequest struct {
|
||||||
|
Type string `json:"Type"`
|
||||||
|
DepartmentID int64 `json:"DepartmentID"`
|
||||||
|
Domain string `json:"Domain"`
|
||||||
|
MenuType int32 `json:"menuType"`
|
||||||
|
SaasPublishVideo *SaasPublishVideo `json:"SaasPublishVideo"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SaasPublishVideo struct {
|
||||||
|
Title string `json:"Title"`
|
||||||
|
Describe string `json:"Describe"`
|
||||||
|
IsYoutubeSee int32 `json:"IsYoutubeSee"`
|
||||||
|
IsTiktokScreen int32 `json:"IsTiktokScreen"`
|
||||||
|
IsTiktokComment int32 `json:"IsTiktokComment"`
|
||||||
|
IsTiktokQuote int32 `json:"IsTiktokQuote"`
|
||||||
|
IsTiktokAiGenerate int32 `json:"IsTiktokAiGenerate"`
|
||||||
|
Cover string `json:"Cover"`
|
||||||
|
PlatformIds []int32 `json:"PlatformIds"`
|
||||||
|
PublishAccounts []PublishAccount `json:"PublishAccounts"`
|
||||||
|
Videos []Video `json:"Videos"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PublishAccount struct {
|
||||||
|
AccountName string `json:"AccountName"`
|
||||||
|
AccountID string `json:"AccountID"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Video struct {
|
||||||
|
VideoAddress string `json:"VideoAddress"`
|
||||||
|
VideoThumbnail string `json:"VideoThumbnail"`
|
||||||
|
}
|
||||||
|
type APIResponse struct {
|
||||||
|
Status int `json:"status"`
|
||||||
|
Data ApprovalResponse `json:"data"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Code int `json:"code"`
|
||||||
|
Error interface{} `json:"error"`
|
||||||
|
Err string `json:"err"`
|
||||||
|
Keys []string `json:"keys"`
|
||||||
|
Positions interface{} `json:"positions"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ApprovalResponse struct {
|
||||||
|
ID uint64 `json:"ID"`
|
||||||
|
Success bool `json:"Success"`
|
||||||
|
}
|
290
pkg/service/import/binding.go
Normal file
290
pkg/service/import/binding.go
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
package imports
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"fonchain-fiee/api/accountFiee"
|
||||||
|
account "fonchain-fiee/api/accountFiee"
|
||||||
|
"fonchain-fiee/api/bundle"
|
||||||
|
apiCast "fonchain-fiee/api/cast"
|
||||||
|
"fonchain-fiee/cmd/config"
|
||||||
|
"fonchain-fiee/pkg/e"
|
||||||
|
modelCast "fonchain-fiee/pkg/model/cast"
|
||||||
|
"fonchain-fiee/pkg/service"
|
||||||
|
"fonchain-fiee/pkg/service/cast"
|
||||||
|
"fonchain-fiee/pkg/service/upload"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/xuri/excelize/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ImportBind(c *gin.Context) {
|
||||||
|
var failedRecords []FailedRecord
|
||||||
|
var record []*apiCast.UpdateMediaAccountReq
|
||||||
|
// 1. 上传文件
|
||||||
|
excelFile, err := c.FormFile("excel")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, gin.H{"error": "缺少 Excel 文件 excel"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 2. 保存临时文件
|
||||||
|
tempDir := "tmp"
|
||||||
|
os.MkdirAll(tempDir, 0755)
|
||||||
|
excelPath := filepath.Join(tempDir, "artists.xlsx")
|
||||||
|
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "保存 Excel 失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(tempDir)
|
||||||
|
// 3. 读取 Excel 画家名单
|
||||||
|
artists, err := readArtistAccountInfo(excelPath)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "读取 Excel 失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 4. 绑定账号
|
||||||
|
for _, artist := range artists {
|
||||||
|
for accountType, accountInfo := range artist.Account {
|
||||||
|
if artist.Name == "韩风霞" || artist.Name == "荣小松" {
|
||||||
|
if accountType == 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res, err := service.AccountFieeProvider.UserList(context.Background(), &account.UserListRequest{
|
||||||
|
Name: artist.Name,
|
||||||
|
SubNum: artist.SubNum,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if res.Count == 0 {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: "未找到用户信息",
|
||||||
|
})
|
||||||
|
log.Printf("未找到用户信息")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if res != nil && len(res.UserList) > 0 {
|
||||||
|
var infoResp *account.UserInfoResponse
|
||||||
|
var err error
|
||||||
|
// 查询艺人的信息
|
||||||
|
if config.AppConfig.System.AppMode != "dev" {
|
||||||
|
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
|
||||||
|
ID: res.UserList[0].Id,
|
||||||
|
Domain: "app",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("查询艺人的信息失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("查询艺人的信息失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
infoResp = &accountFiee.UserInfoResponse{
|
||||||
|
Name: "小波",
|
||||||
|
TelNum: "18288888888",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, ok := apiCast.PlatformIDENUM_name[int32(accountType)]; !ok {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: errors.New("查询平台信息失败:").Error(),
|
||||||
|
})
|
||||||
|
log.Printf(errors.New("查询平台信息失败:").Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if err = cast.CheckUserBundleBalance(int32(res.UserList[0].Id), modelCast.BalanceTypeAccountValue); err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("查询检查用户账户数量失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("查询检查用户账户数量失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
_, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
|
||||||
|
UserId: int32(res.UserList[0].Id),
|
||||||
|
AccountConsumptionNumber: 1,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("增加账户数量失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("增加账户数量失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
mediaAccountInfoRes, err := service.CastProvider.UpdateMediaAccount(c, &apiCast.UpdateMediaAccountReq{
|
||||||
|
ArtistUuid: strconv.FormatUint(res.UserList[0].Id, 10),
|
||||||
|
PlatformID: accountType,
|
||||||
|
PlatformUserName: accountInfo.NickName,
|
||||||
|
PlatformUserID: accountInfo.AccountId,
|
||||||
|
ArtistName: infoResp.Name,
|
||||||
|
ArtistPhone: infoResp.TelNum,
|
||||||
|
ArtistPhoneAreaCode: infoResp.TelAreaCode,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("绑定账户信息失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("绑定账户信息失败: %s", err.Error()))
|
||||||
|
_, err1 := service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
|
||||||
|
UserId: int32(res.UserList[0].Id),
|
||||||
|
AccountConsumptionNumber: -1,
|
||||||
|
})
|
||||||
|
if err1 != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("绑定失败后减少余额失败: %s", err1.Error()),
|
||||||
|
})
|
||||||
|
log.Println(fmt.Sprintf("绑定失败后减少余额失败: %s", err1.Error()), errors.New(e.GetMsg(e.InvalidParams)))
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
record = append(record, &apiCast.UpdateMediaAccountReq{
|
||||||
|
MediaAccountUuid: mediaAccountInfoRes.MediaAccountUuid,
|
||||||
|
ArtistUuid: strconv.FormatUint(res.UserList[0].Id, 10),
|
||||||
|
PlatformID: accountType,
|
||||||
|
PlatformUserName: accountInfo.NickName,
|
||||||
|
PlatformUserID: accountInfo.AccountId,
|
||||||
|
ArtistName: infoResp.Name,
|
||||||
|
ArtistPhone: infoResp.TelNum,
|
||||||
|
ArtistPhoneAreaCode: infoResp.TelAreaCode,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
excelUrl, err := exportBindingRecordsToExcel(record)
|
||||||
|
// 5. 返回结果
|
||||||
|
service.Success(c, map[string]interface{}{
|
||||||
|
"excelUrl": excelUrl,
|
||||||
|
"failedRecords": failedRecords,
|
||||||
|
"accountInfo": artists,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func readArtistAccountInfo(excelPath string) ([]ArtistAccount, error) {
|
||||||
|
f, err := excelize.OpenFile(excelPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
sheetName := f.GetSheetName(0)
|
||||||
|
rows, err := f.GetRows(sheetName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Println("start read excel...")
|
||||||
|
var artists []ArtistAccount
|
||||||
|
for i, row := range rows {
|
||||||
|
if i == 0 || len(row) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
tmp := ArtistAccount{
|
||||||
|
Account: make(map[apiCast.PlatformIDENUM]AccountInfo),
|
||||||
|
Index: strings.TrimSpace(row[0]),
|
||||||
|
Name: strings.TrimSpace(row[1]),
|
||||||
|
SubNum: strings.TrimSpace(row[2]),
|
||||||
|
}
|
||||||
|
youtubeId, _ := f.GetCellValue(sheetName, fmt.Sprintf("D%d", i+1))
|
||||||
|
youtubeNickName, _ := f.GetCellValue(sheetName, fmt.Sprintf("E%d", i+1))
|
||||||
|
youtube := AccountInfo{
|
||||||
|
AccountId: strings.TrimSpace(youtubeId),
|
||||||
|
NickName: strings.TrimSpace(youtubeNickName),
|
||||||
|
}
|
||||||
|
tmp.Account[2] = youtube
|
||||||
|
|
||||||
|
insId, _ := f.GetCellValue(sheetName, fmt.Sprintf("F%d", i+1))
|
||||||
|
insNickName, _ := f.GetCellValue(sheetName, fmt.Sprintf("G%d", i+1))
|
||||||
|
ins := AccountInfo{
|
||||||
|
AccountId: strings.TrimSpace(insId),
|
||||||
|
NickName: strings.TrimSpace(insNickName),
|
||||||
|
}
|
||||||
|
tmp.Account[3] = ins
|
||||||
|
|
||||||
|
tiktokId, _ := f.GetCellValue(sheetName, fmt.Sprintf("H%d", i+1))
|
||||||
|
tiktokNiackName, _ := f.GetCellValue(sheetName, fmt.Sprintf("I%d", i+1))
|
||||||
|
tiktok := AccountInfo{
|
||||||
|
AccountId: strings.TrimSpace(tiktokId),
|
||||||
|
NickName: strings.TrimSpace(tiktokNiackName),
|
||||||
|
}
|
||||||
|
tmp.Account[1] = tiktok
|
||||||
|
|
||||||
|
artists = append(artists, tmp)
|
||||||
|
}
|
||||||
|
return artists, nil
|
||||||
|
}
|
||||||
|
func exportBindingRecordsToExcel(records []*apiCast.UpdateMediaAccountReq) (string, error) {
|
||||||
|
fileDir := "./runtime/import/"
|
||||||
|
filename := "绑定账户记录.xlsx"
|
||||||
|
filePath := filepath.Join(fileDir, filename)
|
||||||
|
|
||||||
|
// 创建目录
|
||||||
|
_ = os.MkdirAll(fileDir, os.ModePerm)
|
||||||
|
|
||||||
|
var f *excelize.File
|
||||||
|
sheet := "Sheet1"
|
||||||
|
|
||||||
|
// 判断文件是否存在
|
||||||
|
if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||||
|
f = excelize.NewFile()
|
||||||
|
f.NewSheet(sheet)
|
||||||
|
headers := []string{"序号", "MediaAccountUuid", "ArtistUuid", "PlatformID", "PlatformUserName", "PlatformUserID", "ArtistName", "ArtistPhone", "ArtistPhoneAreaCode"}
|
||||||
|
for col, h := range headers {
|
||||||
|
_ = f.SetCellValue(sheet, fmt.Sprintf("%c1", 'A'+col), h)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var err error
|
||||||
|
f, err = excelize.OpenFile(filePath)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 找到最后一行
|
||||||
|
rows, err := f.GetRows(sheet)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
startRow := len(rows) + 1
|
||||||
|
|
||||||
|
// 写入数据
|
||||||
|
for i, r := range records {
|
||||||
|
row := startRow + i
|
||||||
|
_ = f.SetCellValue(sheet, fmt.Sprintf("A%d", row), i+1)
|
||||||
|
_ = f.SetCellValue(sheet, fmt.Sprintf("B%d", row), r.MediaAccountUuid)
|
||||||
|
_ = f.SetCellValue(sheet, fmt.Sprintf("C%d", row), r.ArtistUuid)
|
||||||
|
_ = f.SetCellValue(sheet, fmt.Sprintf("D%d", row), r.PlatformID)
|
||||||
|
_ = f.SetCellValue(sheet, fmt.Sprintf("E%d", row), r.PlatformUserName)
|
||||||
|
_ = f.SetCellValue(sheet, fmt.Sprintf("F%d", row), r.PlatformUserID)
|
||||||
|
_ = f.SetCellValue(sheet, fmt.Sprintf("G%d", row), r.ArtistName)
|
||||||
|
_ = f.SetCellValue(sheet, fmt.Sprintf("H%d", row), r.ArtistPhone)
|
||||||
|
_ = f.SetCellValue(sheet, fmt.Sprintf("I%d", row), r.ArtistPhoneAreaCode)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存
|
||||||
|
if err = f.SaveAs(filePath); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
// 上传
|
||||||
|
excelUrl, err := upload.PutBos(filePath, "excel", true)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return excelUrl, nil
|
||||||
|
}
|
107
pkg/service/import/confirm.go
Normal file
107
pkg/service/import/confirm.go
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
package imports
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"fonchain-fiee/api/bundle"
|
||||||
|
apiCast "fonchain-fiee/api/cast"
|
||||||
|
"fonchain-fiee/pkg/service"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/xuri/excelize/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func WorkConfirm(c *gin.Context) { // 确认作品并扣除余量
|
||||||
|
excelFile, err := c.FormFile("excel")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, gin.H{"error": "缺少 Excel 文件 excel"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 2. 保存临时文件
|
||||||
|
tempDir := "tmp"
|
||||||
|
os.MkdirAll(tempDir, 0755)
|
||||||
|
excelPath := filepath.Join(tempDir, "artists.xlsx")
|
||||||
|
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "保存 Excel 失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(tempDir)
|
||||||
|
// 3. 读取 Excel 视频发布信息
|
||||||
|
artists, err := readCastWorkList(excelPath)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "读取 Excel 失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//遍历更新状态
|
||||||
|
var failedRecords []FailedRecord
|
||||||
|
for _, v := range artists {
|
||||||
|
artistId, err := strconv.ParseUint(v.ArtistId, 10, 32)
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: v.ArtistName,
|
||||||
|
Msg: fmt.Sprintf("解析用户ID失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("解析用户ID失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
_, err = service.BundleProvider.AddBundleBalance(c, &bundle.AddBundleBalanceReq{
|
||||||
|
UserId: int32(artistId),
|
||||||
|
VideoConsumptionNumber: 1,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: v.ArtistName,
|
||||||
|
Msg: fmt.Sprintf("扣除余额失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("扣除余额失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
_, err = service.CastProvider.UpdateStatus(c, &apiCast.UpdateStatusReq{
|
||||||
|
WorkAction: apiCast.WorkActionENUM_CONFIRM,
|
||||||
|
WorkUuid: v.WorkUuid,
|
||||||
|
ConfirmRemark: "",
|
||||||
|
ConfirmStatus: 1,
|
||||||
|
AutoPublish: apiCast.AutoPublishENUM_AutoPublish_FALSE,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: v.ArtistName,
|
||||||
|
Msg: fmt.Sprintf("更新状态失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("更新状态失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
service.Success(c, failedRecords)
|
||||||
|
}
|
||||||
|
func readCastWorkList(excelPath string) ([]ArtistVideoDetail, error) {
|
||||||
|
f, err := excelize.OpenFile(excelPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
sheetName := f.GetSheetName(0)
|
||||||
|
rows, err := f.GetRows(sheetName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Println("start read excel...")
|
||||||
|
var artistVideos []ArtistVideoDetail
|
||||||
|
for i, row := range rows {
|
||||||
|
if i == 0 || len(row) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
tmp := ArtistVideoDetail{
|
||||||
|
ArtistId: strings.TrimSpace(row[0]),
|
||||||
|
ArtistName: strings.TrimSpace(row[1]),
|
||||||
|
WorkUuid: strings.TrimSpace(row[2]),
|
||||||
|
}
|
||||||
|
artistVideos = append(artistVideos, tmp)
|
||||||
|
}
|
||||||
|
return artistVideos, nil
|
||||||
|
}
|
983
pkg/service/import/publish.go
Normal file
983
pkg/service/import/publish.go
Normal file
@ -0,0 +1,983 @@
|
|||||||
|
package imports
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"fonchain-fiee/api/accountFiee"
|
||||||
|
apiCast "fonchain-fiee/api/cast"
|
||||||
|
"fonchain-fiee/api/files"
|
||||||
|
"fonchain-fiee/cmd/config"
|
||||||
|
"fonchain-fiee/pkg/model"
|
||||||
|
modelCast "fonchain-fiee/pkg/model/cast"
|
||||||
|
"fonchain-fiee/pkg/service"
|
||||||
|
"fonchain-fiee/pkg/service/cast"
|
||||||
|
"fonchain-fiee/pkg/service/upload"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/mholt/archiver"
|
||||||
|
"github.com/xuri/excelize/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ImportPublish(c *gin.Context) {
|
||||||
|
// 1. 上传画家短视频详情文件
|
||||||
|
excelFile, err := c.FormFile("excel")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, gin.H{"error": "缺少 Excel 文件 excel"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
zipFile, err := c.FormFile("zip")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, gin.H{"error": "缺少 ZIP 文件"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 保存临时文件
|
||||||
|
tempDir := "tmp"
|
||||||
|
os.MkdirAll(tempDir, 0755)
|
||||||
|
excelPath := filepath.Join(tempDir, "artists.xlsx")
|
||||||
|
zipPath := filepath.Join(tempDir, "archive.zip")
|
||||||
|
fmt.Println("before save excel...")
|
||||||
|
now := time.Now()
|
||||||
|
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "保存 Excel 失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Println("save excel success", time.Since(now))
|
||||||
|
if err = c.SaveUploadedFile(zipFile, zipPath); err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "保存 ZIP 文件失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Println("save zip success", time.Since(now))
|
||||||
|
// 3. 解压 ZIP
|
||||||
|
unzipPath := filepath.Join(tempDir, "unzipped")
|
||||||
|
if _, err = os.Stat(unzipPath); err == nil {
|
||||||
|
// 路径已存在,删除
|
||||||
|
if removeErr := os.RemoveAll(unzipPath); removeErr != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "清理已存在解压目录失败: " + removeErr.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Println("开始解压...")
|
||||||
|
os.MkdirAll(unzipPath, 0755)
|
||||||
|
if err = archiver.Unarchive(zipPath, unzipPath); err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "解压 ZIP 失败: " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
entries, err := os.ReadDir(unzipPath)
|
||||||
|
if err != nil || len(entries) == 0 {
|
||||||
|
c.JSON(500, gin.H{"error": "读取解压目录失败或目录为空"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(entries) == 1 && entries[0].IsDir() {
|
||||||
|
// 说明解压后多了一层目录,把它设为新的 unzipPath
|
||||||
|
unzipPath = filepath.Join(unzipPath, entries[0].Name())
|
||||||
|
}
|
||||||
|
fmt.Println("开始读取excel...")
|
||||||
|
defer os.RemoveAll(tempDir)
|
||||||
|
// 4. 读取 Excel 画家名单, 匹配视频和图片
|
||||||
|
artists, err := readArtistVideoInfo(excelPath, unzipPath)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "读取 Excel 失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 5.发布视频
|
||||||
|
var failedRecords []FailedRecord
|
||||||
|
var artistResp []ArtistVideoDetail
|
||||||
|
fmt.Println("artists num: ", len(artists))
|
||||||
|
for _, artist := range artists {
|
||||||
|
var infoResp *accountFiee.UserInfoResponse
|
||||||
|
list, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
|
||||||
|
Name: artist.Name,
|
||||||
|
SubNum: artist.SubNum,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if len(list.UserList) == 0 {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("未找到用户信息: %s", artist.Name),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("未找到用户信息: %s", artist.Name))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if list != nil && len(list.UserList) > 0 {
|
||||||
|
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
|
||||||
|
ID: list.UserList[0].Id,
|
||||||
|
Domain: "app",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = cast.CheckUserBundleBalance(int32(list.UserList[0].Id), modelCast.BalanceTypeVideoValue); err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
//自媒体账号
|
||||||
|
accountList, err := service.CastProvider.MediaUserList(c, &apiCast.MediaUserListReq{
|
||||||
|
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
|
||||||
|
ArtistVal: artist.Name,
|
||||||
|
Page: 1,
|
||||||
|
PageSize: 10,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if accountList == nil || len(accountList.Data) == 0 {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: "自媒体账号数量为0",
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("自媒体账号,账号数量:%d", len(accountList.Data)))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
mediaAccountUuids := []string{}
|
||||||
|
mediaAccountNames := []string{}
|
||||||
|
platformIDs := []apiCast.PlatformIDENUM{}
|
||||||
|
for _, info := range accountList.Data {
|
||||||
|
if info.PlatformID == 2 && ((artist.Id == "31" && info.ArtistName == "荣小松") ||
|
||||||
|
(artist.Id == "72" && info.ArtistName == "韩风霞")) {
|
||||||
|
continue // 跳过
|
||||||
|
}
|
||||||
|
mediaAccountUuids = append(mediaAccountUuids, info.MediaAccountUuid)
|
||||||
|
mediaAccountNames = append(mediaAccountNames, info.PlatformUserName)
|
||||||
|
platformIDs = append(platformIDs, apiCast.PlatformIDENUM(info.PlatformID))
|
||||||
|
}
|
||||||
|
newCtx := cast.NewCtxWithUserInfo(c)
|
||||||
|
resp, err := service.CastProvider.UpdateWorkVideo(newCtx, &apiCast.UpdateWorkVideoReq{
|
||||||
|
Title: artist.Title,
|
||||||
|
Content: artist.Title,
|
||||||
|
VideoUrl: artist.Video,
|
||||||
|
CoverUrl: artist.Img,
|
||||||
|
AutoPublish: apiCast.AutoPublishENUM_AutoPublish_FALSE,
|
||||||
|
MediaAccountUuids: mediaAccountUuids,
|
||||||
|
MediaAccountNames: mediaAccountNames,
|
||||||
|
PlatformIDs: platformIDs,
|
||||||
|
PublishConfig1: &apiCast.PublishConfig{
|
||||||
|
CanComment: 1,
|
||||||
|
CanJoin: 1,
|
||||||
|
CanQuote: 1,
|
||||||
|
ForbidComment: 2,
|
||||||
|
IsAI: 1,
|
||||||
|
PublicType: 1,
|
||||||
|
},
|
||||||
|
PublishConfig2: &apiCast.PublishConfig{
|
||||||
|
CanComment: 1,
|
||||||
|
CanJoin: 1,
|
||||||
|
CanQuote: 1,
|
||||||
|
ForbidComment: 2,
|
||||||
|
IsAI: 1,
|
||||||
|
PublicType: 1,
|
||||||
|
},
|
||||||
|
PublishConfig3: &apiCast.PublishConfig{
|
||||||
|
CanComment: 1,
|
||||||
|
CanJoin: 1,
|
||||||
|
CanQuote: 1,
|
||||||
|
ForbidComment: 1,
|
||||||
|
IsAI: 1,
|
||||||
|
PublicType: 1,
|
||||||
|
},
|
||||||
|
Action: "submit",
|
||||||
|
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
|
||||||
|
ArtistName: infoResp.Name,
|
||||||
|
ArtistPhone: infoResp.TelNum,
|
||||||
|
ArtistPhoneAreaCode: infoResp.TelAreaCode,
|
||||||
|
Source: 2,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
artistResp = append(artistResp, ArtistVideoDetail{
|
||||||
|
Id: artist.Id,
|
||||||
|
ArtistName: artist.Name,
|
||||||
|
SubNum: artist.SubNum,
|
||||||
|
Title: artist.Title,
|
||||||
|
WorkUuid: resp.WorkUuid,
|
||||||
|
Youtube: artist.Youtube,
|
||||||
|
Instagram: artist.Instagram,
|
||||||
|
TikTok: artist.TikTok,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// excelUrl, err := exportPublishRecordsToExcel(artistResp)
|
||||||
|
// if err != nil {
|
||||||
|
// service.Error(c, err)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 6. 返回结果
|
||||||
|
service.Success(c, map[string]interface{}{
|
||||||
|
//"excelUrl": excelUrl,
|
||||||
|
"failedRecords": failedRecords,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
func ImportPublishV2(c *gin.Context) {
|
||||||
|
// 1. 上传画家短视频详情文件
|
||||||
|
excelFile, err := c.FormFile("excel")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, gin.H{"error": "缺少 Excel 文件 excel"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
zipFile, err := c.FormFile("zip")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, gin.H{"error": "缺少 ZIP 文件"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 保存临时文件
|
||||||
|
tempDir := "tmp"
|
||||||
|
os.MkdirAll(tempDir, 0755)
|
||||||
|
excelPath := filepath.Join(tempDir, "artists.xlsx")
|
||||||
|
zipPath := filepath.Join(tempDir, "archive.zip")
|
||||||
|
fmt.Println("before save excel...")
|
||||||
|
now := time.Now()
|
||||||
|
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "保存 Excel 失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Println("save excel success", time.Since(now))
|
||||||
|
if err = c.SaveUploadedFile(zipFile, zipPath); err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "保存 ZIP 文件失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Println("save zip success", time.Since(now))
|
||||||
|
// 3. 解压 ZIP
|
||||||
|
unzipPath := filepath.Join(tempDir, "unzipped")
|
||||||
|
if _, err = os.Stat(unzipPath); err == nil {
|
||||||
|
// 路径已存在,删除
|
||||||
|
if removeErr := os.RemoveAll(unzipPath); removeErr != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "清理已存在解压目录失败: " + removeErr.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Println("开始解压...")
|
||||||
|
os.MkdirAll(unzipPath, 0755)
|
||||||
|
if err = archiver.Unarchive(zipPath, unzipPath); err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "解压 ZIP 失败: " + err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
entries, err := os.ReadDir(unzipPath)
|
||||||
|
if err != nil || len(entries) == 0 {
|
||||||
|
c.JSON(500, gin.H{"error": "读取解压目录失败或目录为空"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Println("jieya后...")
|
||||||
|
if len(entries) == 1 && entries[0].IsDir() {
|
||||||
|
// 说明解压后多了一层目录,把它设为新的 unzipPath
|
||||||
|
unzipPath = filepath.Join(unzipPath, entries[0].Name())
|
||||||
|
}
|
||||||
|
fmt.Println("开始读取excel...")
|
||||||
|
defer os.RemoveAll(tempDir)
|
||||||
|
// 4. 读取 Excel 画家名单, 匹配视频和图片
|
||||||
|
artists, err := readArtistVideoInfo(excelPath, unzipPath)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "读取 Excel 失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 5.发布视频
|
||||||
|
var failedRecords []FailedRecord
|
||||||
|
var artistResp []ArtistVideoDetail
|
||||||
|
fmt.Println("artists num: ", len(artists))
|
||||||
|
for _, artist := range artists {
|
||||||
|
var infoResp *accountFiee.UserInfoResponse
|
||||||
|
list, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
|
||||||
|
Name: artist.Name,
|
||||||
|
SubNum: artist.SubNum,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if len(list.UserList) == 0 {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("未找到用户信息: %s", artist.Name),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("未找到用户信息: %s", artist.Name))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if list != nil && len(list.UserList) > 0 {
|
||||||
|
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
|
||||||
|
ID: list.UserList[0].Id,
|
||||||
|
Domain: "app",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = cast.CheckUserBundleBalance(int32(list.UserList[0].Id), modelCast.BalanceTypeVideoValue); err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
//自媒体账号
|
||||||
|
accountList, err := service.CastProvider.MediaUserList(c, &apiCast.MediaUserListReq{
|
||||||
|
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
|
||||||
|
ArtistVal: artist.Name,
|
||||||
|
Page: 1,
|
||||||
|
PageSize: 10,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if accountList == nil || len(accountList.Data) == 0 {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: "自媒体账号数量为0",
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("自媒体账号,账号数量:%d", len(accountList.Data)))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
mediaAccountUuids := []string{}
|
||||||
|
mediaAccountNames := []string{}
|
||||||
|
platformIDs := []apiCast.PlatformIDENUM{}
|
||||||
|
for _, info := range accountList.Data {
|
||||||
|
if info.PlatformID == 2 && ((artist.Id == "31" && info.ArtistName == "荣小松") ||
|
||||||
|
(artist.Id == "72" && info.ArtistName == "韩风霞")) {
|
||||||
|
continue // 跳过
|
||||||
|
}
|
||||||
|
mediaAccountUuids = append(mediaAccountUuids, info.MediaAccountUuid)
|
||||||
|
mediaAccountNames = append(mediaAccountNames, info.PlatformUserName)
|
||||||
|
platformIDs = append(platformIDs, apiCast.PlatformIDENUM(info.PlatformID))
|
||||||
|
}
|
||||||
|
newCtx := cast.NewCtxWithUserInfo(c)
|
||||||
|
resp, err := service.CastProvider.UpdateWorkVideo(newCtx, &apiCast.UpdateWorkVideoReq{
|
||||||
|
Title: artist.Title,
|
||||||
|
Content: artist.Title,
|
||||||
|
VideoUrl: artist.Video,
|
||||||
|
CoverUrl: artist.Img,
|
||||||
|
MediaAccountUuids: mediaAccountUuids,
|
||||||
|
MediaAccountNames: mediaAccountNames,
|
||||||
|
PlatformIDs: platformIDs,
|
||||||
|
PublishConfig1: &apiCast.PublishConfig{
|
||||||
|
CanComment: 1,
|
||||||
|
CanJoin: 1,
|
||||||
|
CanQuote: 1,
|
||||||
|
ForbidComment: 2,
|
||||||
|
IsAI: 1,
|
||||||
|
PublicType: 1,
|
||||||
|
},
|
||||||
|
PublishConfig2: &apiCast.PublishConfig{
|
||||||
|
CanComment: 1,
|
||||||
|
CanJoin: 1,
|
||||||
|
CanQuote: 1,
|
||||||
|
ForbidComment: 2,
|
||||||
|
IsAI: 1,
|
||||||
|
PublicType: 1,
|
||||||
|
},
|
||||||
|
PublishConfig3: &apiCast.PublishConfig{
|
||||||
|
CanComment: 1,
|
||||||
|
CanJoin: 1,
|
||||||
|
CanQuote: 1,
|
||||||
|
ForbidComment: 1,
|
||||||
|
IsAI: 1,
|
||||||
|
PublicType: 1,
|
||||||
|
},
|
||||||
|
Action: "submit",
|
||||||
|
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
|
||||||
|
ArtistName: infoResp.Name,
|
||||||
|
ArtistPhone: infoResp.TelNum,
|
||||||
|
ArtistPhoneAreaCode: infoResp.TelAreaCode,
|
||||||
|
Source: 2,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
artistResp = append(artistResp, ArtistVideoDetail{
|
||||||
|
Id: artist.Id,
|
||||||
|
ArtistName: artist.Name,
|
||||||
|
SubNum: artist.SubNum,
|
||||||
|
Title: artist.Title,
|
||||||
|
WorkUuid: resp.WorkUuid,
|
||||||
|
Youtube: artist.Youtube,
|
||||||
|
Instagram: artist.Instagram,
|
||||||
|
TikTok: artist.TikTok,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// excelUrl, err := exportPublishRecordsToExcel(artistResp)
|
||||||
|
// if err != nil {
|
||||||
|
// service.Error(c, err)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 6. 返回结果
|
||||||
|
service.Success(c, map[string]interface{}{
|
||||||
|
//"excelUrl": excelUrl,
|
||||||
|
"failedRecords": failedRecords,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
func readArtistVideoInfo(excelPath, unzipPath string) ([]ArtistMedia, error) {
|
||||||
|
log.Println(unzipPath)
|
||||||
|
f, err := excelize.OpenFile(excelPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
sheetName := f.GetSheetName(0)
|
||||||
|
rows, err := f.GetRows(sheetName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Println("start read excel")
|
||||||
|
var artists []ArtistMedia
|
||||||
|
for i, row := range rows {
|
||||||
|
if i == 0 || i == 1 || len(row) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
id, _ := f.GetCellValue(sheetName, fmt.Sprintf("A%d", i+1))
|
||||||
|
if id != "" {
|
||||||
|
id = strings.TrimSpace(id)
|
||||||
|
}
|
||||||
|
artistName, _ := f.GetCellValue(sheetName, fmt.Sprintf("B%d", i+1))
|
||||||
|
if artistName != "" {
|
||||||
|
artistName = strings.TrimSpace(artistName)
|
||||||
|
}
|
||||||
|
title, _ := f.GetCellValue(sheetName, fmt.Sprintf("C%d", i+1))
|
||||||
|
if title != "" {
|
||||||
|
title = strings.TrimSpace(title)
|
||||||
|
}
|
||||||
|
youtube, _ := f.GetCellValue(sheetName, fmt.Sprintf("D%d", i+1))
|
||||||
|
if youtube != "" {
|
||||||
|
youtube = strings.TrimSpace(youtube)
|
||||||
|
}
|
||||||
|
instagram, _ := f.GetCellValue(sheetName, fmt.Sprintf("E%d", i+1))
|
||||||
|
if instagram != "" {
|
||||||
|
instagram = strings.TrimSpace(instagram)
|
||||||
|
}
|
||||||
|
tiktok, _ := f.GetCellValue(sheetName, fmt.Sprintf("F%d", i+1))
|
||||||
|
if tiktok != "" {
|
||||||
|
tiktok = strings.TrimSpace(tiktok)
|
||||||
|
}
|
||||||
|
subNum, _ := f.GetCellValue(sheetName, fmt.Sprintf("G%d", i+1))
|
||||||
|
if subNum != "" {
|
||||||
|
subNum = strings.TrimSpace(subNum)
|
||||||
|
}
|
||||||
|
artists = append(artists, ArtistMedia{
|
||||||
|
Id: id,
|
||||||
|
Name: artistName,
|
||||||
|
Title: title,
|
||||||
|
Youtube: youtube,
|
||||||
|
Instagram: instagram,
|
||||||
|
TikTok: tiktok,
|
||||||
|
SubNum: subNum,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
artists, err = matchArtistMedia(artists, unzipPath)
|
||||||
|
return artists, nil
|
||||||
|
}
|
||||||
|
func matchArtistMedia(artists []ArtistMedia, unzipPath string) ([]ArtistMedia, error) {
|
||||||
|
var err error
|
||||||
|
var res []ArtistMedia
|
||||||
|
for _, artist := range artists {
|
||||||
|
var oldVideoPath, oldImgPath string
|
||||||
|
for _, ext := range []string{".jpg", ".png", ".jpeg"} {
|
||||||
|
p := fmt.Sprintf("%s/%s/%s%s", unzipPath, artist.Name, artist.Id, ext)
|
||||||
|
if _, err = os.Stat(p); err == nil {
|
||||||
|
oldImgPath = p
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 检查源文件是否存在
|
||||||
|
if _, err = os.Stat(oldImgPath); os.IsNotExist(err) {
|
||||||
|
fmt.Println("图片不存在: ", artist.Id, artist.Name, oldImgPath)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, ext := range []string{".mp4", ".mov"} {
|
||||||
|
p := fmt.Sprintf("%s/%s/%s%s", unzipPath, artist.Name, artist.Id, ext)
|
||||||
|
if _, err = os.Stat(p); err == nil {
|
||||||
|
oldVideoPath = p
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if oldVideoPath == "" {
|
||||||
|
fmt.Println("视频不存在: ", artist.Id, artist.Name, oldVideoPath)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
baseDir := filepath.Join(unzipPath, artist.Name)
|
||||||
|
if err = os.MkdirAll(baseDir, 0755); err != nil {
|
||||||
|
log.Println("创建目录失败:", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Println("创建目录成功:", baseDir)
|
||||||
|
|
||||||
|
// 重命名
|
||||||
|
now := time.Now().Unix()
|
||||||
|
imgPath := fmt.Sprintf("%s/%s/%s_%d.jpg", unzipPath, artist.Name, artist.Id, now)
|
||||||
|
videoPath := fmt.Sprintf("%s/%s/%s_%d.mp4", unzipPath, artist.Name, artist.Id, now)
|
||||||
|
if err = os.Rename(oldImgPath, imgPath); err != nil {
|
||||||
|
log.Println("图片:"+oldImgPath+"重命名失败:", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err = os.Rename(oldVideoPath, videoPath); err != nil {
|
||||||
|
log.Println("视频:"+oldVideoPath+"重命名失败:", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
//转为url
|
||||||
|
content, err := os.ReadFile(videoPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err = UploadToAnotherService(context.Background(), content, filepath.Base(videoPath)); err != nil {
|
||||||
|
log.Println("上传视频失败:", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var httpType string
|
||||||
|
if config.AppConfig.System.AppMode == "dev" {
|
||||||
|
url := "114.218.158.24:9020"
|
||||||
|
httpType = fmt.Sprintf("%s%s", model.HttpType, url)
|
||||||
|
} else {
|
||||||
|
url := "saas.fiee.com"
|
||||||
|
httpType = fmt.Sprintf("%s%s", model.HttpsType, url)
|
||||||
|
}
|
||||||
|
baseUrl := fmt.Sprintf("%s/api/fiee/resource/raw/", httpType)
|
||||||
|
videoUrl := baseUrl + filepath.Base(videoPath)
|
||||||
|
imgUrl, err := upload.PutBos(filepath.ToSlash(imgPath), "image", false)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("上传图片失败:", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
tmp := artist
|
||||||
|
tmp.Id = artist.Id
|
||||||
|
tmp.Name = artist.Name
|
||||||
|
tmp.Title = artist.Title
|
||||||
|
tmp.Img = imgUrl
|
||||||
|
//tmp.Video = filepath.ToSlash(videoPath)
|
||||||
|
tmp.Video = videoUrl
|
||||||
|
tmp.SubNum = artist.SubNum
|
||||||
|
res = append(res, tmp)
|
||||||
|
}
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func UploadToAnotherService(ctx context.Context, fileData []byte, path string) error {
|
||||||
|
const chunkSize = 4*1024*1024 - 100
|
||||||
|
_, err := service.FilesProvider.TusCreate(ctx, &files.TusCreateReq{
|
||||||
|
Path: path,
|
||||||
|
UserSpacePath: "",
|
||||||
|
Override: true,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
log.Println("create success ......**********")
|
||||||
|
offset := int64(0)
|
||||||
|
totalSize := int64(len(fileData))
|
||||||
|
for offset < totalSize {
|
||||||
|
end := offset + chunkSize
|
||||||
|
if end > totalSize {
|
||||||
|
end = totalSize
|
||||||
|
}
|
||||||
|
chunk := fileData[offset:end]
|
||||||
|
_, err = service.FilesProvider.TusUpload(ctx, &files.TusUploadReq{
|
||||||
|
Path: path,
|
||||||
|
UploadOffset: offset,
|
||||||
|
Content: chunk,
|
||||||
|
UserSpacePath: "",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("上传 offset=%d chunk 失败: %w", offset, err)
|
||||||
|
}
|
||||||
|
log.Printf("upload chunk: %d - %d success\n", offset, end)
|
||||||
|
offset = end
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// func exportPublishRecordsToExcel(artistInfos []ArtistVideoDetail) (string, error) {
|
||||||
|
// fileDir := "./runtime/import/"
|
||||||
|
// filename := "画家视频详情记录0922.xlsx"
|
||||||
|
// filePath := filepath.Join(fileDir, filename)
|
||||||
|
|
||||||
|
// _ = os.MkdirAll(fileDir, os.ModePerm)
|
||||||
|
|
||||||
|
// var f *excelize.File
|
||||||
|
// sheet := "Sheet1"
|
||||||
|
|
||||||
|
// // 判断文件是否存在
|
||||||
|
// if _, err := os.Stat(filePath); os.IsNotExist(err) {
|
||||||
|
// // 文件不存在,新建文件和Sheet
|
||||||
|
// f = excelize.NewFile()
|
||||||
|
// f.SetSheetName(f.GetSheetName(0), sheet)
|
||||||
|
|
||||||
|
// // 写表头
|
||||||
|
// headers := []string{"序号", "画家名", "标题", "uuid", "youtube", "instagram", "tiktok", "用户编号"}
|
||||||
|
// for col, h := range headers {
|
||||||
|
// _ = f.SetCellValue(sheet, string('A'+col)+"1", h)
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // 文件存在,打开
|
||||||
|
// var err error
|
||||||
|
// f, err = excelize.OpenFile(filePath)
|
||||||
|
// if err != nil {
|
||||||
|
// return "", err
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 找到最后一行,追加数据
|
||||||
|
// rows, err := f.GetRows(sheet)
|
||||||
|
// if err != nil {
|
||||||
|
// return "", err
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 计算下一行,从表头之后开始
|
||||||
|
// startRow := len(rows) + 1
|
||||||
|
// if startRow == 1 {
|
||||||
|
// startRow = 2 // 文件新建或没有数据,从第2行开始
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 写数据
|
||||||
|
// for i, artistInfo := range artistInfos {
|
||||||
|
// row := startRow + i
|
||||||
|
// _ = f.SetCellValue(sheet, "A"+strconv.Itoa(row), row-1) // 序号连续
|
||||||
|
// _ = f.SetCellValue(sheet, "B"+strconv.Itoa(row), artistInfo.ArtistName)
|
||||||
|
// _ = f.SetCellValue(sheet, "C"+strconv.Itoa(row), artistInfo.Title)
|
||||||
|
// _ = f.SetCellValue(sheet, "D"+strconv.Itoa(row), artistInfo.WorkUuid)
|
||||||
|
// _ = f.SetCellValue(sheet, "E"+strconv.Itoa(row), artistInfo.Youtube)
|
||||||
|
// _ = f.SetCellValue(sheet, "F"+strconv.Itoa(row), artistInfo.Instagram)
|
||||||
|
// _ = f.SetCellValue(sheet, "G"+strconv.Itoa(row), artistInfo.TikTok)
|
||||||
|
// _ = f.SetCellValue(sheet, "H"+strconv.Itoa(row), artistInfo.SubNum)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 保存文件
|
||||||
|
// if err = f.SaveAs(filePath); err != nil {
|
||||||
|
// fmt.Println("saveAs err: ", err)
|
||||||
|
// return "", err
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 上传
|
||||||
|
// excelUrl, err := upload.PutBos(filePath, "excel", false)
|
||||||
|
// if err != nil {
|
||||||
|
// return "", err
|
||||||
|
// }
|
||||||
|
// return excelUrl, nil
|
||||||
|
// }
|
||||||
|
|
||||||
|
func ImportPublishV3(c *gin.Context) {
|
||||||
|
// 1. 上传画家短视频详情文件
|
||||||
|
excelFile, err := c.FormFile("excel")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, gin.H{"error": "缺少 Excel 文件 excel"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 2. 保存临时文件
|
||||||
|
tempDir := "tmp"
|
||||||
|
os.MkdirAll(tempDir, 0755)
|
||||||
|
excelPath := filepath.Join(tempDir, "artists.xlsx")
|
||||||
|
|
||||||
|
if err = c.SaveUploadedFile(excelFile, excelPath); err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "保存 Excel 失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Println("save excel...")
|
||||||
|
defer os.RemoveAll(tempDir)
|
||||||
|
|
||||||
|
// 3. 读取 Excel 画家名单, 匹配视频和图片
|
||||||
|
artists, err := readArtistVideoInfoV2(c, excelPath)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(500, gin.H{"error": "读取 Excel 失败"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 4.发布视频
|
||||||
|
var failedRecords []FailedRecord
|
||||||
|
//var artistResp []ArtistVideoDetail
|
||||||
|
for _, artist := range artists {
|
||||||
|
var infoResp *accountFiee.UserInfoResponse
|
||||||
|
list, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
|
||||||
|
Name: artist.Name,
|
||||||
|
SubNum: artist.SubNum,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if len(list.UserList) == 0 {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("未找到用户信息: %s", artist.Name),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("未找到用户信息: %s", artist.Name))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if list != nil && len(list.UserList) > 0 {
|
||||||
|
infoResp, err = service.AccountFieeProvider.Info(context.Background(), &accountFiee.InfoRequest{
|
||||||
|
ID: list.UserList[0].Id,
|
||||||
|
Domain: "app",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("获取用户信息失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = cast.CheckUserBundleBalance(int32(list.UserList[0].Id), modelCast.BalanceTypeVideoValue); err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("检查用户视频可消耗数量: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
//自媒体账号
|
||||||
|
accountList, err := service.CastProvider.MediaUserList(c, &apiCast.MediaUserListReq{
|
||||||
|
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
|
||||||
|
ArtistVal: artist.Name,
|
||||||
|
Page: 1,
|
||||||
|
PageSize: 10,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("自媒体账号数量获取失败: %s,账号数量:%d", err.Error(), len(accountList.Data)))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if accountList == nil || len(accountList.Data) == 0 {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: "自媒体账号数量为0",
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("自媒体账号,账号数量:%d", len(accountList.Data)))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
mediaAccountUuids := []string{}
|
||||||
|
mediaAccountNames := []string{}
|
||||||
|
platformIDs := []apiCast.PlatformIDENUM{}
|
||||||
|
for _, info := range accountList.Data {
|
||||||
|
mediaAccountUuids = append(mediaAccountUuids, info.MediaAccountUuid)
|
||||||
|
mediaAccountNames = append(mediaAccountNames, info.PlatformUserName)
|
||||||
|
platformIDs = append(platformIDs, apiCast.PlatformIDENUM(info.PlatformID))
|
||||||
|
}
|
||||||
|
newCtx := cast.NewCtxWithUserInfo(c)
|
||||||
|
_, err = service.CastProvider.UpdateWorkVideo(newCtx, &apiCast.UpdateWorkVideoReq{
|
||||||
|
Title: artist.Title,
|
||||||
|
Content: artist.Title,
|
||||||
|
VideoUrl: artist.Video,
|
||||||
|
CoverUrl: artist.Img,
|
||||||
|
MediaAccountUuids: mediaAccountUuids,
|
||||||
|
MediaAccountNames: mediaAccountNames,
|
||||||
|
PlatformIDs: platformIDs,
|
||||||
|
PublishConfig1: &apiCast.PublishConfig{
|
||||||
|
CanComment: 1,
|
||||||
|
CanJoin: 1,
|
||||||
|
CanQuote: 1,
|
||||||
|
ForbidComment: 2,
|
||||||
|
IsAI: 1,
|
||||||
|
PublicType: 1,
|
||||||
|
},
|
||||||
|
PublishConfig2: &apiCast.PublishConfig{
|
||||||
|
CanComment: 1,
|
||||||
|
CanJoin: 1,
|
||||||
|
CanQuote: 1,
|
||||||
|
ForbidComment: 2,
|
||||||
|
IsAI: 1,
|
||||||
|
PublicType: 1,
|
||||||
|
},
|
||||||
|
PublishConfig3: &apiCast.PublishConfig{
|
||||||
|
CanComment: 1,
|
||||||
|
CanJoin: 1,
|
||||||
|
CanQuote: 1,
|
||||||
|
ForbidComment: 1,
|
||||||
|
IsAI: 1,
|
||||||
|
PublicType: 1,
|
||||||
|
},
|
||||||
|
Action: "submit",
|
||||||
|
ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10),
|
||||||
|
ArtistName: infoResp.Name,
|
||||||
|
ArtistPhone: infoResp.TelNum,
|
||||||
|
ArtistPhoneAreaCode: infoResp.TelAreaCode,
|
||||||
|
Source: 2,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedRecords = append(failedRecords, FailedRecord{
|
||||||
|
Name: artist.Name,
|
||||||
|
Msg: fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()),
|
||||||
|
})
|
||||||
|
log.Printf(fmt.Sprintf("发布"+artist.Name+"视频"+artist.Title+"失败: %s", err.Error()))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// artistResp = append(artistResp, ArtistVideoDetail{
|
||||||
|
// Id: artist.Id,
|
||||||
|
// ArtistName: artist.Name,
|
||||||
|
// SubNum: artist.SubNum,
|
||||||
|
// Title: artist.Title,
|
||||||
|
// WorkUuid: resp.WorkUuid,
|
||||||
|
// Youtube: artist.Youtube,
|
||||||
|
// Instagram: artist.Instagram,
|
||||||
|
// TikTok: artist.TikTok,
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
// excelUrl, err := exportPublishRecordsToExcel(artistResp)
|
||||||
|
// if err != nil {
|
||||||
|
// service.Error(c, err)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 6. 返回结果
|
||||||
|
service.Success(c, map[string]interface{}{
|
||||||
|
//"excelUrl": excelUrl,
|
||||||
|
"failedRecords": failedRecords,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
func readArtistVideoInfoV2(ctx *gin.Context, excelPath string) ([]ArtistMedia, error) {
|
||||||
|
f, err := excelize.OpenFile(excelPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
sheetName := f.GetSheetName(0)
|
||||||
|
rows, err := f.GetRows(sheetName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Println("start read excel")
|
||||||
|
var artists []ArtistMedia
|
||||||
|
for i, row := range rows {
|
||||||
|
if i == 0 || i == 1 || len(row) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
id, _ := f.GetCellValue(sheetName, fmt.Sprintf("A%d", i+1))
|
||||||
|
if id != "" {
|
||||||
|
id = strings.TrimSpace(id)
|
||||||
|
}
|
||||||
|
artistName, _ := f.GetCellValue(sheetName, fmt.Sprintf("B%d", i+1))
|
||||||
|
if artistName != "" {
|
||||||
|
artistName = strings.TrimSpace(artistName)
|
||||||
|
}
|
||||||
|
title, _ := f.GetCellValue(sheetName, fmt.Sprintf("C%d", i+1))
|
||||||
|
if title != "" {
|
||||||
|
title = strings.TrimSpace(title)
|
||||||
|
}
|
||||||
|
subNum, _ := f.GetCellValue(sheetName, fmt.Sprintf("G%d", i+1))
|
||||||
|
if subNum != "" {
|
||||||
|
subNum = strings.TrimSpace(subNum)
|
||||||
|
}
|
||||||
|
artists = append(artists, ArtistMedia{
|
||||||
|
Id: id,
|
||||||
|
Name: artistName,
|
||||||
|
Title: title,
|
||||||
|
SubNum: subNum,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
artists, err = matchArtistMediaV3(ctx, artists)
|
||||||
|
return artists, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func matchArtistMediaV3(ctx *gin.Context, artists []ArtistMedia) ([]ArtistMedia, error) {
|
||||||
|
var medias = make(map[string][]*files.Items)
|
||||||
|
var res []ArtistMedia
|
||||||
|
for _, artist := range artists {
|
||||||
|
mediaPath := "fiee2/" + artist.Name
|
||||||
|
imgPath := fmt.Sprintf("%s/%s/%s.jpg", mediaPath, artist.Name, artist.Title)
|
||||||
|
videoPath := fmt.Sprintf("%s/%s/%s.mp4", mediaPath, artist.Name, artist.Title)
|
||||||
|
//判断文件是否存在
|
||||||
|
if _, ok := medias[artist.Name]; !ok {
|
||||||
|
sortBy := ctx.DefaultQuery("sortBy", "name")
|
||||||
|
sortAsc, _ := strconv.ParseBool(ctx.DefaultQuery("sortAsc", "true"))
|
||||||
|
resp, err := service.FilesProvider.List(ctx, &files.FileListReq{
|
||||||
|
Path: mediaPath,
|
||||||
|
UserSpacePath: "",
|
||||||
|
Sorting: &files.Sorting{
|
||||||
|
By: sortBy,
|
||||||
|
Asc: sortAsc,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
medias[artist.Name] = resp.Items
|
||||||
|
}
|
||||||
|
isExist := false
|
||||||
|
for _, media := range medias[artist.Name] {
|
||||||
|
if media.Name == artist.Title+".jpg" || media.Name == artist.Title+".mp4" || media.Name == artist.Title+".mov" {
|
||||||
|
isExist = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !isExist {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var httpType string
|
||||||
|
if config.AppConfig.System.AppMode == "dev" {
|
||||||
|
url := "114.218.158.24:9020"
|
||||||
|
httpType = fmt.Sprintf("%s%s", model.HttpType, url)
|
||||||
|
} else {
|
||||||
|
url := "saas.fiee.com"
|
||||||
|
httpType = fmt.Sprintf("%s%s", model.HttpsType, url)
|
||||||
|
}
|
||||||
|
baseUrl := fmt.Sprintf("%s/api/fiee/resource/raw/", httpType)
|
||||||
|
videoUrl := baseUrl + filepath.Base(videoPath)
|
||||||
|
imgUrl := baseUrl + filepath.Base(imgPath)
|
||||||
|
tmp := artist
|
||||||
|
tmp.Id = artist.Id
|
||||||
|
tmp.Name = artist.Name
|
||||||
|
tmp.Title = artist.Title
|
||||||
|
tmp.Img = imgUrl
|
||||||
|
tmp.Video = videoUrl
|
||||||
|
tmp.SubNum = artist.SubNum
|
||||||
|
res = append(res, tmp)
|
||||||
|
}
|
||||||
|
return res, nil
|
||||||
|
}
|
@ -126,7 +126,7 @@ type GetSecFilingsResp struct {
|
|||||||
Data []*GetSecFilingsResult `json:"data"`
|
Data []*GetSecFilingsResult `json:"data"`
|
||||||
}
|
}
|
||||||
type GetSecFilingsResult struct {
|
type GetSecFilingsResult struct {
|
||||||
//Symbol string `json:"symbol"`
|
Symbol string `json:"symbol"`
|
||||||
//Cik string `json:"cik"`
|
//Cik string `json:"cik"`
|
||||||
FilingDate string `json:"filingDate"`
|
FilingDate string `json:"filingDate"`
|
||||||
Form string `json:"form"`
|
Form string `json:"form"`
|
||||||
@ -191,7 +191,7 @@ func GetSecFilings(c *gin.Context) {
|
|||||||
res, err := service.SecFilingProvider.IsSecFilingExist(c, &secFilings.IsSecFilingExistReq{
|
res, err := service.SecFilingProvider.IsSecFilingExist(c, &secFilings.IsSecFilingExistReq{
|
||||||
FilingDate: req.FilingDate,
|
FilingDate: req.FilingDate,
|
||||||
Form: v.FormType,
|
Form: v.FormType,
|
||||||
FinalLink: v.FinalLink,
|
FinalLink: v.Link,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.Error(c, err)
|
service.Error(c, err)
|
||||||
@ -200,8 +200,9 @@ func GetSecFilings(c *gin.Context) {
|
|||||||
data.Data = append(data.Data, &GetSecFilingsResult{
|
data.Data = append(data.Data, &GetSecFilingsResult{
|
||||||
FilingDate: req.FilingDate,
|
FilingDate: req.FilingDate,
|
||||||
Form: v.FormType,
|
Form: v.FormType,
|
||||||
FileLink: v.FinalLink,
|
FileLink: v.Link,
|
||||||
IsSelect: res.Exist,
|
IsSelect: res.Exist,
|
||||||
|
Symbol: v.Symbol,
|
||||||
})
|
})
|
||||||
data.Total++
|
data.Total++
|
||||||
}
|
}
|
||||||
|
@ -217,14 +217,14 @@ func quickBos(file *multipart.FileHeader, mediaType string, mask string, source
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var objectName string = fmt.Sprintf("%s/%s/%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
var objectName string = fmt.Sprintf("%s/%s/%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
||||||
BOSClient, _ := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint)
|
BOSClient, _ := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint))
|
||||||
_, err = BOSClient.PutObjectFromBytes(config.ConfigData.Oss.BucketName, objectName, fileBytes)
|
_, err = BOSClient.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), objectName, fileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//logger.Errorf("quickOss err", err)
|
//logger.Errorf("quickOss err", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
||||||
url = fmt.Sprintf("%s/%s", config.ConfigData.Oss.CdnHost, objectName)
|
url = fmt.Sprintf("%s/%s", os.Getenv(config.ConfigData.Oss.CdnHost), objectName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,8 +266,9 @@ func BaiduCheckImage(imageByte []byte) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func PutBos(filePath string, mediaType string, needRemove bool) (url string, err error) {
|
func PutBos(filePath string, mediaType string, needRemove bool) (url string, err error) {
|
||||||
BOSClient, err := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint)
|
BOSClient, err := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("=== PutBos NewOss err ", err)
|
||||||
//logger.Errorf("PutBos NewOss err ", err)
|
//logger.Errorf("PutBos NewOss err ", err)
|
||||||
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
||||||
return
|
return
|
||||||
@ -290,14 +291,15 @@ func PutBos(filePath string, mediaType string, needRemove bool) (url string, err
|
|||||||
}
|
}
|
||||||
filePath = strings.Replace(filePath, model.MediaPath, "", 1)
|
filePath = strings.Replace(filePath, model.MediaPath, "", 1)
|
||||||
var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
||||||
_, err = BOSClient.PutObjectFromBytes(config.ConfigData.Oss.BucketName, objectName, fileBytes)
|
_, err = BOSClient.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), objectName, fileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("=== PutBos PutObject err ", err)
|
||||||
//logger.Errorf("PutBos PutObject err %+v", err.Error())
|
//logger.Errorf("PutBos PutObject err %+v", err.Error())
|
||||||
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
||||||
url = fmt.Sprintf("%s/%s", config.ConfigData.Oss.CdnHost, objectName)
|
url = fmt.Sprintf("%s/%s", os.Getenv(config.ConfigData.Oss.CdnHost), objectName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func GetSnapshot(videoPath, snapshotPath string, frameNum int) (snapshotName string, err error) {
|
func GetSnapshot(videoPath, snapshotPath string, frameNum int) (snapshotName string, err error) {
|
||||||
@ -331,14 +333,14 @@ func GetSnapshot(videoPath, snapshotPath string, frameNum int) (snapshotName str
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UploadWithBuffer(fileBuffer *bytes.Buffer, cloudStoreSubPath string) (url string, err error) {
|
func UploadWithBuffer(fileBuffer *bytes.Buffer, cloudStoreSubPath string) (url string, err error) {
|
||||||
Client, err := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint)
|
Client, err := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = errors.New(fmt.Sprintf("云存储初始化失败:%s", err.Error()))
|
err = errors.New(fmt.Sprintf("云存储初始化失败:%s", err.Error()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cloudStoreSubPath = getEnvDir(cloudStoreSubPath)
|
cloudStoreSubPath = getEnvDir(cloudStoreSubPath)
|
||||||
_, err = Client.PutObjectFromBytes(config.ConfigData.Oss.BucketName, cloudStoreSubPath, fileBuffer.Bytes())
|
_, err = Client.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), cloudStoreSubPath, fileBuffer.Bytes())
|
||||||
url = config.ConfigData.Oss.CdnHost + "/" + cloudStoreSubPath
|
url = os.Getenv(config.ConfigData.Oss.CdnHost) + "/" + cloudStoreSubPath
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func getEnvDir(cloudStoreSubPath string) (ep string) {
|
func getEnvDir(cloudStoreSubPath string) (ep string) {
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
package stime
|
package stime
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
"fonchain-fiee/pkg/e"
|
||||||
|
"go.uber.org/zap"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -88,3 +91,19 @@ var WeekStrMap = map[string]string{
|
|||||||
"Saturday": "六",
|
"Saturday": "六",
|
||||||
"Sunday": "日",
|
"Sunday": "日",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DatetimeToTimes(datetime string, dateFormat string) (times int32, err error) {
|
||||||
|
if datetime == "" {
|
||||||
|
times = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
loc, _ := time.LoadLocation("Asia/Shanghai")
|
||||||
|
t, err := time.ParseInLocation(dateFormat, datetime, loc)
|
||||||
|
if err != nil {
|
||||||
|
zap.L().Error("DatetimeToTimes err:"+datetime+":", zap.Error(err))
|
||||||
|
err = errors.New(e.GetCodeMsg(e.InvalidParams))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
times = int32(t.Unix())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -7,14 +7,16 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"fonchain-fiee/pkg/e"
|
"fonchain-fiee/pkg/e"
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/tealeg/xlsx"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/tealeg/xlsx"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -128,3 +130,36 @@ func ResponseXls(c *gin.Context, content io.ReadSeeker, fileTag string) {
|
|||||||
//c.Writer.Header().Add("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
//c.Writer.Header().Add("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||||
http.ServeContent(c.Writer, c.Request, fileName, time.Now(), content)
|
http.ServeContent(c.Writer, c.Request, fileName, time.Now(), content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateDirPath(path string) (err error) {
|
||||||
|
if _, err = os.Stat(path); os.IsNotExist(err) {
|
||||||
|
if err = os.MkdirAll(path, os.ModePerm); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CopyFile(src, dstDir string) (string, error) {
|
||||||
|
in, err := os.Open(src)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
defer in.Close()
|
||||||
|
if err := os.MkdirAll(dstDir, 0755); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
dst := filepath.Join(dstDir, filepath.Base(src))
|
||||||
|
out, err := os.Create(dst)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
defer out.Close()
|
||||||
|
if _, err = io.Copy(out, in); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if err = out.Sync(); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return dst, nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user