Compare commits

..

7 Commits

Author SHA1 Message Date
lzh
6cded5543f 过滤软删除 2025-10-10 17:11:55 +08:00
lzh
f0dbb9c9be 过滤重复作品 2025-10-10 17:07:43 +08:00
lzh
76390c3f66 使用记录查询条件 2025-10-10 16:39:19 +08:00
lzh
6c5ae80059 添加使用类型过滤 2025-10-10 14:14:13 +08:00
lzh
24e1eaed14 新增使用类型字段 2025-10-10 10:24:20 +08:00
lzh
422d2acb5a 添加使用类型字段 2025-10-09 17:09:43 +08:00
lzh
5edac38772 更新proto 2025-09-28 14:18:11 +08:00
6 changed files with 539 additions and 494 deletions

View File

@ -218,39 +218,46 @@ func CreateBundleBalance(data model.BundleBalance) error {
return app.ModuleClients.BundleDB.Create(&data).Error
}
func GetUsedRecord(req *bundle.GetUsedRecordListReq) (data []model.CostLog, total int64, err error) {
session := app.ModuleClients.BundleDB.Model(&model.CostLog{})
if req.Title != "" {
session = session.Where("title = ?", req.Title)
func GetUsedRecord(req *bundle.GetUsedRecordListReq) (data []model.CostLogPo, total int64, err error) {
session := app.ModuleClients.BundleDB.
Table("cast_cost_log ccl").
Select("ccl.*,cwl.cost_type").
Joins("left join cast_work_log cwl on cwl.work_uuid = ccl.work_uuid").
Where("cwl.work_status = 1 and cwl.deleted_at = 0 and ccl.deleted_at = 0")
if req.WorkTitle != "" {
session = session.Where("ccl.work_title like ?", "%"+req.WorkTitle+"%")
}
if req.Platform != 0 {
session = session.Where(fmt.Sprintf("JSON_CONTAINS(platform_ids,'%d')", req.Platform))
session = session.Where(fmt.Sprintf("JSON_CONTAINS(ccl.platform_ids,'%d')", req.Platform))
}
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 {
session = session.Where("submit_time <= ?", time.UnixMilli(req.SubmitTimeEnd))
session = session.Where("ccl.submit_time <= ?", time.UnixMilli(req.SubmitTimeEnd))
}
if req.SubmitTimeStart != 0 {
session = session.Where("submit_time >= ?", time.UnixMilli(req.SubmitTimeStart))
session = session.Where("ccl.submit_time >= ?", time.UnixMilli(req.SubmitTimeStart))
}
if req.CostType != 0 {
session = session.Where("cwl.cost_type = ?", req.CostType)
}
if req.User != "" {
if utils.IsPhoneNumber(req.User) {
session = session.Where("artist_phone = ?", req.User)
session = session.Where("ccl.artist_phone = ?", req.User)
} else {
session = session.Where("artist_name like ?", "%"+req.User+"%")
session = session.Where("ccl.artist_name like ?", "%"+req.User+"%")
}
}
if req.Operator != "" {
if utils.IsPhoneNumber(req.Operator) {
session = session.Where("operator_phone = ?", req.Operator)
session = session.Where("ccl.operator_phone = ?", req.Operator)
} else {
session = session.Where("operator_name like ?", "%"+req.Operator+"%")
session = session.Where("ccl.operator_name like ?", "%"+req.Operator+"%")
}
}
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 {
return
@ -258,7 +265,7 @@ func GetUsedRecord(req *bundle.GetUsedRecordListReq) (data []model.CostLog, tota
if req.Page != 0 && req.PageSize != 0 {
session = session.Offset(int(req.Page-1) * int(req.PageSize)).Limit(int(req.PageSize))
}
err = session.Order("updated_at desc").Find(&data).Error
err = session.Order("ccl.updated_at desc").Find(&data).Error
return
}

View File

@ -123,7 +123,7 @@ func GetUsedRecord(req *bundle.GetUsedRecordListReq) (*bundle.GetUsedRecordListR
}
resp := &bundle.GetUsedRecordListResp{}
resp.Total = total
resp.Data = lo.Map(data, func(m model.CostLog, _ int) *bundle.WorkCastItem {
resp.Data = lo.Map(data, func(m model.CostLogPo, _ int) *bundle.WorkCastItem {
result := &bundle.WorkCastItem{}
copier.Copy(result, &m)
return result

View File

@ -101,6 +101,7 @@ type CastWorkLog struct {
ArtistUuid string `gorm:"column:artist_uuid;type:varchar(50);comment:艺人ID;NOT NULL" json:"artist_uuid"`
MediaAccUserIds string `gorm:"column:media_acc_user_ids;type:json;comment:自媒体账号user_ids集合;NOT NULL" json:"media_acc_user_ids"`
MediaNames string `gorm:"column:media_names;type:varchar(600);comment:自媒体账号名称集合;NOT NULL" json:"media_names"`
CostType int `gorm:"column:cost_type;type:int(11)" json:"costType"`
ConfirmedAt int64 `gorm:"column:confirmed_at;type:int(11)" json:"confirmedAt"`
CreatedAt int `gorm:"column:created_at;type:int(11)" json:"created_at"`
UpdatedAt int `gorm:"column:updated_at;type:int(11)" json:"updated_at"`
@ -110,3 +111,8 @@ type CastWorkLog struct {
func (m *CastWorkLog) TableName() string {
return "cast_work_log"
}
type CostLogPo struct {
CostLog
CostType int `gorm:"column:cost_type;type:int(11)" json:"costType"`
}

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.8
// - protoc v3.20.3
// - protoc v3.12.4
// source: pb/bundle.proto
package bundle
@ -50,11 +50,11 @@ type BundleClient interface {
OrderRecordsListV2(ctx context.Context, in *OrderRecordsRequestV2, opts ...grpc_go.CallOption) (*OrderRecordsResponseV2, common.ErrorWithAttachment)
OrderListByOrderNo(ctx context.Context, in *OrderInfoByOrderNoRequest, opts ...grpc_go.CallOption) (*OrderInfoByOrderNoResp, common.ErrorWithAttachment)
OnlyAddValueListByOrderNo(ctx context.Context, in *OnlyAddValueListByOrderNoRequest, opts ...grpc_go.CallOption) (*OnlyAddValueListByOrderNoResp, common.ErrorWithAttachment)
//增值套餐
// 增值套餐
CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment)
ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment)
ValueAddBundleDetail(ctx context.Context, in *ValueAddBundleDetailRequest, opts ...grpc_go.CallOption) (*ValueAddBundleDetailResponse, common.ErrorWithAttachment)
//新增值服务
// 新增值服务
SaveValueAddService(ctx context.Context, in *ValueAddServiceLang, opts ...grpc_go.CallOption) (*SaveResponse, common.ErrorWithAttachment)
ValueAddServiceList(ctx context.Context, in *ValueAddServiceListRequest, opts ...grpc_go.CallOption) (*ValueAddServiceListResponse, common.ErrorWithAttachment)
ValueAddServiceDetail(ctx context.Context, in *ValueAddServiceDetailRequest, opts ...grpc_go.CallOption) (*ValueAddServiceDetailResponse, common.ErrorWithAttachment)
@ -75,7 +75,7 @@ type BundleClient interface {
GetVedioWorkDetail(ctx context.Context, in *GetVedioWorkDetailReq, opts ...grpc_go.CallOption) (*GetVedioeWorkDetailResp, common.ErrorWithAttachment)
ToBeComfirmedWorks(ctx context.Context, in *ToBeComfirmedWorksReq, opts ...grpc_go.CallOption) (*ToBeComfirmedWorksResp, common.ErrorWithAttachment)
ConfirmWork(ctx context.Context, in *ConfirmWorkReq, opts ...grpc_go.CallOption) (*ConfirmWorkResp, common.ErrorWithAttachment)
//对账单
// 对账单
GetReconciliationList(ctx context.Context, in *GetReconciliationListReq, opts ...grpc_go.CallOption) (*GetReconciliationListResp, common.ErrorWithAttachment)
CreateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
UpdateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
@ -473,11 +473,11 @@ type BundleServer interface {
OrderRecordsListV2(context.Context, *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
OrderListByOrderNo(context.Context, *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
//增值套餐
// 增值套餐
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
ValueAddBundleDetail(context.Context, *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
//新增值服务
// 新增值服务
SaveValueAddService(context.Context, *ValueAddServiceLang) (*SaveResponse, error)
ValueAddServiceList(context.Context, *ValueAddServiceListRequest) (*ValueAddServiceListResponse, error)
ValueAddServiceDetail(context.Context, *ValueAddServiceDetailRequest) (*ValueAddServiceDetailResponse, error)
@ -498,7 +498,7 @@ type BundleServer interface {
GetVedioWorkDetail(context.Context, *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
ToBeComfirmedWorks(context.Context, *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
ConfirmWork(context.Context, *ConfirmWorkReq) (*ConfirmWorkResp, error)
//对账单
// 对账单
GetReconciliationList(context.Context, *GetReconciliationListReq) (*GetReconciliationListResp, error)
CreateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
UpdateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)