Compare commits
11 Commits
bfc48c04bc
...
d150e95f19
| Author | SHA1 | Date | |
|---|---|---|---|
| d150e95f19 | |||
| 8d34f83459 | |||
| bc178ea266 | |||
| 0e5cb8a5ff | |||
| 79479ee747 | |||
| 6b2c201bc1 | |||
| b99d09adf0 | |||
| 88f192c5b4 | |||
| 7c98aac6c9 | |||
| 1adb4fc401 | |||
| 49331857df |
1214
api/cast/cast.pb.go
1214
api/cast/cast.pb.go
File diff suppressed because it is too large
Load Diff
@ -3236,6 +3236,8 @@ func (m *UpdateStatusReq) validate(all bool) error {
|
||||
|
||||
// no validation rules for ConfirmFailType
|
||||
|
||||
// no validation rules for ApprovalTime
|
||||
|
||||
if len(errors) > 0 {
|
||||
return UpdateStatusReqMultiError(errors)
|
||||
}
|
||||
@ -16493,6 +16495,14 @@ func (m *MediaMetricsDailyItem) validate(all bool) error {
|
||||
|
||||
// no validation rules for ImageCount
|
||||
|
||||
// no validation rules for ProfileKey
|
||||
|
||||
// no validation rules for IsSuccess
|
||||
|
||||
// no validation rules for FailReason
|
||||
|
||||
// no validation rules for FailType
|
||||
|
||||
if len(errors) > 0 {
|
||||
return MediaMetricsDailyItemMultiError(errors)
|
||||
}
|
||||
@ -16865,6 +16875,16 @@ func (m *WorkMetricsDailyItem) validate(all bool) error {
|
||||
|
||||
// no validation rules for SharesCount
|
||||
|
||||
// no validation rules for PublishMediaID
|
||||
|
||||
// no validation rules for ProfileKey
|
||||
|
||||
// no validation rules for IsSuccess
|
||||
|
||||
// no validation rules for FailReason
|
||||
|
||||
// no validation rules for FailType
|
||||
|
||||
if len(errors) > 0 {
|
||||
return WorkMetricsDailyItemMultiError(errors)
|
||||
}
|
||||
@ -17933,6 +17953,792 @@ var _ interface {
|
||||
ErrorName() string
|
||||
} = ListWorkPlatformInfoRespValidationError{}
|
||||
|
||||
// Validate checks the field values on ListMediaMetricsDailyReq with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *ListMediaMetricsDailyReq) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on ListMediaMetricsDailyReq with the
|
||||
// rules defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// ListMediaMetricsDailyReqMultiError, or nil if none found.
|
||||
func (m *ListMediaMetricsDailyReq) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *ListMediaMetricsDailyReq) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for IsSuccess
|
||||
|
||||
// no validation rules for FailType
|
||||
|
||||
// no validation rules for Page
|
||||
|
||||
// no validation rules for PageSize
|
||||
|
||||
// no validation rules for Date
|
||||
|
||||
if len(errors) > 0 {
|
||||
return ListMediaMetricsDailyReqMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListMediaMetricsDailyReqMultiError is an error wrapping multiple validation
|
||||
// errors returned by ListMediaMetricsDailyReq.ValidateAll() if the designated
|
||||
// constraints aren't met.
|
||||
type ListMediaMetricsDailyReqMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m ListMediaMetricsDailyReqMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m ListMediaMetricsDailyReqMultiError) AllErrors() []error { return m }
|
||||
|
||||
// ListMediaMetricsDailyReqValidationError is the validation error returned by
|
||||
// ListMediaMetricsDailyReq.Validate if the designated constraints aren't met.
|
||||
type ListMediaMetricsDailyReqValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e ListMediaMetricsDailyReqValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e ListMediaMetricsDailyReqValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e ListMediaMetricsDailyReqValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e ListMediaMetricsDailyReqValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e ListMediaMetricsDailyReqValidationError) ErrorName() string {
|
||||
return "ListMediaMetricsDailyReqValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e ListMediaMetricsDailyReqValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sListMediaMetricsDailyReq.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = ListMediaMetricsDailyReqValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = ListMediaMetricsDailyReqValidationError{}
|
||||
|
||||
// Validate checks the field values on MediaMetricsDailyInfo with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *MediaMetricsDailyInfo) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on MediaMetricsDailyInfo with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// MediaMetricsDailyInfoMultiError, or nil if none found.
|
||||
func (m *MediaMetricsDailyInfo) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *MediaMetricsDailyInfo) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for Uuid
|
||||
|
||||
// no validation rules for ArtistUuid
|
||||
|
||||
// no validation rules for MediaAccUserID
|
||||
|
||||
// no validation rules for MediaName
|
||||
|
||||
// no validation rules for ArtistName
|
||||
|
||||
// no validation rules for ArtistPhone
|
||||
|
||||
// no validation rules for PlatformID
|
||||
|
||||
// no validation rules for Date
|
||||
|
||||
// no validation rules for FansCount
|
||||
|
||||
// no validation rules for ViewsCount
|
||||
|
||||
// no validation rules for LikesCount
|
||||
|
||||
// no validation rules for CommentsCount
|
||||
|
||||
// no validation rules for SharesCount
|
||||
|
||||
// no validation rules for VideoCount
|
||||
|
||||
// no validation rules for ImageCount
|
||||
|
||||
// no validation rules for ProfileKey
|
||||
|
||||
// no validation rules for IsSuccess
|
||||
|
||||
// no validation rules for FailReason
|
||||
|
||||
// no validation rules for FailType
|
||||
|
||||
// no validation rules for CreatedAt
|
||||
|
||||
// no validation rules for UpdatedAt
|
||||
|
||||
if len(errors) > 0 {
|
||||
return MediaMetricsDailyInfoMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MediaMetricsDailyInfoMultiError is an error wrapping multiple validation
|
||||
// errors returned by MediaMetricsDailyInfo.ValidateAll() if the designated
|
||||
// constraints aren't met.
|
||||
type MediaMetricsDailyInfoMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m MediaMetricsDailyInfoMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m MediaMetricsDailyInfoMultiError) AllErrors() []error { return m }
|
||||
|
||||
// MediaMetricsDailyInfoValidationError is the validation error returned by
|
||||
// MediaMetricsDailyInfo.Validate if the designated constraints aren't met.
|
||||
type MediaMetricsDailyInfoValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e MediaMetricsDailyInfoValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e MediaMetricsDailyInfoValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e MediaMetricsDailyInfoValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e MediaMetricsDailyInfoValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e MediaMetricsDailyInfoValidationError) ErrorName() string {
|
||||
return "MediaMetricsDailyInfoValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e MediaMetricsDailyInfoValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sMediaMetricsDailyInfo.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = MediaMetricsDailyInfoValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = MediaMetricsDailyInfoValidationError{}
|
||||
|
||||
// Validate checks the field values on ListMediaMetricsDailyResp with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *ListMediaMetricsDailyResp) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on ListMediaMetricsDailyResp with the
|
||||
// rules defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// ListMediaMetricsDailyRespMultiError, or nil if none found.
|
||||
func (m *ListMediaMetricsDailyResp) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *ListMediaMetricsDailyResp) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
for idx, item := range m.GetData() {
|
||||
_, _ = idx, item
|
||||
|
||||
if all {
|
||||
switch v := interface{}(item).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, ListMediaMetricsDailyRespValidationError{
|
||||
field: fmt.Sprintf("Data[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, ListMediaMetricsDailyRespValidationError{
|
||||
field: fmt.Sprintf("Data[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return ListMediaMetricsDailyRespValidationError{
|
||||
field: fmt.Sprintf("Data[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// no validation rules for Count
|
||||
|
||||
if len(errors) > 0 {
|
||||
return ListMediaMetricsDailyRespMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListMediaMetricsDailyRespMultiError is an error wrapping multiple validation
|
||||
// errors returned by ListMediaMetricsDailyResp.ValidateAll() if the
|
||||
// designated constraints aren't met.
|
||||
type ListMediaMetricsDailyRespMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m ListMediaMetricsDailyRespMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m ListMediaMetricsDailyRespMultiError) AllErrors() []error { return m }
|
||||
|
||||
// ListMediaMetricsDailyRespValidationError is the validation error returned by
|
||||
// ListMediaMetricsDailyResp.Validate if the designated constraints aren't met.
|
||||
type ListMediaMetricsDailyRespValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e ListMediaMetricsDailyRespValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e ListMediaMetricsDailyRespValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e ListMediaMetricsDailyRespValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e ListMediaMetricsDailyRespValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e ListMediaMetricsDailyRespValidationError) ErrorName() string {
|
||||
return "ListMediaMetricsDailyRespValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e ListMediaMetricsDailyRespValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sListMediaMetricsDailyResp.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = ListMediaMetricsDailyRespValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = ListMediaMetricsDailyRespValidationError{}
|
||||
|
||||
// Validate checks the field values on ListWorkMetricsDailyReq with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *ListWorkMetricsDailyReq) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on ListWorkMetricsDailyReq with the
|
||||
// rules defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// ListWorkMetricsDailyReqMultiError, or nil if none found.
|
||||
func (m *ListWorkMetricsDailyReq) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *ListWorkMetricsDailyReq) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for IsSuccess
|
||||
|
||||
// no validation rules for FailType
|
||||
|
||||
// no validation rules for Page
|
||||
|
||||
// no validation rules for PageSize
|
||||
|
||||
// no validation rules for Date
|
||||
|
||||
if len(errors) > 0 {
|
||||
return ListWorkMetricsDailyReqMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListWorkMetricsDailyReqMultiError is an error wrapping multiple validation
|
||||
// errors returned by ListWorkMetricsDailyReq.ValidateAll() if the designated
|
||||
// constraints aren't met.
|
||||
type ListWorkMetricsDailyReqMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m ListWorkMetricsDailyReqMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m ListWorkMetricsDailyReqMultiError) AllErrors() []error { return m }
|
||||
|
||||
// ListWorkMetricsDailyReqValidationError is the validation error returned by
|
||||
// ListWorkMetricsDailyReq.Validate if the designated constraints aren't met.
|
||||
type ListWorkMetricsDailyReqValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e ListWorkMetricsDailyReqValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e ListWorkMetricsDailyReqValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e ListWorkMetricsDailyReqValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e ListWorkMetricsDailyReqValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e ListWorkMetricsDailyReqValidationError) ErrorName() string {
|
||||
return "ListWorkMetricsDailyReqValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e ListWorkMetricsDailyReqValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sListWorkMetricsDailyReq.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = ListWorkMetricsDailyReqValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = ListWorkMetricsDailyReqValidationError{}
|
||||
|
||||
// Validate checks the field values on WorkMetricsDailyInfo with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *WorkMetricsDailyInfo) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on WorkMetricsDailyInfo with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// WorkMetricsDailyInfoMultiError, or nil if none found.
|
||||
func (m *WorkMetricsDailyInfo) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *WorkMetricsDailyInfo) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for Uuid
|
||||
|
||||
// no validation rules for WorkUuid
|
||||
|
||||
// no validation rules for ArtistUuid
|
||||
|
||||
// no validation rules for MediaAccUserID
|
||||
|
||||
// no validation rules for MediaName
|
||||
|
||||
// no validation rules for ArtistName
|
||||
|
||||
// no validation rules for ArtistPhone
|
||||
|
||||
// no validation rules for PlatformID
|
||||
|
||||
// no validation rules for Date
|
||||
|
||||
// no validation rules for ViewsCount
|
||||
|
||||
// no validation rules for LikesCount
|
||||
|
||||
// no validation rules for CommentsCount
|
||||
|
||||
// no validation rules for SharesCount
|
||||
|
||||
// no validation rules for PublishMediaID
|
||||
|
||||
// no validation rules for ProfileKey
|
||||
|
||||
// no validation rules for IsSuccess
|
||||
|
||||
// no validation rules for FailReason
|
||||
|
||||
// no validation rules for FailType
|
||||
|
||||
// no validation rules for CreatedAt
|
||||
|
||||
// no validation rules for UpdatedAt
|
||||
|
||||
if len(errors) > 0 {
|
||||
return WorkMetricsDailyInfoMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// WorkMetricsDailyInfoMultiError is an error wrapping multiple validation
|
||||
// errors returned by WorkMetricsDailyInfo.ValidateAll() if the designated
|
||||
// constraints aren't met.
|
||||
type WorkMetricsDailyInfoMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m WorkMetricsDailyInfoMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m WorkMetricsDailyInfoMultiError) AllErrors() []error { return m }
|
||||
|
||||
// WorkMetricsDailyInfoValidationError is the validation error returned by
|
||||
// WorkMetricsDailyInfo.Validate if the designated constraints aren't met.
|
||||
type WorkMetricsDailyInfoValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e WorkMetricsDailyInfoValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e WorkMetricsDailyInfoValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e WorkMetricsDailyInfoValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e WorkMetricsDailyInfoValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e WorkMetricsDailyInfoValidationError) ErrorName() string {
|
||||
return "WorkMetricsDailyInfoValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e WorkMetricsDailyInfoValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sWorkMetricsDailyInfo.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = WorkMetricsDailyInfoValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = WorkMetricsDailyInfoValidationError{}
|
||||
|
||||
// Validate checks the field values on ListWorkMetricsDailyResp with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *ListWorkMetricsDailyResp) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on ListWorkMetricsDailyResp with the
|
||||
// rules defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// ListWorkMetricsDailyRespMultiError, or nil if none found.
|
||||
func (m *ListWorkMetricsDailyResp) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *ListWorkMetricsDailyResp) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
for idx, item := range m.GetData() {
|
||||
_, _ = idx, item
|
||||
|
||||
if all {
|
||||
switch v := interface{}(item).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, ListWorkMetricsDailyRespValidationError{
|
||||
field: fmt.Sprintf("Data[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, ListWorkMetricsDailyRespValidationError{
|
||||
field: fmt.Sprintf("Data[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return ListWorkMetricsDailyRespValidationError{
|
||||
field: fmt.Sprintf("Data[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// no validation rules for Count
|
||||
|
||||
if len(errors) > 0 {
|
||||
return ListWorkMetricsDailyRespMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListWorkMetricsDailyRespMultiError is an error wrapping multiple validation
|
||||
// errors returned by ListWorkMetricsDailyResp.ValidateAll() if the designated
|
||||
// constraints aren't met.
|
||||
type ListWorkMetricsDailyRespMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m ListWorkMetricsDailyRespMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m ListWorkMetricsDailyRespMultiError) AllErrors() []error { return m }
|
||||
|
||||
// ListWorkMetricsDailyRespValidationError is the validation error returned by
|
||||
// ListWorkMetricsDailyResp.Validate if the designated constraints aren't met.
|
||||
type ListWorkMetricsDailyRespValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e ListWorkMetricsDailyRespValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e ListWorkMetricsDailyRespValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e ListWorkMetricsDailyRespValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e ListWorkMetricsDailyRespValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e ListWorkMetricsDailyRespValidationError) ErrorName() string {
|
||||
return "ListWorkMetricsDailyRespValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e ListWorkMetricsDailyRespValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sListWorkMetricsDailyResp.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = ListWorkMetricsDailyRespValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = ListWorkMetricsDailyRespValidationError{}
|
||||
|
||||
// Validate checks the field values on WorkListResp_Info with the rules defined
|
||||
// in the proto definition for this message. If any rules are violated, the
|
||||
// first error encountered is returned, or nil if there are no violations.
|
||||
|
||||
@ -97,6 +97,9 @@ type CastClient interface {
|
||||
// 日级指标批量更新接口
|
||||
UpsertMediaMetricsDailyBatch(ctx context.Context, in *UpsertMediaMetricsDailyBatchReq, opts ...grpc_go.CallOption) (*UpsertMediaMetricsDailyBatchResp, common.ErrorWithAttachment)
|
||||
UpsertWorkMetricsDailyBatch(ctx context.Context, in *UpsertWorkMetricsDailyBatchReq, opts ...grpc_go.CallOption) (*UpsertWorkMetricsDailyBatchResp, common.ErrorWithAttachment)
|
||||
// 日级指标查询接口
|
||||
ListMediaMetricsDaily(ctx context.Context, in *ListMediaMetricsDailyReq, opts ...grpc_go.CallOption) (*ListMediaMetricsDailyResp, common.ErrorWithAttachment)
|
||||
ListWorkMetricsDaily(ctx context.Context, in *ListWorkMetricsDailyReq, opts ...grpc_go.CallOption) (*ListWorkMetricsDailyResp, common.ErrorWithAttachment)
|
||||
// 艺人AyrShare信息相关接口
|
||||
GetArtistAyrShareInfo(ctx context.Context, in *GetArtistAyrShareInfoReq, opts ...grpc_go.CallOption) (*GetArtistAyrShareInfoResp, common.ErrorWithAttachment)
|
||||
// 作品平台信息相关接口
|
||||
@ -168,6 +171,8 @@ type CastClientImpl struct {
|
||||
TobeConfirmedList func(ctx context.Context, in *TobeConfirmedListReq) (*TobeConfirmedListResp, error)
|
||||
UpsertMediaMetricsDailyBatch func(ctx context.Context, in *UpsertMediaMetricsDailyBatchReq) (*UpsertMediaMetricsDailyBatchResp, error)
|
||||
UpsertWorkMetricsDailyBatch func(ctx context.Context, in *UpsertWorkMetricsDailyBatchReq) (*UpsertWorkMetricsDailyBatchResp, error)
|
||||
ListMediaMetricsDaily func(ctx context.Context, in *ListMediaMetricsDailyReq) (*ListMediaMetricsDailyResp, error)
|
||||
ListWorkMetricsDaily func(ctx context.Context, in *ListWorkMetricsDailyReq) (*ListWorkMetricsDailyResp, error)
|
||||
GetArtistAyrShareInfo func(ctx context.Context, in *GetArtistAyrShareInfoReq) (*GetArtistAyrShareInfoResp, error)
|
||||
ListWorkPlatformInfo func(ctx context.Context, in *ListWorkPlatformInfoReq) (*ListWorkPlatformInfoResp, error)
|
||||
}
|
||||
@ -544,6 +549,18 @@ func (c *castClient) UpsertWorkMetricsDailyBatch(ctx context.Context, in *Upsert
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpsertWorkMetricsDailyBatch", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) ListMediaMetricsDaily(ctx context.Context, in *ListMediaMetricsDailyReq, opts ...grpc_go.CallOption) (*ListMediaMetricsDailyResp, common.ErrorWithAttachment) {
|
||||
out := new(ListMediaMetricsDailyResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ListMediaMetricsDaily", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) ListWorkMetricsDaily(ctx context.Context, in *ListWorkMetricsDailyReq, opts ...grpc_go.CallOption) (*ListWorkMetricsDailyResp, common.ErrorWithAttachment) {
|
||||
out := new(ListWorkMetricsDailyResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ListWorkMetricsDaily", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) GetArtistAyrShareInfo(ctx context.Context, in *GetArtistAyrShareInfoReq, opts ...grpc_go.CallOption) (*GetArtistAyrShareInfoResp, common.ErrorWithAttachment) {
|
||||
out := new(GetArtistAyrShareInfoResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -628,6 +645,9 @@ type CastServer interface {
|
||||
// 日级指标批量更新接口
|
||||
UpsertMediaMetricsDailyBatch(context.Context, *UpsertMediaMetricsDailyBatchReq) (*UpsertMediaMetricsDailyBatchResp, error)
|
||||
UpsertWorkMetricsDailyBatch(context.Context, *UpsertWorkMetricsDailyBatchReq) (*UpsertWorkMetricsDailyBatchResp, error)
|
||||
// 日级指标查询接口
|
||||
ListMediaMetricsDaily(context.Context, *ListMediaMetricsDailyReq) (*ListMediaMetricsDailyResp, error)
|
||||
ListWorkMetricsDaily(context.Context, *ListWorkMetricsDailyReq) (*ListWorkMetricsDailyResp, error)
|
||||
// 艺人AyrShare信息相关接口
|
||||
GetArtistAyrShareInfo(context.Context, *GetArtistAyrShareInfoReq) (*GetArtistAyrShareInfoResp, error)
|
||||
// 作品平台信息相关接口
|
||||
@ -820,6 +840,12 @@ func (UnimplementedCastServer) UpsertMediaMetricsDailyBatch(context.Context, *Up
|
||||
func (UnimplementedCastServer) UpsertWorkMetricsDailyBatch(context.Context, *UpsertWorkMetricsDailyBatchReq) (*UpsertWorkMetricsDailyBatchResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpsertWorkMetricsDailyBatch not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) ListMediaMetricsDaily(context.Context, *ListMediaMetricsDailyReq) (*ListMediaMetricsDailyResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListMediaMetricsDaily not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) ListWorkMetricsDaily(context.Context, *ListWorkMetricsDailyReq) (*ListWorkMetricsDailyResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListWorkMetricsDaily not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) GetArtistAyrShareInfo(context.Context, *GetArtistAyrShareInfoReq) (*GetArtistAyrShareInfoResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetArtistAyrShareInfo not implemented")
|
||||
}
|
||||
@ -2594,6 +2620,64 @@ func _Cast_UpsertWorkMetricsDailyBatch_Handler(srv interface{}, ctx context.Cont
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Cast_ListMediaMetricsDaily_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListMediaMetricsDailyReq)
|
||||
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("ListMediaMetricsDaily", 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_ListWorkMetricsDaily_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListWorkMetricsDailyReq)
|
||||
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("ListWorkMetricsDaily", 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_GetArtistAyrShareInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetArtistAyrShareInfoReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -2899,6 +2983,14 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "UpsertWorkMetricsDailyBatch",
|
||||
Handler: _Cast_UpsertWorkMetricsDailyBatch_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListMediaMetricsDaily",
|
||||
Handler: _Cast_ListMediaMetricsDaily_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListWorkMetricsDaily",
|
||||
Handler: _Cast_ListWorkMetricsDaily_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetArtistAyrShareInfo",
|
||||
Handler: _Cast_GetArtistAyrShareInfo_Handler,
|
||||
|
||||
@ -22,4 +22,5 @@ type Item struct {
|
||||
Domain string `json:"Domain"`
|
||||
Status int `json:"Status"`
|
||||
Reply string `json:"Reply"`
|
||||
UpdatedAt string `json:"UpdatedAt"`
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ func MediaRouter(r *gin.RouterGroup) {
|
||||
media.POST("refresh-token", serviceCast.RefreshToken)
|
||||
media.POST("artist-info", serviceCast.ArtistInfo)
|
||||
media.POST("sync-as-profile", serviceCast.SyncAsProfile)
|
||||
media.POST("import-media-account", serviceCast.ImportMediaAccount)
|
||||
}
|
||||
mediaNoLogin := r.Group("media")
|
||||
{
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"fonchain-fiee/cmd/config"
|
||||
"fonchain-fiee/pkg/e"
|
||||
modelCast "fonchain-fiee/pkg/model/cast"
|
||||
"fonchain-fiee/pkg/model/login"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"fonchain-fiee/pkg/utils"
|
||||
"net/http"
|
||||
@ -522,330 +523,194 @@ func SyncAsProfile(ctx *gin.Context) {
|
||||
|
||||
// ImportMediaAccount 导入自媒体账号
|
||||
func ImportMediaAccount(ctx *gin.Context) {
|
||||
var failedRecords []FailedRecord
|
||||
var successRecords []SuccessRecord
|
||||
|
||||
// 1. 接收上传的Excel文件
|
||||
excelFile, err := ctx.FormFile("file")
|
||||
if err != nil {
|
||||
service.Error(ctx, errors.New("缺少Excel文件"))
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 2. 保存临时文件
|
||||
tempDir := "./runtime/media"
|
||||
_, err = utils.CheckDirPath(tempDir, true)
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
fileName := fmt.Sprintf("%d_media_account.xlsx", time.Now().UnixMicro())
|
||||
excelPath := filepath.Join(tempDir, fileName)
|
||||
if err = ctx.SaveUploadedFile(excelFile, excelPath); err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 3. 读取Excel数据
|
||||
mediaAccounts, err := readMediaAccountExcel(excelPath)
|
||||
excelData, err := excelize.OpenFile(excelPath)
|
||||
if err != nil {
|
||||
service.Error(ctx, fmt.Errorf("读取Excel失败: %w", err))
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
defer excelData.Close()
|
||||
rows, err := excelData.GetRows("Sheet1")
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
loginInfo := login.GetUserInfoFromC(ctx)
|
||||
for line, row := range rows {
|
||||
if line == 0 {
|
||||
continue
|
||||
}
|
||||
if len(row) < 3 {
|
||||
continue
|
||||
}
|
||||
subNum := strings.TrimSpace(row[1])
|
||||
if subNum == "" {
|
||||
continue
|
||||
}
|
||||
var subInfoResp *accountFiee.UserInfoResponse
|
||||
//查询艺人信息
|
||||
//if config.AppConfig.System.AppMode == "dev" {
|
||||
subInfoResp = &accountFiee.UserInfoResponse{
|
||||
Id: 1245,
|
||||
SubNum: "FL00023",
|
||||
Status: 0,
|
||||
Name: "测试远",
|
||||
TelNum: "1826145872",
|
||||
TelAreaCode: "86",
|
||||
}
|
||||
//} else {
|
||||
subInfoResp, err = service.AccountFieeProvider.SubNumGetInfo(context.Background(), &accountFiee.SubNumGetInfoRequest{
|
||||
SubNum: subNum,
|
||||
Domain: "app",
|
||||
})
|
||||
//}
|
||||
if err != nil {
|
||||
excelSetRemark(excelData, line, "查询艺人出错")
|
||||
continue
|
||||
}
|
||||
if subInfoResp.Id == 0 {
|
||||
excelSetRemark(excelData, line, "艺人不存在")
|
||||
continue
|
||||
}
|
||||
var tiktokName, insName, dmName string
|
||||
if len(row) >= 3 {
|
||||
tiktokName = strings.TrimSpace(row[2])
|
||||
}
|
||||
if len(row) >= 4 {
|
||||
insName = strings.TrimSpace(row[3])
|
||||
}
|
||||
if len(row) >= 5 {
|
||||
dmName = strings.TrimSpace(row[4])
|
||||
}
|
||||
if tiktokName == "" && insName == "" && dmName == "" {
|
||||
excelSetRemark(excelData, line, "请填写账号")
|
||||
continue
|
||||
}
|
||||
if tiktokName != "" {
|
||||
if err = updateMediaAccount(tiktokName, cast.PlatformIDENUM_TIKTOK, subInfoResp, loginInfo); err != nil {
|
||||
excelSetRemark(excelData, line, fmt.Sprintf("%s:%s", tiktokName, err.Error()))
|
||||
}
|
||||
}
|
||||
if insName != "" {
|
||||
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(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
|
||||
}
|
||||
|
||||
if len(mediaAccounts) == 0 {
|
||||
service.Error(ctx, errors.New("Excel中没有有效数据"))
|
||||
// 打开文件 遍历一下 F列没有数据success + 1 并且删掉,有值的fail+1 留着
|
||||
var successCount, failCount int
|
||||
rows, err = excelData.GetRows("Sheet1")
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 4. 处理每个账号
|
||||
for _, account := range mediaAccounts {
|
||||
for platformID, accountInfo := range account.Account {
|
||||
// 跳过空账号信息
|
||||
if accountInfo.AccountId == "" && accountInfo.NickName == "" {
|
||||
// 记录需要删除的行(从后往前删除,避免行号变化)
|
||||
rowsToDelete := make([]int, 0)
|
||||
for line := 1; line < len(rows); line++ { // 从第2行开始(跳过表头)
|
||||
remarkCell := fmt.Sprintf("F%d", line+1)
|
||||
remark, _ := excelData.GetCellValue("Sheet1", remarkCell)
|
||||
if remark == "" {
|
||||
// F列没有数据,表示成功
|
||||
successCount++
|
||||
rowsToDelete = append(rowsToDelete, line+1)
|
||||
} else {
|
||||
// F列有值,表示失败
|
||||
failCount++
|
||||
}
|
||||
}
|
||||
|
||||
// 从后往前删除成功的行
|
||||
for i := len(rowsToDelete) - 1; i >= 0; i-- {
|
||||
if err = excelData.RemoveRow("Sheet1", rowsToDelete[i]); err != nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// 查询用户信息
|
||||
res, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
// 再次保存文件
|
||||
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{}{
|
||||
"successCount": successCount,
|
||||
"failCount": failCount,
|
||||
"url": urlResult,
|
||||
})
|
||||
if err != nil {
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: fmt.Sprintf("获取用户信息失败: %s", err.Error()),
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
if res.Count == 0 {
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: "未找到用户信息",
|
||||
})
|
||||
continue
|
||||
func excelSetRemark(excelData *excelize.File, line int, remark string) {
|
||||
oldRemark, _ := excelData.GetCellValue("Sheet1", fmt.Sprintf("%s%d", "F", line+1))
|
||||
if oldRemark != "" {
|
||||
remark = fmt.Sprintf("%s\n;%s", oldRemark, remark)
|
||||
}
|
||||
excelData.SetCellValue("Sheet1", fmt.Sprintf("%s%d", "F", line+1), remark)
|
||||
}
|
||||
|
||||
// 获取用户详细信息
|
||||
var infoResp *accountFiee.UserInfoResponse
|
||||
infoResp, err = GetArtistAccountInfo(res.UserList[0].Id)
|
||||
if err != nil {
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: fmt.Sprintf("查询用户详细信息失败: %s", err.Error()),
|
||||
})
|
||||
continue
|
||||
func updateMediaAccount(platformName string, platformId cast.PlatformIDENUM, subInfoResp *accountFiee.UserInfoResponse, loginInfo login.Info) error {
|
||||
var err error
|
||||
//if config.AppConfig.System.AppMode != "dev" {
|
||||
if _, err = CheckUserBundleBalance(int32(subInfoResp.Id), modelCast.BalanceTypeAccountValue); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if infoResp.SubNum == "" {
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: "用户不存在",
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
// 检查并创建AS Profile
|
||||
if err = CheckAsProfile(infoResp); err != nil {
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: fmt.Sprintf("创建AS Profile失败: %s", err.Error()),
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
// 验证平台ID
|
||||
if _, ok := cast.PlatformIDENUM_name[int32(platformID)]; !ok {
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: "无效的平台ID",
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
artistUuid := strconv.FormatUint(res.UserList[0].Id, 10)
|
||||
userID := int32(res.UserList[0].Id)
|
||||
|
||||
// 查询该艺人是否已存在该平台账号
|
||||
userResp, err := service.CastProvider.MediaUserList(context.Background(), &cast.MediaUserListReq{
|
||||
ArtistUuid: artistUuid,
|
||||
Page: 1,
|
||||
PageSize: 100,
|
||||
})
|
||||
if err != nil {
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: fmt.Sprintf("查询已有账号失败: %s", err.Error()),
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
// 检查是否已经存在该平台的账号
|
||||
accountExists := false
|
||||
if userResp != nil && len(userResp.Data) > 0 {
|
||||
for _, v := range userResp.Data {
|
||||
if v.PlatformID == uint32(platformID) {
|
||||
accountExists = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if accountExists {
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: "该平台账号已存在",
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
// 检查并消耗账户余额
|
||||
if _, err = CheckUserBundleBalance(userID, modelCast.BalanceTypeAccountValue); err != nil {
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: fmt.Sprintf("账户余额不足: %s", err.Error()),
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
// 增加账户消耗数量
|
||||
_, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
|
||||
UserId: userID,
|
||||
UserId: int32(subInfoResp.Id),
|
||||
AccountConsumptionNumber: 1,
|
||||
})
|
||||
if err != nil {
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: fmt.Sprintf("扣除账户余额失败: %s", err.Error()),
|
||||
})
|
||||
continue
|
||||
return err
|
||||
}
|
||||
|
||||
// 创建自媒体账号
|
||||
mediaAccountResp, err := service.CastProvider.UpdateMediaAccount(ctx, &cast.UpdateMediaAccountReq{
|
||||
ArtistUuid: artistUuid,
|
||||
PlatformID: platformID,
|
||||
PlatformUserName: accountInfo.NickName,
|
||||
PlatformUserID: accountInfo.AccountId,
|
||||
ArtistName: infoResp.Name,
|
||||
ArtistPhone: infoResp.TelNum,
|
||||
ArtistPhoneAreaCode: infoResp.TelAreaCode,
|
||||
ArtistSubNum: infoResp.SubNum,
|
||||
//}
|
||||
_, err = service.CastProvider.UpdateMediaAccount(context.Background(), &cast.UpdateMediaAccountReq{
|
||||
PlatformID: platformId,
|
||||
PlatformUserName: platformName,
|
||||
PlatformUserID: "",
|
||||
ArtistUuid: fmt.Sprint(subInfoResp.Id),
|
||||
ArtistName: subInfoResp.Name,
|
||||
ArtistPhone: subInfoResp.TelNum,
|
||||
MediaAccountUuid: "",
|
||||
ManagerUuid: fmt.Sprint(loginInfo.ID),
|
||||
ManagerUserName: loginInfo.Name,
|
||||
ArtistSubNum: subInfoResp.SubNum,
|
||||
})
|
||||
|
||||
//if config.AppConfig.System.AppMode != "dev" {
|
||||
if err != nil {
|
||||
// 创建失败,回退余额
|
||||
_, _ = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
|
||||
UserId: userID,
|
||||
_, err = service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{
|
||||
UserId: int32(subInfoResp.Id),
|
||||
AccountConsumptionNumber: -1,
|
||||
})
|
||||
failedRecords = append(failedRecords, FailedRecord{
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
Msg: fmt.Sprintf("创建账号失败: %s", err.Error()),
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
// 记录成功
|
||||
successRecords = append(successRecords, SuccessRecord{
|
||||
MediaAccountUuid: mediaAccountResp.MediaAccountUuid,
|
||||
Name: account.Name,
|
||||
SubNum: account.SubNum,
|
||||
Platform: modelCast.PlatformNameKv[uint32(platformID)],
|
||||
PlatformUserName: accountInfo.NickName,
|
||||
PlatformUserID: accountInfo.AccountId,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 5. 返回结果
|
||||
service.Success(ctx, map[string]interface{}{
|
||||
"successCount": len(successRecords),
|
||||
"failedCount": len(failedRecords),
|
||||
"successRecords": successRecords,
|
||||
"failedRecords": failedRecords,
|
||||
})
|
||||
}
|
||||
|
||||
// readMediaAccountExcel 读取自媒体账号Excel文件
|
||||
func readMediaAccountExcel(excelPath string) ([]MediaAccountImport, 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
|
||||
}
|
||||
|
||||
var accounts []MediaAccountImport
|
||||
for i, row := range rows {
|
||||
// 跳过表头
|
||||
if i == 0 || len(row) < 3 {
|
||||
continue
|
||||
}
|
||||
|
||||
// 获取基本信息
|
||||
index := strings.TrimSpace(row[0])
|
||||
name := strings.TrimSpace(row[1])
|
||||
subNum := strings.TrimSpace(row[2])
|
||||
|
||||
if name == "" && subNum == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
tmp := MediaAccountImport{
|
||||
Index: index,
|
||||
Name: name,
|
||||
SubNum: subNum,
|
||||
Account: make(map[cast.PlatformIDENUM]AccountInfo),
|
||||
}
|
||||
|
||||
// 读取TikTok账号信息 (列D, E)
|
||||
tiktokId, _ := f.GetCellValue(sheetName, fmt.Sprintf("D%d", i+1))
|
||||
tiktokNickName, _ := f.GetCellValue(sheetName, fmt.Sprintf("E%d", i+1))
|
||||
tmp.Account[cast.PlatformIDENUM_TIKTOK] = AccountInfo{
|
||||
AccountId: strings.TrimSpace(tiktokId),
|
||||
NickName: strings.TrimSpace(tiktokNickName),
|
||||
}
|
||||
|
||||
// 读取YouTube账号信息 (列F, G)
|
||||
youtubeId, _ := f.GetCellValue(sheetName, fmt.Sprintf("F%d", i+1))
|
||||
youtubeNickName, _ := f.GetCellValue(sheetName, fmt.Sprintf("G%d", i+1))
|
||||
tmp.Account[cast.PlatformIDENUM_YOUTUBE] = AccountInfo{
|
||||
AccountId: strings.TrimSpace(youtubeId),
|
||||
NickName: strings.TrimSpace(youtubeNickName),
|
||||
}
|
||||
|
||||
// 读取Instagram账号信息 (列H, I)
|
||||
insId, _ := f.GetCellValue(sheetName, fmt.Sprintf("H%d", i+1))
|
||||
insNickName, _ := f.GetCellValue(sheetName, fmt.Sprintf("I%d", i+1))
|
||||
tmp.Account[cast.PlatformIDENUM_INS] = AccountInfo{
|
||||
AccountId: strings.TrimSpace(insId),
|
||||
NickName: strings.TrimSpace(insNickName),
|
||||
}
|
||||
|
||||
accounts = append(accounts, tmp)
|
||||
}
|
||||
|
||||
return accounts, nil
|
||||
}
|
||||
|
||||
// MediaAccountImport 自媒体账号导入结构
|
||||
type MediaAccountImport struct {
|
||||
Index string `json:"index"`
|
||||
Name string `json:"name"`
|
||||
SubNum string `json:"subNum"`
|
||||
Account map[cast.PlatformIDENUM]AccountInfo `json:"account"`
|
||||
}
|
||||
|
||||
// AccountInfo 账号信息
|
||||
type AccountInfo struct {
|
||||
NickName string `json:"nickName"`
|
||||
AccountId string `json:"accountId"`
|
||||
}
|
||||
|
||||
// FailedRecord 失败记录
|
||||
type FailedRecord struct {
|
||||
Name string `json:"name"`
|
||||
SubNum string `json:"subNum"`
|
||||
Platform string `json:"platform"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
// SuccessRecord 成功记录
|
||||
type SuccessRecord struct {
|
||||
MediaAccountUuid string `json:"mediaAccountUuid"`
|
||||
Name string `json:"name"`
|
||||
SubNum string `json:"subNum"`
|
||||
Platform string `json:"platform"`
|
||||
PlatformUserName string `json:"platformUserName"`
|
||||
PlatformUserID string `json:"platformUserID"`
|
||||
//}
|
||||
return err
|
||||
}
|
||||
|
||||
@ -599,12 +599,12 @@ func PostAS(workUuids []string) (errs []error) {
|
||||
postIDs := postResp.Posts[0].PostIds
|
||||
postData, _ := json.Marshal(postResp)
|
||||
for _, postInfo := range postIDs {
|
||||
var platformID uint32
|
||||
var pid uint32
|
||||
switch postInfo.Platform {
|
||||
case "tiktok":
|
||||
platformID = 1
|
||||
pid = 1
|
||||
case "instagram":
|
||||
platformID = 3
|
||||
pid = 3
|
||||
}
|
||||
publishStatus := cast.PublishStatusENUM_PublishMediaStatus_NO
|
||||
if postInfo.Status == "success" {
|
||||
@ -620,7 +620,7 @@ func PostAS(workUuids []string) (errs []error) {
|
||||
infoReq.PlatformInfoData = append(infoReq.PlatformInfoData, &cast.PlatformInfo{
|
||||
WorkUuid: workDetail.WorkUuid,
|
||||
MediaAccountUuid: "", //FIXME
|
||||
PlatformID: platformID,
|
||||
PlatformID: pid,
|
||||
PublishType: 2,
|
||||
PublishResp: string(postBytes),
|
||||
PublishMediaId: postResp.Posts[0].Id,
|
||||
@ -719,11 +719,13 @@ func RefreshWorkApprovalStatus(ctx *gin.Context, approvalIDWorkUuidMap map[int]s
|
||||
WorkUuid: approvalIDWorkUuidMap[approvalId],
|
||||
ApprovalID: fmt.Sprint(approvalId),
|
||||
ApprovalReply: "",
|
||||
ApprovalTime: v.UpdatedAt,
|
||||
})
|
||||
continue
|
||||
}
|
||||
var workAction cast.WorkActionENUM
|
||||
if v.Status == 2 {
|
||||
uTimes, _ := stime.DatetimeToTimes(v.UpdatedAt, "2006-01-02 15:04:05")
|
||||
if v.Status == 2 && int64(uTimes) <= time.Now().Unix() {
|
||||
workAction = cast.WorkActionENUM_APPROVAL_PASS
|
||||
} else if v.Status == 3 {
|
||||
workAction = cast.WorkActionENUM_APPROVAL_REJECT
|
||||
@ -735,6 +737,7 @@ func RefreshWorkApprovalStatus(ctx *gin.Context, approvalIDWorkUuidMap map[int]s
|
||||
WorkUuid: approvalIDWorkUuidMap[approvalId],
|
||||
ApprovalID: fmt.Sprint(approvalId),
|
||||
ApprovalReply: v.Reply,
|
||||
ApprovalTime: v.UpdatedAt,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,10 +82,9 @@ func SecurityText(textVal string) (bool, error) {
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
fmt.Println("开始获取STS Token")
|
||||
err = aliConfig.GetSTSToken()
|
||||
if err != nil {
|
||||
return false, errors.New("获取STS Token失败")
|
||||
return false, errors.New("获取图片失败")
|
||||
}
|
||||
if err = handleTextScan(aliConfig, textVal); err != nil {
|
||||
return false, err
|
||||
@ -99,12 +98,10 @@ func securityScan(fileInfo *modelSecurity.FileInfo) (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println("开始获取STS Token")
|
||||
err = aliConfig.GetSTSToken()
|
||||
if err != nil {
|
||||
return errors.New("获取STS Token失败")
|
||||
return errors.New("获取凭证失败")
|
||||
}
|
||||
fmt.Println("获取STS Token成功")
|
||||
switch fileInfo.FileType {
|
||||
case "image":
|
||||
return handleImageScan(aliConfig, fileInfo)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user