Updata:增加youtube和bluesky账号数据导出

This commit is contained in:
jiaji.H 2026-01-09 11:23:53 +08:00
parent 296e6a3eff
commit e5baa91e9d
4 changed files with 91 additions and 15 deletions

View File

@ -38,7 +38,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
// } // }
err = query.First(result).Error err = query.First(result).Error
if err != nil { if err != nil {
return return nil, fmt.Errorf("总金额统计失败")
} }
// 将字符串转换为数值进行计算 // 将字符串转换为数值进行计算
@ -72,7 +72,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
subQuery = app.ModuleClients.BundleDB.Model(&model.Reconciliation{}). subQuery = app.ModuleClients.BundleDB.Model(&model.Reconciliation{}).
Select("SUM(handling_fee) as new_fee_payment_amount, SUM(pay_amount) as new_payment_amount"). Select("SUM(handling_fee) as new_fee_payment_amount, SUM(pay_amount) as new_payment_amount").
Joins("LEFT JOIN bundle_order_records bor ON bor.order_no = bundle_order_on"). Joins("LEFT JOIN bundle_order_records bor ON bor.order_no COLLATE utf8mb4_general_ci = reconciliation.bundle_order_on COLLATE utf8mb4_general_ci").
Where("`reconciliation`.pay_time >= ?", req.Start+" 00:00:00"). Where("`reconciliation`.pay_time >= ?", req.Start+" 00:00:00").
Where("`reconciliation`.pay_time <= ?", req.End+" 23:59:59"). Where("`reconciliation`.pay_time <= ?", req.End+" 23:59:59").
Where("`reconciliation`.deleted_at is null and reconciliation.pay_status = 2 and bor.status=2 and bor.deleted_at is null") Where("`reconciliation`.deleted_at is null and reconciliation.pay_status = 2 and bor.status=2 and bor.deleted_at is null")
@ -1305,6 +1305,12 @@ func MetricsArtistAccountExport(req *bundle.MetricsArtistAccountExportReq) (*bun
ins.platform_user_id as instagram_account, ins.platform_user_id as instagram_account,
ins.platform_user_name as instagram_nickname, ins.platform_user_name as instagram_nickname,
ins_auth.auth_status as ins_auth_status, ins_auth.auth_status as ins_auth_status,
youtube.platform_user_id as youtube_account,
youtube.platform_user_name as youtube_nickname,
youtube_auth.auth_status as youtube_auth_status,
bluesky.platform_user_id as bluesky_account,
bluesky.platform_user_name as bluesky_nickname,
bluesky_auth.auth_status as bluesky_auth_status,
cma.artist_name, cma.artist_name,
bor.customer_num as user_num bor.customer_num as user_num
`). `).
@ -1314,6 +1320,10 @@ func MetricsArtistAccountExport(req *bundle.MetricsArtistAccountExportReq) (*bun
Joins(`left join (Select * from cast_media_auth where platform_id = 4 and deleted_at = 0) dm_auth on dm_auth.user_id = dm.user_id`). Joins(`left join (Select * from cast_media_auth where platform_id = 4 and deleted_at = 0) dm_auth on dm_auth.user_id = dm.user_id`).
Joins(`left join (SELECT * FROM cast_media_account where platform_id = 3 and deleted_at = 0) ins on ins.artist_uuid = cma.artist_uuid`). Joins(`left join (SELECT * FROM cast_media_account where platform_id = 3 and deleted_at = 0) ins on ins.artist_uuid = cma.artist_uuid`).
Joins(`left join (Select * from cast_media_auth where platform_id = 3 and deleted_at = 0) ins_auth on ins_auth.user_id = ins.user_id`). Joins(`left join (Select * from cast_media_auth where platform_id = 3 and deleted_at = 0) ins_auth on ins_auth.user_id = ins.user_id`).
Joins(`left join (Select * from cast_media_account where platform_id = 2 and deleted_at = 0) youtube on youtube.artist_uuid = cma.artist_uuid`).
Joins(`left join (Select * from cast_media_auth where platform_id = 2 and deleted_at = 0) youtube_auth on youtube_auth.user_id = youtube.user_id`).
Joins(`left join (Select * from cast_media_account where platform_id = 5 and deleted_at = 0) bluesky on bluesky.artist_uuid = cma.artist_uuid`).
Joins(`left join (Select * from cast_media_auth where platform_id = 5 and deleted_at = 0) bluesky_auth on bluesky_auth.user_id = bluesky.user_id`).
Joins(`left join bundle_order_records bor on bor.customer_id COLLATE utf8mb4_general_ci= cma.artist_uuid COLLATE utf8mb4_general_ci`). Joins(`left join bundle_order_records bor on bor.customer_id COLLATE utf8mb4_general_ci= cma.artist_uuid COLLATE utf8mb4_general_ci`).
Where("bor.deleted_at is null") Where("bor.deleted_at is null")
if req.Month != "" { if req.Month != "" {

View File

@ -273,7 +273,7 @@ func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBund
data.ExpiredAt = time.Now() data.ExpiredAt = time.Now()
userId, err := strconv.Atoi(addValues[0].CustomerID) userId, err := strconv.Atoi(addValues[0].CustomerID)
if err != nil { if err != nil {
return nil, err return nil, errors.New("获取用户ID失败")
} }
data.Month = time.Now().Format("2006-01") data.Month = time.Now().Format("2006-01")
data.UserId = userId data.UserId = userId
@ -492,11 +492,11 @@ func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBala
PageSize: 99999, PageSize: 99999,
}) })
if err != nil { if err != nil {
return nil, err return nil, errors.New("余量列表数据失败")
} }
prefixData, err := dao.BalanceExportPrefix() prefixData, err := dao.BalanceExportPrefix()
if err != nil { if err != nil {
return nil, err return nil, errors.New("获取前缀数据失败")
} }
var prefixMap = map[int32]model.BundleExportDto{} var prefixMap = map[int32]model.BundleExportDto{}

