Merge branch 'dev-lzh-1009' into dev-lzh-0905

This commit is contained in:
lzh 2025-10-15 15:46:53 +08:00
commit 8bdc5982df
4 changed files with 873 additions and 846 deletions

View File

@ -379,40 +379,45 @@ func CreateBundleBalance(data model.BundleBalance) error {
} }
func GetUsedRecord(req *bundle.GetUsedRecordListReq) (data []model.CostLogPo, total int64, err error) { func GetUsedRecord(req *bundle.GetUsedRecordListReq) (data []model.CostLogPo, total int64, err error) {
session := app.ModuleClients.BundleDB.Table("cast_cost_log as ccl").Select("ccl.*,cwe.artist_confirmed_time"). session := app.ModuleClients.BundleDB.
Joins("left join cast_work_extra as cwe on cwe.work_uuid = ccl.work_uuid"). Table("cast_cost_log ccl").
Where("ccl.deleted_at = 0") Select("ccl.*,cwl.cost_type").
if req.Title != "" { Joins("left join cast_work_log cwl on cwl.work_uuid = ccl.work_uuid").
session = session.Where("title = ?", req.Title) Where("cwl.work_status = 1 and cwl.deleted_at = 0 and ccl.deleted_at = 0")
if req.WorkTitle != "" {
session = session.Where("ccl.work_title like ?", "%"+req.WorkTitle+"%")
} }
if req.Platform != 0 { if req.Platform != 0 {
session = session.Where(fmt.Sprintf("JSON_CONTAINS(platform_ids,'%d')", req.Platform)) session = session.Where(fmt.Sprintf("JSON_CONTAINS(ccl.platform_ids,'%d')", req.Platform))
} }
if req.Account != "" { if req.Account != "" {
session = session.Where(fmt.Sprintf(`JSON_CONTAINS(media_names,'"%s"')`, req.Account)) session = session.Where(fmt.Sprintf(`JSON_CONTAINS(ccl.media_names,'"%s"')`, req.Account))
} }
if req.SubmitTimeEnd != 0 { if req.SubmitTimeEnd != 0 {
session = session.Where("artist_confirmed_time <= ?", req.SubmitTimeEnd/1000) // 转换为秒级时间戳 session = session.Where("ccl.submit_time <= ?", time.UnixMilli(req.SubmitTimeEnd))
} }
if req.SubmitTimeStart != 0 { if req.SubmitTimeStart != 0 {
session = session.Where("artist_confirmed_time >= ?", req.SubmitTimeStart/1000) session = session.Where("ccl.submit_time >= ?", time.UnixMilli(req.SubmitTimeStart))
}
if req.CostType != 0 {
session = session.Where("cwl.cost_type = ?", req.CostType)
} }
if req.User != "" { if req.User != "" {
if utils.IsPhoneNumber(req.User) { if utils.IsPhoneNumber(req.User) {
session = session.Where("artist_phone = ?", req.User) session = session.Where("ccl.artist_phone = ?", req.User)
} else { } else {
session = session.Where("artist_name like ?", "%"+req.User+"%") session = session.Where("ccl.artist_name like ?", "%"+req.User+"%")
} }
} }
if req.Operator != "" { if req.Operator != "" {
if utils.IsPhoneNumber(req.Operator) { if utils.IsPhoneNumber(req.Operator) {
session = session.Where("operator_phone = ?", req.Operator) session = session.Where("ccl.operator_phone = ?", req.Operator)
} else { } else {
session = session.Where("operator_name like ?", "%"+req.Operator+"%") session = session.Where("ccl.operator_name like ?", "%"+req.Operator+"%")
} }
} }
if req.Type != 0 { if req.Type != 0 {
session = session.Where("work_category = ?", req.Type) session = session.Where("ccl.work_category = ?", req.Type)
} }
if err = session.Count(&total).Error; err != nil { if err = session.Count(&total).Error; err != nil {
return return

View File

@ -43,11 +43,6 @@ func (m *CastWorkExtra) TableName() string {
return "cast_work_extra" return "cast_work_extra"
} }
type CostLogPo struct {
CostLog
ArtistConfirmedTime int64 `gorm:"column:artist_confirmed_time;type:bigint(20);default:0;comment:艺人确认时间;NOT NULL" json:"artist_confirmed_time"`
}
type CastWorkImage struct { type CastWorkImage struct {
Uuid string `json:"uuid" gorm:"uuid"` Uuid string `json:"uuid" gorm:"uuid"`
WorkUuid string `json:"work_uuid" gorm:"work_uuid"` // 作品uuid WorkUuid string `json:"work_uuid" gorm:"work_uuid"` // 作品uuid
@ -118,6 +113,7 @@ type CastWorkLog struct {
ArtistUuid string `gorm:"column:artist_uuid;type:varchar(50);comment:艺人ID;NOT NULL" json:"artist_uuid"` ArtistUuid string `gorm:"column:artist_uuid;type:varchar(50);comment:艺人ID;NOT NULL" json:"artist_uuid"`
MediaAccUserIds string `gorm:"column:media_acc_user_ids;type:json;comment:自媒体账号user_ids集合;NOT NULL" json:"media_acc_user_ids"` MediaAccUserIds string `gorm:"column:media_acc_user_ids;type:json;comment:自媒体账号user_ids集合;NOT NULL" json:"media_acc_user_ids"`
MediaNames string `gorm:"column:media_names;type:varchar(600);comment:自媒体账号名称集合;NOT NULL" json:"media_names"` MediaNames string `gorm:"column:media_names;type:varchar(600);comment:自媒体账号名称集合;NOT NULL" json:"media_names"`
CostType int `gorm:"column:cost_type;type:int(11)" json:"costType"`
ConfirmedAt int64 `gorm:"column:confirmed_at;type:int(11)" json:"confirmedAt"` ConfirmedAt int64 `gorm:"column:confirmed_at;type:int(11)" json:"confirmedAt"`
CreatedAt int `gorm:"column:created_at;type:int(11)" json:"created_at"` CreatedAt int `gorm:"column:created_at;type:int(11)" json:"created_at"`
UpdatedAt int `gorm:"column:updated_at;type:int(11)" json:"updated_at"` UpdatedAt int `gorm:"column:updated_at;type:int(11)" json:"updated_at"`
@ -127,3 +123,8 @@ type CastWorkLog struct {
func (m *CastWorkLog) TableName() string { func (m *CastWorkLog) TableName() string {
return "cast_work_log" return "cast_work_log"
} }
type CostLogPo struct {
CostLog
CostType int `gorm:"column:cost_type;type:int(11)" json:"costType"`
}

View File

@ -804,11 +804,12 @@ message GetUsedRecordListReq{
string account = 3; string account = 3;
int32 platform = 4; int32 platform = 4;
int32 type = 5; int32 type = 5;
string title = 6; string workTitle = 6;
int64 submitTimeStart = 7; int64 submitTimeStart = 7;
int64 submitTimeEnd = 8; int64 submitTimeEnd = 8;
int32 page = 9; int32 page = 9;
int32 pageSize = 10; int32 pageSize = 10;
int32 costType = 11;
} }
message GetUsedRecordListResp { message GetUsedRecordListResp {
@ -832,7 +833,7 @@ message WorkCastItem{
string operatorName = 13; // string operatorName = 13; //
string operatorPhone = 14; // string operatorPhone = 14; //
uint32 status = 15; // 1 2 uint32 status = 15; // 1 2
string artistConfirmedTime = 16; // uint32 costType = 16;
} }
message GetImageWorkDetailReq { message GetImageWorkDetailReq {
@ -876,6 +877,7 @@ message workItem{
int64 createdAt = 11; // int64 createdAt = 11; //
string artistName = 12; string artistName = 12;
string artistUuid = 13; string artistUuid = 13;
uint32 costType = 14;
} }
message ToBeComfirmedWorksResp{ message ToBeComfirmedWorksResp{

File diff suppressed because it is too large Load Diff