1
This commit is contained in:
parent
0e5cb8a5ff
commit
bc178ea266
@ -567,8 +567,12 @@ func ImportMediaAccount(ctx *gin.Context) {
|
||||
//查询艺人信息
|
||||
if config.AppConfig.System.AppMode == "dev" {
|
||||
subInfoResp = &accountFiee.UserInfoResponse{
|
||||
Id: 0,
|
||||
SubNum: "",
|
||||
Id: 1245,
|
||||
SubNum: "FL00023",
|
||||
Status: 0,
|
||||
Name: "测试远",
|
||||
TelNum: "1826145872",
|
||||
TelAreaCode: "86",
|
||||
}
|
||||
} else {
|
||||
subInfoResp, err = service.AccountFieeProvider.SubNumGetInfo(context.Background(), &accountFiee.SubNumGetInfoRequest{
|
||||
@ -576,7 +580,6 @@ func ImportMediaAccount(ctx *gin.Context) {
|
||||
Domain: "app",
|
||||
})
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
excelSetRemark(excelData, line, "查询艺人出错")
|
||||
continue
|
||||
@ -601,20 +604,26 @@ func ImportMediaAccount(ctx *gin.Context) {
|
||||
}
|
||||
if tiktokName != "" {
|
||||
if err = updateMediaAccount(tiktokName, cast.PlatformIDENUM_TIKTOK, subInfoResp, loginInfo); err != nil {
|
||||
excelSetRemark(excelData, line, err.Error())
|
||||
excelSetRemark(excelData, line, fmt.Sprintf("%s:%s", tiktokName, err.Error()))
|
||||
}
|
||||
}
|
||||
if insName != "" {
|
||||
if err = updateMediaAccount(tiktokName, cast.PlatformIDENUM_INS, subInfoResp, loginInfo); err != nil {
|
||||
excelSetRemark(excelData, line, err.Error())
|
||||
if err = updateMediaAccount(insName, cast.PlatformIDENUM_INS, subInfoResp, loginInfo); err != nil {
|
||||
excelSetRemark(excelData, line, fmt.Sprintf("%s:%s", insName, err.Error()))
|
||||
}
|
||||
}
|
||||
if dmName != "" {
|
||||
if err = updateMediaAccount(tiktokName, cast.PlatformIDENUM_DM, subInfoResp, loginInfo); err != nil {
|
||||
excelSetRemark(excelData, line, err.Error())
|
||||
if err = updateMediaAccount(dmName, cast.PlatformIDENUM_DM, subInfoResp, loginInfo); err != nil {
|
||||
excelSetRemark(excelData, line, fmt.Sprintf("%s:%s", dmName, err.Error()))
|
||||
}
|
||||
}
|
||||
}
|
||||
// 保存Excel文件到磁盘
|
||||
resultPath := fmt.Sprintf("./runtime/media/%s", fileName)
|
||||
if err = excelData.SaveAs(resultPath); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
urlHost := config.AppConfig.System.FieeHost
|
||||
urlResult := fmt.Sprintf("%s/api/fiee/static/media/%s", urlHost, fileName)
|
||||
service.Success(ctx, map[string]interface{}{
|
||||
@ -622,7 +631,6 @@ func ImportMediaAccount(ctx *gin.Context) {
|
||||
"failCount": 0,
|
||||
"url": urlResult,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func excelSetRemark(excelData *excelize.File, line int, remark string) {
|
||||
@ -634,7 +642,20 @@ func excelSetRemark(excelData *excelize.File, line int, remark string) {
|
||||
}
|
||||
|
||||
func updateMediaAccount(platformName string, platformId cast.PlatformIDENUM, subInfoResp *accountFiee.UserInfoResponse, loginInfo login.Info) error {
|
||||
_, err := service.CastProvider.UpdateMediaAccount(context.Background(), &cast.UpdateMediaAccountReq{
|
||||
var err error
|
||||
if config.AppConfig.System.AppMode != "dev" {
|
||||
if _, err = CheckUserBundleBalance(int32(subInfoResp.Id), modelCast.BalanceTypeAccountValue); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
|
||||
UserId: int32(subInfoResp.Id),
|
||||
AccountConsumptionNumber: 1,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
_, err = service.CastProvider.UpdateMediaAccount(context.Background(), &cast.UpdateMediaAccountReq{
|
||||
PlatformID: platformId,
|
||||
PlatformUserName: platformName,
|
||||
PlatformUserID: "",
|
||||
@ -646,5 +667,13 @@ func updateMediaAccount(platformName string, platformId cast.PlatformIDENUM, sub
|
||||
ManagerUserName: loginInfo.Name,
|
||||
ArtistSubNum: subInfoResp.SubNum,
|
||||
})
|
||||
if config.AppConfig.System.AppMode != "dev" {
|
||||
if err != nil {
|
||||
_, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
|
||||
UserId: int32(subInfoResp.Id),
|
||||
AccountConsumptionNumber: -1,
|
||||
})
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user