View File

@ -1734,14 +1734,18 @@ message MetricsArtistAccountExportItem{
string dmAccount = 3; string dmAccount = 3;
string dmNickname = 4; string dmNickname = 4;
int32 dmAuthStatus = 5; int32 dmAuthStatus = 5;
// string youtubeAccount = 3; YouTube了
// string youtubeNickname = 4;
string instagramAccount = 6; string instagramAccount = 6;
string instagramNickname = 7; string instagramNickname = 7;
int32 insAuthStatus = 8; int32 insAuthStatus = 8;
string tiktokAccount = 9; string tiktokAccount = 9;
string tiktokNickname = 10; string tiktokNickname = 10;
int32 tiktokAuthStatus = 11; int32 tiktokAuthStatus = 11;
string youtubeAccount = 12;
string youtubeNickname = 13;
int32 youtubeAuthStatus = 14;
string blueskyAccount = 15;
string blueskyNickname = 16;
int32 blueskyAuthStatus = 17;
} }

View File

@ -14597,14 +14597,18 @@ type MetricsArtistAccountExportItem struct {
DmAccount string `protobuf:"bytes,3,opt,name=dmAccount,proto3" json:"dmAccount"` DmAccount string `protobuf:"bytes,3,opt,name=dmAccount,proto3" json:"dmAccount"`
DmNickname string `protobuf:"bytes,4,opt,name=dmNickname,proto3" json:"dmNickname"` DmNickname string `protobuf:"bytes,4,opt,name=dmNickname,proto3" json:"dmNickname"`
DmAuthStatus int32 `protobuf:"varint,5,opt,name=dmAuthStatus,proto3" json:"dmAuthStatus"` DmAuthStatus int32 `protobuf:"varint,5,opt,name=dmAuthStatus,proto3" json:"dmAuthStatus"`
// string youtubeAccount = 3; 现在没有YouTube了
// string youtubeNickname = 4;
InstagramAccount string `protobuf:"bytes,6,opt,name=instagramAccount,proto3" json:"instagramAccount"` InstagramAccount string `protobuf:"bytes,6,opt,name=instagramAccount,proto3" json:"instagramAccount"`
InstagramNickname string `protobuf:"bytes,7,opt,name=instagramNickname,proto3" json:"instagramNickname"` InstagramNickname string `protobuf:"bytes,7,opt,name=instagramNickname,proto3" json:"instagramNickname"`
InsAuthStatus int32 `protobuf:"varint,8,opt,name=insAuthStatus,proto3" json:"insAuthStatus"` InsAuthStatus int32 `protobuf:"varint,8,opt,name=insAuthStatus,proto3" json:"insAuthStatus"`
TiktokAccount string `protobuf:"bytes,9,opt,name=tiktokAccount,proto3" json:"tiktokAccount"` TiktokAccount string `protobuf:"bytes,9,opt,name=tiktokAccount,proto3" json:"tiktokAccount"`
TiktokNickname string `protobuf:"bytes,10,opt,name=tiktokNickname,proto3" json:"tiktokNickname"` TiktokNickname string `protobuf:"bytes,10,opt,name=tiktokNickname,proto3" json:"tiktokNickname"`
TiktokAuthStatus int32 `protobuf:"varint,11,opt,name=tiktokAuthStatus,proto3" json:"tiktokAuthStatus"` TiktokAuthStatus int32 `protobuf:"varint,11,opt,name=tiktokAuthStatus,proto3" json:"tiktokAuthStatus"`
YoutubeAccount string `protobuf:"bytes,12,opt,name=youtubeAccount,proto3" json:"youtubeAccount"`
YoutubeNickname string `protobuf:"bytes,13,opt,name=youtubeNickname,proto3" json:"youtubeNickname"`
YoutubeAuthStatus int32 `protobuf:"varint,14,opt,name=youtubeAuthStatus,proto3" json:"youtubeAuthStatus"`
BlueskyAccount string `protobuf:"bytes,15,opt,name=blueskyAccount,proto3" json:"blueskyAccount"`
BlueskyNickname string `protobuf:"bytes,16,opt,name=blueskyNickname,proto3" json:"blueskyNickname"`
BlueskyAuthStatus int32 `protobuf:"varint,17,opt,name=blueskyAuthStatus,proto3" json:"blueskyAuthStatus"`
} }
func (x *MetricsArtistAccountExportItem) Reset() { func (x *MetricsArtistAccountExportItem) Reset() {
@ -14716,6 +14720,48 @@ func (x *MetricsArtistAccountExportItem) GetTiktokAuthStatus() int32 {
return 0 return 0
} }
func (x *MetricsArtistAccountExportItem) GetYoutubeAccount() string {
if x != nil {
return x.YoutubeAccount
}
return ""
}
func (x *MetricsArtistAccountExportItem) GetYoutubeNickname() string {
if x != nil {
return x.YoutubeNickname
}
return ""
}
func (x *MetricsArtistAccountExportItem) GetYoutubeAuthStatus() int32 {
if x != nil {
return x.YoutubeAuthStatus
}
return 0
}
func (x *MetricsArtistAccountExportItem) GetBlueskyAccount() string {
if x != nil {
return x.BlueskyAccount
}
return ""
}
func (x *MetricsArtistAccountExportItem) GetBlueskyNickname() string {
if x != nil {
return x.BlueskyNickname
}
return ""
}
func (x *MetricsArtistAccountExportItem) GetBlueskyAuthStatus() int32 {
if x != nil {
return x.BlueskyAuthStatus
}
return 0
}
type MetricsVideoSubmitExportReq struct { type MetricsVideoSubmitExportReq struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -17957,7 +18003,7 @@ var file_pb_bundle_proto_rawDesc = []byte{
0x0b, 0x32, 0x26, 0x2e, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x0b, 0x32, 0x26, 0x2e, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69,
0x63, 0x73, 0x41, 0x72, 0x74, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x63, 0x73, 0x41, 0x72, 0x74, 0x69, 0x73, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x45,
0x78, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22,
0xb6, 0x03, 0x0a, 0x1e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x41, 0x72, 0x74, 0x69, 0x73, 0xb6, 0x05, 0x0a, 0x1e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x41, 0x72, 0x74, 0x69, 0x73,
0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x74, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x74,
0x65, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x65, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x72, 0x74, 0x69, 0x73, 0x74, 0x4e, 0x61,
@ -17984,6 +18030,22 @@ var file_pb_bundle_proto_rawDesc = []byte{
0x6b, 0x74, 0x6f, 0x6b, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x6b, 0x74, 0x6f, 0x6b, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10,
0x74, 0x69, 0x6b, 0x74, 0x6f, 0x6b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x74, 0x69, 0x6b, 0x74, 0x6f, 0x6b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x74, 0x69, 0x6b, 0x74, 0x6f, 0x6b, 0x41, 0x75, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x74, 0x69, 0x6b, 0x74, 0x6f, 0x6b, 0x41, 0x75,
0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x79, 0x6f, 0x75, 0x74,
0x75, 0x62, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0e, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x12, 0x28, 0x0a, 0x0f, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x4e, 0x69, 0x63, 0x6b, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x79, 0x6f, 0x75, 0x74, 0x75,
0x62, 0x65, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x79, 0x6f,
0x75, 0x74, 0x75, 0x62, 0x65, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x41, 0x75,
0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x62, 0x6c, 0x75, 0x65,
0x73, 0x6b, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0e, 0x62, 0x6c, 0x75, 0x65, 0x73, 0x6b, 0x79, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x12, 0x28, 0x0a, 0x0f, 0x62, 0x6c, 0x75, 0x65, 0x73, 0x6b, 0x79, 0x4e, 0x69, 0x63, 0x6b, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x6c, 0x75, 0x65, 0x73,
0x6b, 0x79, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x62, 0x6c,
0x75, 0x65, 0x73, 0x6b, 0x79, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x62, 0x6c, 0x75, 0x65, 0x73, 0x6b, 0x79, 0x41, 0x75,
0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x33, 0x0a, 0x1b, 0x4d, 0x65, 0x74, 0x72, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x33, 0x0a, 0x1b, 0x4d, 0x65, 0x74, 0x72,
0x69, 0x63, 0x73, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x45, 0x78, 0x69, 0x63, 0x73, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x45, 0x78,
0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68,