Create & Init Project...
This commit is contained in:
54
app/admin/main/mcn/model/BUILD
Normal file
54
app/admin/main/mcn/model/BUILD
Normal file
@ -0,0 +1,54 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
"go_test",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"audit_log.go",
|
||||
"base_model.go",
|
||||
"formatter.go",
|
||||
"mcn.go",
|
||||
"mcn_pay.go",
|
||||
"msg.go",
|
||||
"reply.go",
|
||||
"req.go",
|
||||
"request_base.go",
|
||||
"request_example.go",
|
||||
"statistics.go",
|
||||
],
|
||||
importpath = "go-common/app/admin/main/mcn/model",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//app/interface/main/mcn/model/datamodel:go_default_library",
|
||||
"//app/service/main/archive/model/archive:go_default_library",
|
||||
"//library/time:go_default_library",
|
||||
"//vendor/github.com/pkg/errors:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["reply_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
tags = ["automanaged"],
|
||||
)
|
12
app/admin/main/mcn/model/audit_log.go
Normal file
12
app/admin/main/mcn/model/audit_log.go
Normal file
@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
const (
|
||||
// MCNLogBizID mcn审核日志
|
||||
MCNLogBizID int = 221
|
||||
// MCNUPLogBizID mcn up主审核日志
|
||||
MCNUPLogBizID int = 222
|
||||
// MCNPayDateLogBizID mcn 付款周期审核日志
|
||||
MCNPayDateLogBizID int = 223
|
||||
// MCNRecommendLogBizID mcn 推荐池审核日志
|
||||
MCNRecommendLogBizID int = 224
|
||||
)
|
62
app/admin/main/mcn/model/base_model.go
Normal file
62
app/admin/main/mcn/model/base_model.go
Normal file
@ -0,0 +1,62 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"crypto/hmac"
|
||||
"crypto/sha1"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"hash"
|
||||
"math/rand"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// const .
|
||||
const (
|
||||
_template = "%s\n%s\n%s\n%d\n"
|
||||
BfsEasyPath = "/bfs/mcn"
|
||||
TimeFormatSec = "2006-01-02 15:04:05"
|
||||
TimeFormatDay = "2006-01-02"
|
||||
AllActiveTid = 65535 //mcn_data_summary表active_tid所有分区
|
||||
DefaultTyName = "默认"
|
||||
)
|
||||
|
||||
// BuildBfsURL is.
|
||||
func BuildBfsURL(raw string, appkey, secret, bucket, ePath string) string {
|
||||
if raw == "" {
|
||||
return ""
|
||||
}
|
||||
ori, err := url.Parse(raw)
|
||||
if err != nil {
|
||||
return raw
|
||||
}
|
||||
if strings.HasPrefix(ori.Path, ePath) {
|
||||
token := authorize(appkey, secret, "GET", bucket, filepath.Base(ori.Path), time.Now().Unix())
|
||||
p := url.Values{}
|
||||
p.Set("token", token)
|
||||
ori.RawQuery = p.Encode()
|
||||
}
|
||||
if ori.Hostname() == "" {
|
||||
ori.Host = fmt.Sprintf("i%d.hdslb.com", rand.Int63n(3))
|
||||
ori.Scheme = "http"
|
||||
}
|
||||
return ori.String()
|
||||
}
|
||||
|
||||
// Authorize returns authorization for upload file to bfs
|
||||
func authorize(key, secret, method, bucket, file string, expire int64) (authorization string) {
|
||||
var (
|
||||
content string
|
||||
mac hash.Hash
|
||||
signature string
|
||||
)
|
||||
content = fmt.Sprintf(_template, method, bucket, file, expire)
|
||||
mac = hmac.New(sha1.New, []byte(secret))
|
||||
mac.Write([]byte(content))
|
||||
signature = base64.StdEncoding.EncodeToString(mac.Sum(nil))
|
||||
authorization = fmt.Sprintf("%s:%s:%d", key, signature, expire)
|
||||
return
|
||||
}
|
16
app/admin/main/mcn/model/formatter.go
Normal file
16
app/admin/main/mcn/model/formatter.go
Normal file
@ -0,0 +1,16 @@
|
||||
package model
|
||||
|
||||
import "encoding/csv"
|
||||
|
||||
//CsvFormatter CsvFormatter
|
||||
type CsvFormatter interface {
|
||||
GetFileName() string
|
||||
// ToCsv do not call flush
|
||||
ToCsv(writer *csv.Writer)
|
||||
}
|
||||
|
||||
//ExportArgInterface export interface
|
||||
type ExportArgInterface interface {
|
||||
// ExportFormat options: json, csv
|
||||
ExportFormat() string
|
||||
}
|
689
app/admin/main/mcn/model/mcn.go
Normal file
689
app/admin/main/mcn/model/mcn.go
Normal file
@ -0,0 +1,689 @@
|
||||
package model
|
||||
|
||||
// MCNSignState .
|
||||
type MCNSignState int8
|
||||
|
||||
// const .
|
||||
const (
|
||||
// MCNSignStateUnKnown 未知状态
|
||||
MCNSignStateUnKnown MCNSignState = -1
|
||||
// MCNSignStateNoApply 未申请
|
||||
MCNSignStateNoApply MCNSignState = 0
|
||||
// MCNSignStateOnReview 待审核
|
||||
MCNSignStateOnReview MCNSignState = 1
|
||||
// MCNSignStateOnReject 已驳回
|
||||
MCNSignStateOnReject MCNSignState = 2
|
||||
// MCNSignStateOnSign 已签约
|
||||
MCNSignStateOnSign MCNSignState = 10
|
||||
// MCNSignStateOnCooling 冷却中
|
||||
MCNSignStateOnCooling MCNSignState = 11
|
||||
// MCNSignStateOnExpire 已到期
|
||||
MCNSignStateOnExpire MCNSignState = 12
|
||||
// MCNSignStateOnBlock 已封禁
|
||||
MCNSignStateOnBlock MCNSignState = 13
|
||||
// MCNSignStateOnClear 已清退
|
||||
MCNSignStateOnClear MCNSignState = 14
|
||||
// MCNSignStateOnPreOpen 待开启
|
||||
MCNSignStateOnPreOpen MCNSignState = 15
|
||||
// MCNSignStateOnDelete 已移除
|
||||
MCNSignStateOnDelete MCNSignState = 100
|
||||
)
|
||||
|
||||
func (state MCNSignState) String() string {
|
||||
switch state {
|
||||
case MCNSignStateNoApply:
|
||||
return "未申请"
|
||||
case MCNSignStateOnReview:
|
||||
return "待审核"
|
||||
case MCNSignStateOnReject:
|
||||
return "已驳回"
|
||||
case MCNSignStateOnSign:
|
||||
return "已签约"
|
||||
case MCNSignStateOnCooling:
|
||||
return "冷却中"
|
||||
case MCNSignStateOnExpire:
|
||||
return "已到期"
|
||||
case MCNSignStateOnBlock:
|
||||
return "已封禁"
|
||||
case MCNSignStateOnClear:
|
||||
return "已清退"
|
||||
case MCNSignStateOnPreOpen:
|
||||
return "待开启"
|
||||
case MCNSignStateOnDelete:
|
||||
return "已移除"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// MCNSignAction .
|
||||
type MCNSignAction int8
|
||||
|
||||
const (
|
||||
// MCNSignActionEntry 录入
|
||||
MCNSignActionEntry MCNSignAction = 0
|
||||
// MCNSignActionApply 申请
|
||||
MCNSignActionApply MCNSignAction = 1
|
||||
// MCNSignActionReject 驳回
|
||||
MCNSignActionReject MCNSignAction = 2
|
||||
// MCNSignActionPass 通过
|
||||
MCNSignActionPass MCNSignAction = 10
|
||||
// MCNSignActionBlock 封禁
|
||||
MCNSignActionBlock MCNSignAction = 13
|
||||
// MCNSignActionClear 清退
|
||||
MCNSignActionClear MCNSignAction = 14
|
||||
// MCNSignActionRenew 续约
|
||||
MCNSignActionRenew MCNSignAction = 16
|
||||
// MCNSignActionRestore 恢复
|
||||
MCNSignActionRestore MCNSignAction = 17
|
||||
// MCNSignActionPermit 签约用户权限变更(只用于记日志)
|
||||
MCNSignActionPermit MCNSignAction = 99
|
||||
// MCNSignActionDelete 移除
|
||||
MCNSignActionDelete MCNSignAction = 100
|
||||
)
|
||||
|
||||
// GetState .
|
||||
func (action MCNSignAction) GetState(oldState MCNSignState) MCNSignState {
|
||||
switch action {
|
||||
// MCNSignActionEntry 录入
|
||||
case MCNSignActionEntry:
|
||||
return MCNSignStateNoApply
|
||||
// MCNSignActionApply 申请
|
||||
case MCNSignActionApply:
|
||||
return MCNSignStateOnReview
|
||||
// MCNSignActionReject 驳回
|
||||
case MCNSignActionReject:
|
||||
return MCNSignStateOnReject
|
||||
// MCNSignActionPass 通过
|
||||
case MCNSignActionPass:
|
||||
return MCNSignStateOnSign
|
||||
// MCNSignActionBlock 封禁
|
||||
case MCNSignActionBlock:
|
||||
return MCNSignStateOnBlock
|
||||
// MCNSignActionClear 清退
|
||||
case MCNSignActionClear:
|
||||
return MCNSignStateOnClear
|
||||
// MCNSignActionRenew 续约
|
||||
case MCNSignActionRenew:
|
||||
return MCNSignStateOnSign
|
||||
// MCNSignActionRestore 恢复
|
||||
case MCNSignActionRestore:
|
||||
switch oldState {
|
||||
case MCNSignStateOnBlock:
|
||||
return MCNSignStateOnSign
|
||||
case MCNSignStateOnClear:
|
||||
return MCNSignStateNoApply
|
||||
}
|
||||
// MCNSignActionDelete 移除
|
||||
case MCNSignActionDelete:
|
||||
return MCNSignStateOnDelete
|
||||
}
|
||||
return MCNSignState(MCNSignStateUnKnown)
|
||||
}
|
||||
|
||||
// NotRejectState .
|
||||
func (state MCNSignState) NotRejectState() bool {
|
||||
return state != MCNSignStateOnReject
|
||||
}
|
||||
|
||||
// NotRightAction .
|
||||
func (action MCNSignAction) NotRightAction() bool {
|
||||
return action == MCNSignActionReject || action == MCNSignActionPass || action == MCNSignActionDelete
|
||||
}
|
||||
|
||||
// IsOnReviewState .
|
||||
func (state MCNSignState) IsOnReviewState(action MCNSignAction) bool {
|
||||
return state != MCNSignStateOnReview && action != MCNSignActionDelete
|
||||
}
|
||||
|
||||
// IsRenewalState .
|
||||
func (state MCNSignState) IsRenewalState() bool {
|
||||
return state != MCNSignStateOnSign
|
||||
}
|
||||
|
||||
// GetmsgType .
|
||||
func (action MCNSignAction) GetmsgType(oldState MCNSignState) MSGType {
|
||||
switch action {
|
||||
// MCNSignActionEntry 录入
|
||||
case MCNSignActionEntry:
|
||||
return MSGType(0)
|
||||
// MCNSignActionApply 申请
|
||||
case MCNSignActionApply:
|
||||
return MSGType(0)
|
||||
// MCNSignActionReject 驳回
|
||||
case MCNSignActionReject:
|
||||
return McnSignNoApplyPass
|
||||
// MCNSignActionPass 通过
|
||||
case MCNSignActionPass:
|
||||
return McnSignApplyPass
|
||||
// MCNSignActionBlock 封禁
|
||||
case MCNSignActionBlock:
|
||||
return McnBackstageBlock
|
||||
// MCNSignActionClear 清退
|
||||
case MCNSignActionClear:
|
||||
return McnBackstageClose
|
||||
// MCNSignActionRenew 续约
|
||||
case MCNSignActionRenew:
|
||||
return McnRenewcontract
|
||||
// MCNSignActionRestore 恢复
|
||||
case MCNSignActionRestore:
|
||||
switch oldState {
|
||||
case MCNSignStateOnBlock:
|
||||
return McnAccountRestore
|
||||
case MCNSignStateOnClear:
|
||||
return MSGType(0)
|
||||
}
|
||||
// MCNSignActionDelete 移除
|
||||
case MCNSignActionDelete:
|
||||
return MSGType(0)
|
||||
}
|
||||
return MSGType(0)
|
||||
}
|
||||
|
||||
func (action MCNSignAction) String() string {
|
||||
switch action {
|
||||
case MCNSignActionEntry:
|
||||
return "mcn录入"
|
||||
case MCNSignActionApply:
|
||||
return "前台mcn申请"
|
||||
case MCNSignActionReject:
|
||||
return "驳回申请"
|
||||
case MCNSignActionPass:
|
||||
return "申请通过"
|
||||
case MCNSignActionBlock:
|
||||
return "封禁mcn"
|
||||
case MCNSignActionClear:
|
||||
return "清退mcn"
|
||||
case MCNSignActionRenew:
|
||||
return "续约mcn"
|
||||
case MCNSignActionRestore:
|
||||
return "恢复mcn"
|
||||
case MCNSignActionPermit:
|
||||
return "mcn权限变更"
|
||||
case MCNSignActionDelete:
|
||||
return "移除mcn"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// MCNUPState .
|
||||
type MCNUPState int8
|
||||
|
||||
// const .
|
||||
const (
|
||||
// MCNUPStateUnKnown 未知状态
|
||||
MCNUPStateUnKnown MCNUPState = -1
|
||||
// MCNUPStateNoAuthorize 未授权
|
||||
MCNUPStateNoAuthorize MCNUPState = 0
|
||||
// MCNUPStateOnRefuse 已拒绝
|
||||
MCNUPStateOnRefuse MCNUPState = 1
|
||||
// MCNUPStateOnReview 待审核
|
||||
MCNUPStateOnReview MCNUPState = 2
|
||||
// MCNSignStateOnReject 已驳回
|
||||
MCNUPStateOnReject MCNUPState = 3
|
||||
// MCNUPStateOnSign 已签约
|
||||
MCNUPStateOnSign MCNUPState = 10
|
||||
// MCNUPStateOnFreeze 已冻结
|
||||
MCNUPStateOnFreeze MCNUPState = 11
|
||||
// MCNUPStateOnExpire 已到期
|
||||
MCNUPStateOnExpire MCNUPState = 12
|
||||
// MCNUPStateOnBlock 已封禁
|
||||
MCNUPStateOnBlock MCNUPState = 13
|
||||
// MCNUPStateOnClear 已解约
|
||||
MCNUPStateOnClear MCNUPState = 14
|
||||
// MCNUPStateOnPreOpen 待开启
|
||||
MCNUPStateOnPreOpen MCNUPState = 15
|
||||
// MCNUPStateOnDelete 已删除
|
||||
MCNUPStateOnDelete MCNUPState = 100
|
||||
)
|
||||
|
||||
func (state MCNUPState) String() string {
|
||||
switch state {
|
||||
case MCNUPStateNoAuthorize:
|
||||
return "未授权"
|
||||
case MCNUPStateOnRefuse:
|
||||
return "已拒绝"
|
||||
case MCNUPStateOnReview:
|
||||
return "待审核"
|
||||
case MCNUPStateOnReject:
|
||||
return "已驳回"
|
||||
case MCNUPStateOnSign:
|
||||
return "已签约"
|
||||
case MCNUPStateOnFreeze:
|
||||
return "已冻结"
|
||||
case MCNUPStateOnExpire:
|
||||
return "已到期"
|
||||
case MCNUPStateOnBlock:
|
||||
return "已封禁"
|
||||
case MCNUPStateOnClear:
|
||||
return "已解约"
|
||||
case MCNUPStateOnDelete:
|
||||
return "已删除"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// MCNUPAction .
|
||||
type MCNUPAction int8
|
||||
|
||||
const (
|
||||
// MCNUPActionBind 发起绑定
|
||||
MCNUPActionBind MCNUPAction = 0
|
||||
// MCNUPActionReject 运营驳回
|
||||
MCNUPActionReject MCNUPAction = 3
|
||||
// MCNUPActionAgree up主同意
|
||||
MCNUPActionAgree MCNUPAction = 4
|
||||
// MCNUPActionRefuse up主拒绝
|
||||
MCNUPActionRefuse MCNUPAction = 5
|
||||
// MCNUPActionPass 通过
|
||||
MCNUPActionPass MCNUPAction = 10
|
||||
// MCNUPActionFreeze 冻结
|
||||
MCNUPActionFreeze MCNUPAction = 11
|
||||
// MCNUPActionRelease 解约
|
||||
MCNUPActionRelease MCNUPAction = 14
|
||||
// MCNUPActionRestore 恢复
|
||||
MCNUPActionRestore MCNUPAction = 16
|
||||
)
|
||||
|
||||
// GetState .
|
||||
func (action MCNUPAction) GetState() MCNUPState {
|
||||
switch action {
|
||||
// MCNUPActionBind 发起绑定
|
||||
case MCNUPActionBind:
|
||||
return MCNUPStateNoAuthorize
|
||||
// MCNUPActionReject 运营驳回
|
||||
case MCNUPActionReject:
|
||||
return MCNUPStateOnReject
|
||||
// MCNUPActionAgree up主同意
|
||||
case MCNUPActionAgree:
|
||||
return MCNUPStateOnReview
|
||||
// MCNUPActionRefuse up主拒绝
|
||||
case MCNUPActionRefuse:
|
||||
return MCNUPStateOnRefuse
|
||||
// MCNUPActionPass 通过
|
||||
case MCNUPActionPass:
|
||||
return MCNUPStateOnSign
|
||||
// MCNUPActionFreeze 冻结
|
||||
case MCNUPActionFreeze:
|
||||
return MCNUPStateOnFreeze
|
||||
// MCNUPActionRelease 解约
|
||||
case MCNUPActionRelease:
|
||||
return MCNUPStateOnClear
|
||||
// MCNUPActionRestore 恢复
|
||||
case MCNUPActionRestore:
|
||||
return MCNUPStateOnSign
|
||||
}
|
||||
return MCNUPState(MCNUPStateUnKnown)
|
||||
}
|
||||
|
||||
// GetmsgType .
|
||||
func (action MCNUPAction) GetmsgType(isMcn bool) MSGType {
|
||||
switch {
|
||||
// MCNUPActionBind 发起绑定
|
||||
case action == MCNUPActionBind:
|
||||
return McnUpBindAuthApply
|
||||
// MCNUPActionRefuse up主拒绝
|
||||
case action == MCNUPActionRefuse:
|
||||
return McnUpBindAuthApplyRefuse
|
||||
// MCNUPActionAgree up主同意
|
||||
case action == MCNUPActionAgree:
|
||||
return McnUpBindAuthReview
|
||||
// MCNUPActionReject 运营驳回
|
||||
case action == MCNUPActionReject && isMcn:
|
||||
return McnUpBindAuthApplyNoPass
|
||||
case action == MCNUPActionReject && !isMcn:
|
||||
return UpMcnBindAuthApplyNoPass
|
||||
// MCNUPActionPass 通过
|
||||
case action == MCNUPActionPass && isMcn:
|
||||
return McnUpBindAuthApplyPass
|
||||
case action == MCNUPActionPass && !isMcn:
|
||||
return UpMcnBindAuthApplyPass
|
||||
// MCNUPActionFreeze 冻结
|
||||
case action == MCNUPActionFreeze && isMcn:
|
||||
return McnUpRelationFreeze
|
||||
case action == MCNUPActionFreeze && !isMcn:
|
||||
return UpMcnRelationFreeze
|
||||
// MCNUPActionRelease 解约
|
||||
case action == MCNUPActionRelease && isMcn:
|
||||
return McnUpRelationRelease
|
||||
case action == MCNUPActionRelease && !isMcn:
|
||||
return UpMcnRelationRelease
|
||||
// MCNUPActionRestore 恢复
|
||||
case action == MCNUPActionRestore && isMcn:
|
||||
return MSGType(0)
|
||||
case action == MCNUPActionRestore && !isMcn:
|
||||
return MSGType(0)
|
||||
}
|
||||
|
||||
return MSGType(0)
|
||||
}
|
||||
|
||||
func (action MCNUPAction) String() string {
|
||||
switch action {
|
||||
case MCNUPActionBind:
|
||||
return "mcn发起绑定"
|
||||
case MCNUPActionReject:
|
||||
return "运营驳回"
|
||||
case MCNUPActionAgree:
|
||||
return "up主同意"
|
||||
case MCNUPActionRefuse:
|
||||
return "up主拒绝"
|
||||
case MCNUPActionPass:
|
||||
return "审核通过"
|
||||
case MCNUPActionFreeze:
|
||||
return "up主申请冻结"
|
||||
case MCNUPActionRelease:
|
||||
return "up主和mcn相互解约"
|
||||
case MCNUPActionRestore:
|
||||
return "恢复up主和mcn的合同"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// NotRightAction .
|
||||
func (action MCNUPAction) NotRightAction() bool {
|
||||
return action == MCNUPActionReject || action == MCNUPActionPass
|
||||
}
|
||||
|
||||
// NoRejectState .
|
||||
func (action MCNUPAction) NoRejectState() bool {
|
||||
return action != MCNUPActionReject
|
||||
}
|
||||
|
||||
// NotRightState .
|
||||
func (state MCNUPState) NotRightState() bool {
|
||||
return state == MCNUPStateOnReject || state == MCNUPStateOnSign
|
||||
}
|
||||
|
||||
// IsOnReviewState .
|
||||
func (state MCNUPState) IsOnReviewState() bool {
|
||||
return state != MCNUPStateOnReview
|
||||
}
|
||||
|
||||
// MCNSignCycleAction .
|
||||
type MCNSignCycleAction int8
|
||||
|
||||
// const .
|
||||
const (
|
||||
// MCNSignCycleActionUp 变更
|
||||
MCNSignCycleActionUp MCNSignCycleAction = iota
|
||||
// MCNSignCycleActionAdd 新增
|
||||
MCNSignCycleActionAdd
|
||||
// MCNSignCycleActionDel 删除
|
||||
MCNSignCycleActionDel
|
||||
)
|
||||
|
||||
func (act MCNSignCycleAction) String() string {
|
||||
switch act {
|
||||
case MCNSignCycleActionUp:
|
||||
return "变更"
|
||||
case MCNSignCycleActionAdd:
|
||||
return "新增"
|
||||
case MCNSignCycleActionDel:
|
||||
return "删除"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// MCNPayState .
|
||||
type MCNPayState int8
|
||||
|
||||
// const .
|
||||
const (
|
||||
// MCNPayNo 未支付
|
||||
MCNPayNo MCNPayState = 0
|
||||
// MCNPayed 已支付
|
||||
MCNPayed MCNPayState = 1
|
||||
// MCNPayDel 已删除
|
||||
MCNPayDel MCNPayState = 100
|
||||
)
|
||||
|
||||
func (mps MCNPayState) String() string {
|
||||
switch mps {
|
||||
case MCNPayNo:
|
||||
return "未支付"
|
||||
case MCNPayed:
|
||||
return "已支付"
|
||||
case MCNPayDel:
|
||||
return "已删除"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// MCNUPRecommendState .
|
||||
type MCNUPRecommendState int8
|
||||
|
||||
// const .
|
||||
const (
|
||||
// MCNUPRecommendStateUnKnown 未知状态
|
||||
MCNUPRecommendStateUnKnown MCNUPRecommendState = 0
|
||||
// MCNUPRecommendStateOff 未推荐
|
||||
MCNUPRecommendStateOff MCNUPRecommendState = 1
|
||||
// MCNUPRecommendStateOn 推荐中
|
||||
MCNUPRecommendStateOn MCNUPRecommendState = 2
|
||||
// MCNUPRecommendStateBan 禁止推荐
|
||||
MCNUPRecommendStateBan MCNUPRecommendState = 3
|
||||
// MCNUPRecommendStateDel 移除中
|
||||
MCNUPRecommendStateDel MCNUPRecommendState = 100
|
||||
)
|
||||
|
||||
func (state MCNUPRecommendState) String() string {
|
||||
switch state {
|
||||
case MCNUPRecommendStateOff:
|
||||
return "未推荐"
|
||||
case MCNUPRecommendStateOn:
|
||||
return "推荐中"
|
||||
case MCNUPRecommendStateBan:
|
||||
return "禁止推荐"
|
||||
case MCNUPRecommendStateDel:
|
||||
return "移除中"
|
||||
default:
|
||||
return "未知状态"
|
||||
}
|
||||
}
|
||||
|
||||
// MCNUPRecommendSource .
|
||||
type MCNUPRecommendSource int8
|
||||
|
||||
// const .
|
||||
const (
|
||||
// MCNUPRecommendSourceUnKnown 未知来源
|
||||
MCNUPRecommendSourceUnKnown MCNUPRecommendSource = iota
|
||||
// MCNUPRecommendSourceAuto 自动添加(大数据)
|
||||
MCNUPRecommendSourceAuto
|
||||
// MCNUPRecommendStateManual 手动添加
|
||||
MCNUPRecommendStateManual
|
||||
)
|
||||
|
||||
func (source MCNUPRecommendSource) String() string {
|
||||
switch source {
|
||||
case MCNUPRecommendSourceAuto:
|
||||
return "自动添加(大数据)"
|
||||
case MCNUPRecommendStateManual:
|
||||
return "手动添加"
|
||||
default:
|
||||
return "未知来源"
|
||||
}
|
||||
}
|
||||
|
||||
// MCNUPRecommendAction .
|
||||
type MCNUPRecommendAction int8
|
||||
|
||||
// const .
|
||||
const (
|
||||
// MCNUPRecommendActionOn 推荐
|
||||
MCNUPRecommendActionOn MCNUPRecommendAction = iota + 1
|
||||
// MCNUPRecommendActionBan 禁止推荐
|
||||
MCNUPRecommendActionBan
|
||||
// MCNUPRecommendActionRestore 恢复
|
||||
MCNUPRecommendActionRestore
|
||||
// MCNUPRecommendActionAdd 手动添加
|
||||
MCNUPRecommendActionAdd
|
||||
// MCNUPRecommendActionDel 移除
|
||||
MCNUPRecommendActionDel
|
||||
)
|
||||
|
||||
// GetState .
|
||||
func (action MCNUPRecommendAction) GetState() MCNUPRecommendState {
|
||||
switch action {
|
||||
// MCNUPRecommendActionOn 推荐
|
||||
case MCNUPRecommendActionOn:
|
||||
return MCNUPRecommendStateOn
|
||||
// MCNUPRecommendActionBan 禁止推荐
|
||||
case MCNUPRecommendActionBan:
|
||||
return MCNUPRecommendStateBan
|
||||
// MCNUPRecommendActionRestore 恢复
|
||||
case MCNUPRecommendActionRestore:
|
||||
return MCNUPRecommendStateOff
|
||||
// MCNUPRecommendActionAdd 手动添加
|
||||
case MCNUPRecommendActionAdd:
|
||||
return MCNUPRecommendStateOff
|
||||
// MCNUPRecommendActionDel 移除
|
||||
case MCNUPRecommendActionDel:
|
||||
return MCNUPRecommendStateDel
|
||||
}
|
||||
return MCNUPRecommendStateUnKnown
|
||||
}
|
||||
|
||||
func (action MCNUPRecommendAction) String() string {
|
||||
switch action {
|
||||
case MCNUPRecommendActionOn:
|
||||
return "推荐"
|
||||
case MCNUPRecommendActionBan:
|
||||
return "禁止推荐"
|
||||
case MCNUPRecommendActionRestore:
|
||||
return "恢复"
|
||||
case MCNUPRecommendActionAdd:
|
||||
return "手动添加"
|
||||
case MCNUPRecommendActionDel:
|
||||
return "移除"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// MCNUPPermissionState .
|
||||
type MCNUPPermissionState int8
|
||||
|
||||
// const .
|
||||
const (
|
||||
// MCNUPPermissionStateUnKnown 未知状态
|
||||
MCNUPPermissionStateUnKnown MCNUPPermissionState = -1
|
||||
// MCNUPPermissionStateNoAuthorize 待Up主同意
|
||||
MCNUPPermissionStateNoAuthorize MCNUPPermissionState = 0
|
||||
// MCNUPStateOnRefuse Up主拒绝
|
||||
MCNUPPermissionStateOnRefuse MCNUPPermissionState = 1
|
||||
// MCNUPPermissionStateReview 待审中
|
||||
MCNUPPermissionStateReview MCNUPPermissionState = 2
|
||||
// MCNUPPermissionStatePass 已通过
|
||||
MCNUPPermissionStatePass MCNUPPermissionState = 3
|
||||
// MCNUPPermissionStateFail 已驳回
|
||||
MCNUPPermissionStateFail MCNUPPermissionState = 4
|
||||
// MCNUPPermissionStateDel 已删除
|
||||
MCNUPPermissionStateDel MCNUPPermissionState = 100
|
||||
)
|
||||
|
||||
func (state MCNUPPermissionState) String() string {
|
||||
switch state {
|
||||
case MCNUPPermissionStateNoAuthorize:
|
||||
return "待Up主同意"
|
||||
case MCNUPPermissionStateOnRefuse:
|
||||
return "Up主拒绝"
|
||||
case MCNUPPermissionStateReview:
|
||||
return "待审中"
|
||||
case MCNUPPermissionStatePass:
|
||||
return "已通过"
|
||||
case MCNUPPermissionStateFail:
|
||||
return "已驳回"
|
||||
case MCNUPPermissionStateDel:
|
||||
return "已删除"
|
||||
default:
|
||||
return "未知状态"
|
||||
}
|
||||
}
|
||||
|
||||
// MCNUPPermissionAction .
|
||||
type MCNUPPermissionAction int8
|
||||
|
||||
// const .
|
||||
const (
|
||||
// MCNUPPermissionActionOn 通过
|
||||
MCNUPPermissionActionOn MCNUPPermissionAction = iota + 1
|
||||
// MCNUPPermissionActionFail 驳回
|
||||
MCNUPPermissionActionFail
|
||||
// MCNUPPermissionActionDel 移除
|
||||
MCNUPPermissionActionDel
|
||||
)
|
||||
|
||||
// NotRightAction .
|
||||
func (action MCNUPPermissionAction) NotRightAction() bool {
|
||||
return action == MCNUPPermissionActionOn || action == MCNUPPermissionActionFail
|
||||
}
|
||||
|
||||
// GetState .
|
||||
func (action MCNUPPermissionAction) GetState() MCNUPPermissionState {
|
||||
switch action {
|
||||
// MCNUPPermissionActionOn 通过
|
||||
case MCNUPPermissionActionOn:
|
||||
return MCNUPPermissionStatePass
|
||||
// MCNUPPermissionActionFail 驳回
|
||||
case MCNUPPermissionActionFail:
|
||||
return MCNUPPermissionStateFail
|
||||
// MCNUPPermissionActionDel 移除
|
||||
case MCNUPPermissionActionDel:
|
||||
return MCNUPPermissionStateDel
|
||||
}
|
||||
return MCNUPPermissionStateUnKnown
|
||||
}
|
||||
|
||||
func (action MCNUPPermissionAction) String() string {
|
||||
switch action {
|
||||
case MCNUPPermissionActionOn:
|
||||
return "通过"
|
||||
case MCNUPPermissionActionFail:
|
||||
return "驳回"
|
||||
case MCNUPPermissionActionDel:
|
||||
return "移除"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// AttrBasePermit .
|
||||
type AttrBasePermit uint
|
||||
|
||||
// const .
|
||||
const (
|
||||
AttrBasePermitBit AttrBasePermit = 0 // 基础权限
|
||||
AttrDataPermitBit AttrBasePermit = 1 // 数据权限
|
||||
AttrRecPermitBit AttrBasePermit = 2 // 推荐权限
|
||||
AttrDepartPermitBit AttrBasePermit = 3 // 起飞权限
|
||||
)
|
||||
|
||||
// PermitMap .
|
||||
var PermitMap = map[AttrBasePermit]struct{}{
|
||||
AttrBasePermitBit: {},
|
||||
AttrDataPermitBit: {},
|
||||
AttrRecPermitBit: {},
|
||||
AttrDepartPermitBit: {},
|
||||
}
|
||||
|
||||
func (p AttrBasePermit) String() string {
|
||||
switch p {
|
||||
case AttrBasePermitBit:
|
||||
return "基础权限"
|
||||
case AttrDataPermitBit:
|
||||
return "数据权限"
|
||||
case AttrRecPermitBit:
|
||||
return "推荐权限"
|
||||
case AttrDepartPermitBit:
|
||||
return "起飞权限"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
82
app/admin/main/mcn/model/mcn_pay.go
Normal file
82
app/admin/main/mcn/model/mcn_pay.go
Normal file
@ -0,0 +1,82 @@
|
||||
package model
|
||||
|
||||
import xtime "go-common/library/time"
|
||||
|
||||
// MCNSignPay State .
|
||||
const (
|
||||
MCNStateNoPay = int8(1)
|
||||
MCNStatePayed = int8(2)
|
||||
MCNStateDeled = int8(100)
|
||||
)
|
||||
|
||||
// MCNSign struct .
|
||||
type MCNSign struct {
|
||||
ID int64 `json:"id"`
|
||||
MCNMID int64 `json:"mcn_mid"`
|
||||
MCNName string `json:"mcn_name"`
|
||||
CompanyName string `json:"company_name"`
|
||||
CompanyLicenseID string `json:"company_license_id"`
|
||||
CompanyLicenseLink string `json:"company_license_link"`
|
||||
ContractLink string `json:"contract_link"`
|
||||
ContactName string `json:"contact_name"`
|
||||
ContactTitle string `json:"contact_title"`
|
||||
ContactIdcard string `json:"contact_idcard"`
|
||||
ContactPhone string `json:"contact_phone"`
|
||||
BeginDate xtime.Time `json:"begin_date"`
|
||||
EndDate xtime.Time `json:"end_date"`
|
||||
State MCNSignState `json:"state"`
|
||||
RejectTime xtime.Time `json:"reject_time"`
|
||||
RejectReason string `json:"reject_reason"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
Permission uint32 `json:"permission"`
|
||||
Permits *Permits `json:"permits"` // 权限集合
|
||||
}
|
||||
|
||||
// AttrPermitVal get Permission all.
|
||||
func (n *MCNSign) AttrPermitVal() {
|
||||
n.Permits = &Permits{}
|
||||
n.Permits.SetAttrPermitVal(n.Permission)
|
||||
}
|
||||
|
||||
// MCNSignPay struct .
|
||||
type MCNSignPay struct {
|
||||
ID int64 `json:"id"`
|
||||
MID int64 `json:"mid"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
DueDate string `json:"due_date"`
|
||||
PayValue int64 `json:"pay_value"`
|
||||
State int8 `json:"state"`
|
||||
Note string `json:"note"`
|
||||
Ctime string `json:"ctime"`
|
||||
Mtime string `json:"mtime"`
|
||||
}
|
||||
|
||||
// MCNUP struct .
|
||||
type MCNUP struct {
|
||||
SignID int64 `json:"sign_id"`
|
||||
MCNMID int64 `json:"mcn_mid"`
|
||||
UPMID int64 `json:"up_mid"`
|
||||
BeginDate xtime.Time `json:"begin_date"`
|
||||
EndDate xtime.Time `json:"end_date"`
|
||||
ContractLink string `json:"contract_link"`
|
||||
UPAuthLink string `json:"up_auth_link"`
|
||||
RejectReason string `json:"reject_reason"`
|
||||
RejectTime xtime.Time `json:"reject_time"`
|
||||
State MCNUPState `json:"state"`
|
||||
StateChangeTime xtime.Time `json:"state_change_time"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
UpType int8 `json:"up_type"`
|
||||
SiteLink string `json:"site_link"`
|
||||
ConfirmTime xtime.Time `json:"confirm_time"`
|
||||
Permission uint32 `json:"permission"`
|
||||
PublicationPrice int64 `json:"publication_price"`
|
||||
Permits *Permits `json:"permits"` // 权限集合
|
||||
}
|
||||
|
||||
// AttrPermitVal get Permission all.
|
||||
func (n *MCNUP) AttrPermitVal() {
|
||||
n.Permits = &Permits{}
|
||||
n.Permits.SetAttrPermitVal(n.Permission)
|
||||
}
|
133
app/admin/main/mcn/model/msg.go
Normal file
133
app/admin/main/mcn/model/msg.go
Normal file
@ -0,0 +1,133 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// MSGType .
|
||||
type MSGType uint8
|
||||
|
||||
// const .
|
||||
const (
|
||||
// McnSignApplyPass MCN申请MCN管理入口申请成功
|
||||
McnSignApplyPass = iota + 1
|
||||
// McnSignNoApplyPass MCN申请MCN管理入口申请未通过
|
||||
McnSignNoApplyPass
|
||||
// McnUpBindAuthApply MCN申请和up主绑定申请授权
|
||||
McnUpBindAuthApply
|
||||
// McnUpBindAuthReview MCN申请和up主绑定up主同意等待运营审核中
|
||||
McnUpBindAuthReview
|
||||
// McnUpBindAuthApplyPass MCN申请和up主绑定up主同意且运营通过
|
||||
McnUpBindAuthApplyPass
|
||||
// UpMcnBindAuthApplyPass up主申请和MCN绑定up主同意且运营通过
|
||||
UpMcnBindAuthApplyPass
|
||||
// McnUpBindAuthApplyNoPass MCN申请和up主绑定up主同意但运营未通过
|
||||
McnUpBindAuthApplyNoPass
|
||||
// UpMcnBindAuthApplyNoPass up主申请和MCN绑定up主同意但运营未通过
|
||||
UpMcnBindAuthApplyNoPass
|
||||
// McnUpBindAuthApplyRefuse MCN申请和up主绑定被up主拒绝
|
||||
McnUpBindAuthApplyRefuse
|
||||
// UpMcnRelationFreeze MCN和up主纠纷处理 - Up主和MCN关系冻结
|
||||
UpMcnRelationFreeze
|
||||
// McnUpRelationFreeze MCN和up主纠纷处理 - MCN和Up主关系冻结
|
||||
McnUpRelationFreeze
|
||||
// UpMcnRelationRelease MCN和up主纠纷处理 - Up主和MCN提前解约
|
||||
UpMcnRelationRelease
|
||||
// McnUpRelationRelease MCN和up主纠纷处理 - MCN和Up主提前解约
|
||||
McnUpRelationRelease
|
||||
// McnBackstageBlock MCN违规账号封禁
|
||||
McnBackstageBlock
|
||||
// McnBackstageClose MCN违规账号清退
|
||||
McnBackstageClose
|
||||
// McnRenewcontract 续约合同
|
||||
McnRenewcontract
|
||||
// McnAccountRestore MCN账号恢复
|
||||
McnAccountRestore
|
||||
// McnPermissionOpen MCN新开权限
|
||||
McnPermissionOpen
|
||||
// McnPermissionClosed MCN权限关闭
|
||||
McnPermissionClosed
|
||||
// McnUpNotAgreeChangePermit UP主不同意授权变更
|
||||
McnUpNotAgreeChangePermit
|
||||
// McnOperNotAgreeChangePermit 运营不同意授权变更
|
||||
McnOperNotAgreeChangePermit
|
||||
// McnOperAgreeChangePermit 运营同意授权变更
|
||||
McnOperAgreeChangePermit
|
||||
// McnApplyUpChangePermit MCN申请和up主的权限修改
|
||||
McnApplyUpChangePermit
|
||||
)
|
||||
|
||||
// MSG .
|
||||
type MSG struct {
|
||||
MSGType MSGType
|
||||
Code string
|
||||
Title string
|
||||
Content string
|
||||
}
|
||||
|
||||
// ArgMsg .
|
||||
type ArgMsg struct {
|
||||
MSGType MSGType
|
||||
MIDs []int64
|
||||
McnName string
|
||||
UpName string
|
||||
McnMid int64
|
||||
UpMid int64
|
||||
CompanyName string
|
||||
Reason string
|
||||
SignUpID int64
|
||||
Permission string
|
||||
}
|
||||
|
||||
// MsgInfo .
|
||||
func (arg *ArgMsg) MsgInfo(msg *MSG) (mids []int64, title, content, code string) {
|
||||
switch arg.MSGType {
|
||||
case McnSignApplyPass:
|
||||
return arg.MIDs, msg.Title, msg.Content, msg.Code
|
||||
case McnSignNoApplyPass:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.Reason), msg.Code
|
||||
case McnUpBindAuthApply:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.McnName, arg.McnMid, arg.CompanyName, arg.SignUpID), msg.Code
|
||||
case McnUpBindAuthReview:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.CompanyName, arg.McnName, arg.McnMid), msg.Code
|
||||
case McnUpBindAuthApplyPass:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.UpName, arg.UpMid), msg.Code
|
||||
case UpMcnBindAuthApplyPass:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.CompanyName, arg.McnName, arg.McnMid), msg.Code
|
||||
case McnUpBindAuthApplyNoPass:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.UpName, arg.UpMid, arg.Reason), msg.Code
|
||||
case UpMcnBindAuthApplyNoPass:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.CompanyName, arg.McnName, arg.McnMid, arg.Reason), msg.Code
|
||||
case McnUpBindAuthApplyRefuse:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.UpName, arg.UpMid), msg.Code
|
||||
case UpMcnRelationFreeze:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.CompanyName, arg.McnName, arg.McnMid), msg.Code
|
||||
case McnUpRelationFreeze:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.UpName, arg.UpMid), msg.Code
|
||||
case UpMcnRelationRelease:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.CompanyName, arg.McnName, arg.McnMid), msg.Code
|
||||
case McnUpRelationRelease:
|
||||
return arg.MIDs, msg.Title, fmt.Sprintf(msg.Content, arg.UpName, arg.UpMid), msg.Code
|
||||
case McnBackstageBlock:
|
||||
return arg.MIDs, msg.Title, msg.Content, msg.Code
|
||||
case McnBackstageClose:
|
||||
return arg.MIDs, msg.Title, msg.Content, msg.Code
|
||||
case McnRenewcontract:
|
||||
return arg.MIDs, msg.Title, msg.Content, msg.Code
|
||||
case McnAccountRestore:
|
||||
return arg.MIDs, msg.Title, msg.Content, msg.Code
|
||||
case McnPermissionOpen:
|
||||
return arg.MIDs, fmt.Sprintf(msg.Title, arg.Permission), fmt.Sprintf(msg.Content, arg.Permission), msg.Code
|
||||
case McnPermissionClosed:
|
||||
return arg.MIDs, fmt.Sprintf(msg.Title, arg.Permission), fmt.Sprintf(msg.Content, arg.Permission), msg.Code
|
||||
case McnUpNotAgreeChangePermit:
|
||||
return arg.MIDs, fmt.Sprintf(msg.Title, arg.UpName), fmt.Sprintf(msg.Content, arg.UpName), msg.Code
|
||||
case McnOperNotAgreeChangePermit:
|
||||
return arg.MIDs, fmt.Sprintf(msg.Title, arg.UpName), fmt.Sprintf(msg.Content, arg.UpName, arg.Reason), msg.Code
|
||||
case McnOperAgreeChangePermit:
|
||||
return arg.MIDs, fmt.Sprintf(msg.Title, arg.UpName), fmt.Sprintf(msg.Content, arg.UpName, arg.Permission), msg.Code
|
||||
case McnApplyUpChangePermit:
|
||||
return arg.MIDs, fmt.Sprintf(msg.Title, arg.McnName), fmt.Sprintf(msg.Content, arg.McnName, arg.Permission, arg.SignUpID), msg.Code
|
||||
}
|
||||
return nil, "", "", ""
|
||||
}
|
539
app/admin/main/mcn/model/reply.go
Normal file
539
app/admin/main/mcn/model/reply.go
Normal file
@ -0,0 +1,539 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
dtmdl "go-common/app/interface/main/mcn/model/datamodel"
|
||||
xtime "go-common/library/time"
|
||||
)
|
||||
|
||||
// Permits .
|
||||
type Permits struct {
|
||||
BasePermission uint8 `form:"base_permission" json:"base_permission" validate:"min=0,max=1"` // 基础权限
|
||||
DataPermission uint8 `form:"data_permission" json:"data_permission" validate:"min=0,max=1"` // 数据权限
|
||||
RecPermission uint8 `form:"rec_permission" json:"rec_permission" validate:"min=0,max=1"` // 推荐权限
|
||||
DepartPermission uint8 `form:"depart_permission" json:"depart_permission" validate:"min=0,max=1"` // 起飞权限
|
||||
}
|
||||
|
||||
// SetAttrPermitVal set struct from permission
|
||||
func (p *Permits) SetAttrPermitVal(val uint32) {
|
||||
p.BasePermission = AttrVal(val, uint(AttrBasePermitBit))
|
||||
p.DataPermission = AttrVal(val, uint(AttrDataPermitBit))
|
||||
p.RecPermission = AttrVal(val, uint(AttrRecPermitBit))
|
||||
p.DepartPermission = AttrVal(val, uint(AttrDepartPermitBit))
|
||||
}
|
||||
|
||||
// GetAttrPermitVal .
|
||||
func (p *Permits) GetAttrPermitVal() (permission uint32) {
|
||||
permission = AttrSet(permission, p.BasePermission, uint(AttrBasePermitBit))
|
||||
permission = AttrSet(permission, p.DataPermission, uint(AttrDataPermitBit))
|
||||
permission = AttrSet(permission, p.RecPermission, uint(AttrRecPermitBit))
|
||||
permission = AttrSet(permission, p.DepartPermission, uint(AttrDepartPermitBit))
|
||||
return
|
||||
}
|
||||
|
||||
// AttrSet set Permission.
|
||||
func AttrSet(dest uint32, bitValue uint8, bit uint) (res uint32) {
|
||||
res = dest&(^(1 << bit)) | (uint32(bitValue) << bit)
|
||||
return
|
||||
}
|
||||
|
||||
// AttrVal get Permission.
|
||||
func AttrVal(v uint32, bit uint) uint8 {
|
||||
return uint8((v >> bit) & 1)
|
||||
}
|
||||
|
||||
// MCNSignInfoReply .
|
||||
type MCNSignInfoReply struct {
|
||||
SignID int64 `json:"sign_id"`
|
||||
McnMid int64 `json:"mcn_mid"`
|
||||
McnName string `json:"mcn_name"`
|
||||
CompanyName string `json:"company_name"`
|
||||
CompanyLicenseID string `json:"company_license_id"`
|
||||
CompanyLicenseLink string `json:"company_license_link"`
|
||||
ContractLink string `json:"contract_link"`
|
||||
ContactName string `json:"contact_name"`
|
||||
ContactTitle string `json:"contact_title"`
|
||||
ContactPhone string `json:"contact_phone"`
|
||||
ContactIdcard string `json:"contact_idcard"`
|
||||
BeginDate xtime.Time `json:"begin_date"`
|
||||
EndDate xtime.Time `json:"end_date"`
|
||||
State MCNSignState `json:"state"`
|
||||
RejectTime xtime.Time `json:"reject_time"`
|
||||
RejectReason string `json:"reject_reason"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
SignPayInfo []*SignPayInfoReply `json:"sign_pay_info"`
|
||||
Permission uint32 `json:"permission"`
|
||||
Permits *Permits `json:"permits"` // 权限集合
|
||||
}
|
||||
|
||||
// AttrPermitVal get Permission all.
|
||||
func (n *MCNSignInfoReply) AttrPermitVal() {
|
||||
n.Permits = &Permits{}
|
||||
n.Permits.SetAttrPermitVal(n.Permission)
|
||||
}
|
||||
|
||||
// MCNSignListReply .
|
||||
type MCNSignListReply struct {
|
||||
List []*MCNSignInfoReply `json:"result"`
|
||||
PageResult
|
||||
}
|
||||
|
||||
// SignPayInfoReply .
|
||||
type SignPayInfoReply struct {
|
||||
SignPayID int64 `json:"sign_pay_id,omitempty"`
|
||||
McnMid int64 `json:"mcn_mid"`
|
||||
SignID int64 `json:"sign_id,omitempty"`
|
||||
State MCNPayState `json:"state"`
|
||||
DueDate xtime.Time `json:"due_date"`
|
||||
PayValue int64 `json:"pay_value"` // thousand bit
|
||||
}
|
||||
|
||||
// MCNUPInfoReply .
|
||||
type MCNUPInfoReply struct {
|
||||
SignUpID int64 `json:"sign_up_id"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
McnMid int64 `json:"mcn_mid"`
|
||||
UpMid int64 `json:"up_mid"`
|
||||
BeginDate xtime.Time `json:"begin_date"`
|
||||
EndDate xtime.Time `json:"end_date"`
|
||||
ContractLink string `json:"contract_link"`
|
||||
UpAuthLink string `json:"up_auth_link"`
|
||||
RejectTime xtime.Time `json:"reject_time"`
|
||||
RejectReason string `json:"reject_reason"`
|
||||
State MCNUPState `json:"state"`
|
||||
StateChangeTime xtime.Time `json:"state_change_time"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
UpName string `json:"up_name"`
|
||||
McnName string `json:"mcn_name"`
|
||||
ActiveTid int16 `json:"active_tid"`
|
||||
TpName string `json:"type_name"`
|
||||
FansCount int64 `json:"fans_count"`
|
||||
FansCountActive int64 `json:"fans_count_active"`
|
||||
FansIncreaseAccumulate int64 `json:"fans_increase_accumulate"`
|
||||
ArchiveCount int64 `json:"archive_count"`
|
||||
PlayCount int64 `json:"play_count"`
|
||||
UPType int8 `json:"up_type"`
|
||||
SiteLink string `json:"site_link"`
|
||||
ConfirmTime xtime.Time `json:"confirm_time"`
|
||||
PubPrice int64 `json:"publication_price"`
|
||||
Permission uint32 `json:"permission"`
|
||||
Permits *Permits `json:"permits"` // 权限集合
|
||||
}
|
||||
|
||||
// AttrPermitVal get Permission all.
|
||||
func (n *MCNUPInfoReply) AttrPermitVal() {
|
||||
n.Permits = &Permits{}
|
||||
n.Permits.SetAttrPermitVal(n.Permission)
|
||||
}
|
||||
|
||||
// MCNUPReviewListReply .
|
||||
type MCNUPReviewListReply struct {
|
||||
List []*MCNUPInfoReply `json:"result"`
|
||||
PageResult
|
||||
}
|
||||
|
||||
// UpBaseInfo .
|
||||
type UpBaseInfo struct {
|
||||
Mid int64 `json:"mid"`
|
||||
FansCount int64 `json:"fans_count"`
|
||||
ActiveTid int16 `json:"active_tid"`
|
||||
ArticleCountAccumulate int64 `json:"article_count_accumulate"`
|
||||
}
|
||||
|
||||
// UpPlayInfo .
|
||||
type UpPlayInfo struct {
|
||||
Mid int64 `json:"mid"`
|
||||
ArticleCount int64 `json:"article_count"`
|
||||
PlayCountAccumulate int64 `json:"play_count_accumulate"`
|
||||
PlayCountAverage int64 `json:"play_count_average"`
|
||||
}
|
||||
|
||||
// MCNListReply struct .
|
||||
type MCNListReply struct {
|
||||
List []*MCNListOne `json:"result"`
|
||||
PageResult
|
||||
}
|
||||
|
||||
// MCNListOne struct .
|
||||
type MCNListOne struct {
|
||||
ID int64 `json:"id"`
|
||||
MCNMID int64 `json:"mcn_mid"`
|
||||
MCNName string `json:"mcn_name"`
|
||||
UPCount int64 `json:"up_count"`
|
||||
FansCountAccumulate int64 `json:"fans_count_accumulate"`
|
||||
FansCountOnlineAccumulate int64 `json:"fans_count_online_accumulate"`
|
||||
FansCountRealAccumulate int64 `json:"fans_count_real_accumulate"`
|
||||
FansCountCheatAccumulate int64 `json:"fans_count_cheat_accumulate"`
|
||||
GenerateDate xtime.Time `json:"generate_date"`
|
||||
BeginDate xtime.Time `json:"begin_date"`
|
||||
EndDate xtime.Time `json:"end_date"`
|
||||
State MCNSignState `json:"state"`
|
||||
PayInfos []*SignPayInfoReply `json:"pay_infos"`
|
||||
Permission uint32 `json:"permission"`
|
||||
Permits *Permits `json:"permits"` // 权限集合
|
||||
}
|
||||
|
||||
// AttrPermitVal get Permission all.
|
||||
func (n *MCNListOne) AttrPermitVal() {
|
||||
n.Permits = &Permits{}
|
||||
n.Permits.SetAttrPermitVal(n.Permission)
|
||||
}
|
||||
|
||||
// MCNInfoReply struct .
|
||||
type MCNInfoReply struct {
|
||||
MCNSign
|
||||
UPCount int64 `json:"up_count"`
|
||||
ArchiveCountAccumulate int64 `json:"archive_count_accumulate"`
|
||||
PlayCountAccumulate int64 `json:"play_count_accumulate"`
|
||||
FansCountAccumulate int64 `json:"fans_count_accumulate"`
|
||||
FansCountOnline int64 `json:"fans_count_online"`
|
||||
FansCountReal int64 `json:"fans_count_real"`
|
||||
FansCountCheat int64 `json:"fans_count_cheat"`
|
||||
FansCountRealAccumulate int64 `json:"fans_count_real_accumulate"`
|
||||
FansCountOnlineAccumulate int64 `json:"fans_count_online_accumulate"`
|
||||
}
|
||||
|
||||
// MCNUPListReply struct .
|
||||
type MCNUPListReply struct {
|
||||
List []*MCNUPInfoReply `json:"result"`
|
||||
PageResult
|
||||
}
|
||||
|
||||
// MCNCheatReply struct .
|
||||
type MCNCheatReply struct {
|
||||
SignID int64 `json:"sign_id"`
|
||||
MCNMID int64 `json:"mcn_mid"`
|
||||
MCNName string `json:"mcn_name"`
|
||||
UpMID int64 `json:"up_mid"`
|
||||
UpName string `json:"up_name"`
|
||||
FansCountCheatAccumulate int64 `json:"fans_count_cheat_accumulate"`
|
||||
FansCountCheatIncreaseDay int64 `json:"fans_count_cheat_increase_day"`
|
||||
FansCountReal int64 `json:"fans_count_real"`
|
||||
FansCountCheatCleanedAccumulate int64 `json:"fans_count_cheat_cleaned_accumulate"`
|
||||
}
|
||||
|
||||
// MCNCheatListReply struct.
|
||||
type MCNCheatListReply struct {
|
||||
List []*MCNCheatReply `json:"result"`
|
||||
PageResult
|
||||
}
|
||||
|
||||
// MCNCheatUPReply struct .
|
||||
type MCNCheatUPReply struct {
|
||||
GenerateDate xtime.Time `json:"generate_date"`
|
||||
FansCountCheatIncreaseDay int64 `json:"fans_count_cheat_increase_day"`
|
||||
MCNMID int64 `json:"mcn_mid"`
|
||||
MCNName string `json:"mcn_name"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
FansCountCheatAccumulate int64 `json:"fans_count_cheat_accumulate"`
|
||||
FansCountCheatCleanedAccumulate int64 `json:"fans_count_cheat_cleaned_accumulate"`
|
||||
FansCountReal int64 `json:"fans_count_real"`
|
||||
}
|
||||
|
||||
// MCNCheatUPListReply struct .
|
||||
type MCNCheatUPListReply struct {
|
||||
List []*MCNCheatUPReply `json:"result"`
|
||||
PageResult
|
||||
}
|
||||
|
||||
// MCNImportUPInfoReply struct .
|
||||
type MCNImportUPInfoReply struct {
|
||||
ID int64 `json:"id"`
|
||||
MCNMID int64 `json:"mcn_mid"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
UpMID int64 `json:"up_mid"`
|
||||
UpName string `json:"up_name"`
|
||||
StandardFansDate int64 `json:"standard_fans_date"`
|
||||
StandardArchiveCount int64 `json:"standard_archive_count"`
|
||||
StandardFansCount int64 `json:"standard_fans_count"`
|
||||
IsReward int8 `json:"is_reward"`
|
||||
JoinTime int32 `json:"join_time"`
|
||||
}
|
||||
|
||||
// MCNIncreaseReply struct .
|
||||
type MCNIncreaseReply struct {
|
||||
ID int64 `json:"id"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
DataType int8 `json:"data_type"`
|
||||
ActiveTID int64 `json:"active_tid"`
|
||||
GenerateDate xtime.Time `json:"generate_date"`
|
||||
UPCount int64 `json:"up_count"`
|
||||
FansCountOnlineAccumulate int64 `json:"fans_count_online_accumulate"`
|
||||
FansCountRealAccumulate int64 `json:"fans_count_real_accumulate"`
|
||||
FansCountCheatAccumulate int64 `json:"fans_count_cheat_accumulate"`
|
||||
FansCountIncreaseDay int64 `json:"fans_count_increase_day"`
|
||||
ArchiveCountAccumulate int64 `json:"archive_count_accumulate"`
|
||||
ArchiveCountDay int64 `json:"archive_count_day"`
|
||||
PlayCountAccumulate int64 `json:"play_count_accumulate"`
|
||||
PlayCountIncreaseDay int64 `json:"play_count_increase_day"`
|
||||
FansCountAccumulate int64 `json:"fans_count_accumulate"`
|
||||
}
|
||||
|
||||
// MCNIncreaseListReply struct .
|
||||
type MCNIncreaseListReply struct {
|
||||
List []*MCNIncreaseReply `json:"result"`
|
||||
PageResult
|
||||
}
|
||||
|
||||
//GetFileName get file name
|
||||
func (q *MCNListReply) GetFileName() string {
|
||||
return fmt.Sprintf("%s_%s.csv", "MCN列表", time.Now().Format(dateTimeFmt))
|
||||
}
|
||||
|
||||
//ToCsv to buffer
|
||||
func (q *MCNListReply) ToCsv(writer *csv.Writer) {
|
||||
var title = []string{
|
||||
"ID",
|
||||
"MCN_ID",
|
||||
"MCN_昵称",
|
||||
"签约UP主数",
|
||||
"累计粉丝数",
|
||||
"累计线上涨粉数",
|
||||
"累计实际粉丝数",
|
||||
"累计作弊粉丝数",
|
||||
"签约周期",
|
||||
"付款周期",
|
||||
"账号状态",
|
||||
}
|
||||
writer.Write(title)
|
||||
if q == nil {
|
||||
return
|
||||
}
|
||||
for _, v := range q.List {
|
||||
var record []string
|
||||
var payString string
|
||||
if len(v.PayInfos) > 0 {
|
||||
for _, pv := range v.PayInfos {
|
||||
payString += fmt.Sprintf("%s-%d-%s ", pv.DueDate.Time().Format(TimeFormatDay), pv.PayValue/1000, pv.State.String())
|
||||
}
|
||||
}
|
||||
record = append(record,
|
||||
intFormat(v.ID),
|
||||
intFormat(v.MCNMID),
|
||||
v.MCNName,
|
||||
intFormat(v.UPCount),
|
||||
intFormat(v.FansCountAccumulate),
|
||||
intFormat(v.FansCountOnlineAccumulate),
|
||||
intFormat(v.FansCountRealAccumulate),
|
||||
intFormat(v.FansCountCheatAccumulate),
|
||||
fmt.Sprintf("%s-%s", v.BeginDate.Time().Format(TimeFormatDay), v.EndDate.Time().Format(TimeFormatDay)),
|
||||
payString,
|
||||
v.State.String(),
|
||||
)
|
||||
writer.Write(record)
|
||||
}
|
||||
}
|
||||
|
||||
//GetFileName get file name
|
||||
func (q *MCNUPListReply) GetFileName() string {
|
||||
return fmt.Sprintf("%s_%s.csv", "MCN UP主列表", time.Now().Format(dateTimeFmt))
|
||||
}
|
||||
|
||||
//ToCsv to buffer
|
||||
func (q *MCNUPListReply) ToCsv(writer *csv.Writer) {
|
||||
var title = []string{
|
||||
"ID",
|
||||
"UP主UID",
|
||||
"UP主昵称",
|
||||
"粉丝总量",
|
||||
"活跃粉丝量",
|
||||
"粉数增长量",
|
||||
"稿件量",
|
||||
"播放量",
|
||||
"分区",
|
||||
"账号状态",
|
||||
"签约周期",
|
||||
}
|
||||
writer.Write(title)
|
||||
if q == nil {
|
||||
return
|
||||
}
|
||||
for _, v := range q.List {
|
||||
var record []string
|
||||
record = append(record,
|
||||
intFormat(v.SignUpID),
|
||||
intFormat(v.UpMid),
|
||||
v.UpName,
|
||||
intFormat(v.FansCount),
|
||||
intFormat(v.FansCountActive),
|
||||
intFormat(v.FansIncreaseAccumulate),
|
||||
intFormat(v.ArchiveCount),
|
||||
intFormat(v.PlayCount),
|
||||
v.TpName,
|
||||
v.State.String(),
|
||||
fmt.Sprintf("%s-%s", v.BeginDate.Time().Format(TimeFormatDay), v.EndDate.Time().Format(TimeFormatDay)),
|
||||
)
|
||||
|
||||
writer.Write(record)
|
||||
}
|
||||
}
|
||||
|
||||
// McnUpRecommendPool .
|
||||
type McnUpRecommendPool struct {
|
||||
ID int64 `json:"id"`
|
||||
UpMid int64 `json:"up_mid"`
|
||||
UpName string `json:"up_name"`
|
||||
FansCount int64 `json:"fans_count"`
|
||||
FansCountIncreaseMonth int64 `json:"fans_count_increase_month"`
|
||||
ArchiveCount int64 `json:"archive_count"`
|
||||
PlayCountAccumulate int64 `json:"play_count_accumulate"`
|
||||
PlayCountAverage int64 `json:"play_count_average"`
|
||||
ActiveTid int16 `json:"active_tid"`
|
||||
TpName string `json:"type_name"`
|
||||
LastArchiveTime xtime.Time `json:"last_archive_time"`
|
||||
State MCNUPRecommendState `json:"state"`
|
||||
Source MCNUPRecommendSource `json:"source"`
|
||||
GenerateTime xtime.Time `json:"generate_time"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
}
|
||||
|
||||
// McnUpRecommendListReply struct .
|
||||
type McnUpRecommendListReply struct {
|
||||
List []*McnUpRecommendPool `json:"result"`
|
||||
PageResult
|
||||
}
|
||||
|
||||
//GetFileName get file name
|
||||
func (list *McnUpRecommendListReply) GetFileName() string {
|
||||
return fmt.Sprintf("%s_%s.csv", "MCN推荐池列表", time.Now().Format(dateTimeFmt))
|
||||
}
|
||||
|
||||
//ToCsv to buffer
|
||||
func (list *McnUpRecommendListReply) ToCsv(writer *csv.Writer) {
|
||||
var title = []string{
|
||||
"UP主UID",
|
||||
"up主昵称",
|
||||
"粉丝量",
|
||||
"本月粉丝增长量",
|
||||
"累积播放量",
|
||||
"稿均播放量",
|
||||
"分区",
|
||||
"最近投稿时间",
|
||||
"来源",
|
||||
"推荐池状态",
|
||||
"数据更新时间",
|
||||
}
|
||||
writer.Write(title)
|
||||
if list == nil {
|
||||
return
|
||||
}
|
||||
for _, v := range list.List {
|
||||
var record []string
|
||||
record = append(record,
|
||||
intFormat(v.UpMid),
|
||||
v.UpName,
|
||||
intFormat(v.FansCount),
|
||||
intFormat(v.FansCountIncreaseMonth),
|
||||
intFormat(v.PlayCountAccumulate),
|
||||
intFormat(v.PlayCountAverage),
|
||||
v.TpName,
|
||||
v.LastArchiveTime.Time().Format(TimeFormatSec),
|
||||
v.Source.String(),
|
||||
v.State.String(),
|
||||
v.GenerateTime.Time().Format(TimeFormatSec),
|
||||
)
|
||||
writer.Write(record)
|
||||
}
|
||||
}
|
||||
|
||||
// McnGetRankUpFansReply reply
|
||||
type McnGetRankUpFansReply struct {
|
||||
Result []*RankArchiveLikeInfo `json:"result"` // 按顺序进行排名
|
||||
TypeList []*TidnameInfo `json:"type_list"`
|
||||
}
|
||||
|
||||
// GetFileName get file name
|
||||
func (list *McnGetRankUpFansReply) GetFileName() string {
|
||||
return fmt.Sprintf("%s_%s.csv", "top稿件列表", time.Now().Format(dateTimeFmt))
|
||||
}
|
||||
|
||||
// ToCsv to buffer
|
||||
func (list *McnGetRankUpFansReply) ToCsv(writer *csv.Writer) {
|
||||
var title = []string{
|
||||
"稿件ID",
|
||||
"稿件标题",
|
||||
"UP主UID",
|
||||
"UP主昵称",
|
||||
"新增点赞数",
|
||||
"累积点赞数",
|
||||
"新增播放数",
|
||||
"累积播放数",
|
||||
"分区",
|
||||
"上传日期",
|
||||
}
|
||||
writer.Write(title)
|
||||
if list == nil {
|
||||
return
|
||||
}
|
||||
for _, v := range list.Result {
|
||||
var record []string
|
||||
record = append(record,
|
||||
intFormat(v.ArchiveID),
|
||||
v.ArchiveTitle,
|
||||
intFormat(v.Author.Mid),
|
||||
v.Author.Name,
|
||||
intFormat(v.LikesIncrease),
|
||||
intFormat(v.LikesAccumulate),
|
||||
intFormat(v.PlayIncrease),
|
||||
intFormat(v.PlayAccumulate),
|
||||
v.TidName,
|
||||
v.Ctime.Time().Format(TimeFormatSec),
|
||||
)
|
||||
writer.Write(record)
|
||||
}
|
||||
}
|
||||
|
||||
// McnGetMcnFansReply reply 粉丝分析.
|
||||
type McnGetMcnFansReply struct {
|
||||
FansOverview *dtmdl.DmConMcnFansD `json:"fans_overview"` // 粉丝概况
|
||||
FansSex *dtmdl.DmConMcnFansSexW `json:"fans_sex"` // 粉丝性别
|
||||
FansAge *dtmdl.DmConMcnFansAgeW `json:"fans_age"` // 粉丝年龄
|
||||
FansPlayWay *dtmdl.DmConMcnFansPlayWayW `json:"fans_play_way"` // 粉丝观看途径
|
||||
FansArea []*dtmdl.DmConMcnFansAreaW `json:"fans_area"` // 粉丝地区分布
|
||||
FansType []*dtmdl.DmConMcnFansTypeW `json:"fans_type"` // 粉丝倾向分布
|
||||
FansTag []*dtmdl.DmConMcnFansTagW `json:"fans_tag"` // 粉丝标签地图分布
|
||||
}
|
||||
|
||||
// McnUpPermissionApply .
|
||||
type McnUpPermissionApply struct {
|
||||
ID int64 `json:"id"`
|
||||
McnMid int64 `json:"mcn_mid"`
|
||||
UpMid int64 `json:"up_mid"`
|
||||
McnName string `json:"mcn_name"`
|
||||
UpName string `json:"up_name"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
FansCount int64 `json:"fans_count"`
|
||||
UpAuthLink string `json:"up_auth_link"`
|
||||
ActiveTID int16 `json:"active_tid"`
|
||||
TypeName string `json:"type_name"`
|
||||
RejectReason string `json:"reject_reason"`
|
||||
RejectTime xtime.Time `json:"reject_time"`
|
||||
State MCNUPPermissionState `json:"state"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
AdminID int64 `json:"admin_id"`
|
||||
AdminName string `json:"admin_name"`
|
||||
OldPermits *Permits `json:"old_permits"`
|
||||
NewPermits *Permits `json:"new_permits"`
|
||||
NewPermission uint32 `json:"-"`
|
||||
OldPermission uint32 `json:"-"`
|
||||
}
|
||||
|
||||
// AttrPermitVal get Permission all.
|
||||
func (n *McnUpPermissionApply) AttrPermitVal() {
|
||||
n.OldPermits, n.NewPermits = &Permits{}, &Permits{}
|
||||
n.OldPermits.SetAttrPermitVal(n.OldPermission)
|
||||
n.NewPermits.SetAttrPermitVal(n.NewPermission)
|
||||
}
|
||||
|
||||
// McnUpPermitApplyListReply struct .
|
||||
type McnUpPermitApplyListReply struct {
|
||||
List []*McnUpPermissionApply `json:"result"`
|
||||
PageResult
|
||||
}
|
38
app/admin/main/mcn/model/reply_test.go
Normal file
38
app/admin/main/mcn/model/reply_test.go
Normal file
@ -0,0 +1,38 @@
|
||||
package model
|
||||
|
||||
// type replyCommon struct {
|
||||
// Message string `json:"message"`
|
||||
// Code int `json:"code"`
|
||||
// Data interface{} `json:"data"`
|
||||
// }
|
||||
|
||||
// func createReply(data interface{}) *replyCommon {
|
||||
// return &replyCommon{
|
||||
// Message: "",
|
||||
// Code: 0,
|
||||
// Data: data,
|
||||
// }
|
||||
// }
|
||||
|
||||
// func printReply(data interface{}) {
|
||||
// var r = createReply(data)
|
||||
// var result, _ = json.MarshalIndent(r, "", " ")
|
||||
// fmt.Printf(string(result) + "\n")
|
||||
// }
|
||||
|
||||
// var now = xtime.Time(time.Now().Unix())
|
||||
|
||||
// func TestMcnGetMcnFansReply(t *testing.T) {
|
||||
// var reply = McnGetMcnFansReply{Result: []*McnGetMcnFansInfo{
|
||||
// {
|
||||
// FansOverview: &dtmdl.DmConMcnFansD{LogDate: now},
|
||||
// FansSex: &dtmdl.DmConMcnFansSexW{LogDate: now},
|
||||
// FansAge: &dtmdl.DmConMcnFansAgeW{LogDate: now},
|
||||
// FansPlayWay: &dtmdl.DmConMcnFansPlayWayW{LogDate: now},
|
||||
// FansArea: []*dtmdl.DmConMcnFansAreaW{{LogDate: now}},
|
||||
// FansType: []*dtmdl.DmConMcnFansTypeW{{LogDate: now}},
|
||||
// FansTag: []*dtmdl.DmConMcnFansTagW{{LogDate: now}},
|
||||
// },
|
||||
// }}
|
||||
// printReply(&reply)
|
||||
// }
|
311
app/admin/main/mcn/model/req.go
Normal file
311
app/admin/main/mcn/model/req.go
Normal file
@ -0,0 +1,311 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
xtime "go-common/library/time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// MCNSignEntryReq req .
|
||||
type MCNSignEntryReq struct {
|
||||
MCNMID int64 `json:"mcn_mid" validate:"min=1"`
|
||||
BeginDate string `json:"begin_date" validate:"required"` // 0000-00-00
|
||||
EndDate string `json:"end_date" validate:"required"` // 0000-00-00
|
||||
SignPayInfo []*SignPayReq `json:"sign_pay_info"`
|
||||
Permits *Permits `json:"permits"`
|
||||
UserName string
|
||||
UID int64
|
||||
Permission uint32
|
||||
}
|
||||
|
||||
// AttrPermitSet set Permission.
|
||||
func (req *MCNSignEntryReq) AttrPermitSet() {
|
||||
req.Permission = req.Permits.GetAttrPermitVal()
|
||||
}
|
||||
|
||||
// MCNSignPermissionReq .
|
||||
type MCNSignPermissionReq struct {
|
||||
SignID int64 `json:"sign_id" validate:"required"`
|
||||
Permits *Permits `json:"permits"`
|
||||
Permission uint32
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// AttrPermitSet set Permission.
|
||||
func (req *MCNSignPermissionReq) AttrPermitSet() {
|
||||
req.Permission = req.Permits.GetAttrPermitVal()
|
||||
}
|
||||
|
||||
// MCNUPPermitStateReq .
|
||||
type MCNUPPermitStateReq struct {
|
||||
State MCNUPPermissionState `form:"state" validate:"required"`
|
||||
PageArg
|
||||
}
|
||||
|
||||
// MCNUPPermitOPReq .
|
||||
type MCNUPPermitOPReq struct {
|
||||
ID int64 `json:"id" validate:"min=1"`
|
||||
Action MCNUPPermissionAction `json:"action" validate:"min=1"`
|
||||
RejectReason string `json:"reject_reason"`
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// ParseTime .
|
||||
func (req *MCNSignEntryReq) ParseTime() (stime, etime xtime.Time, err error) {
|
||||
var st, et time.Time
|
||||
if st, err = time.ParseInLocation(TimeFormatDay, req.BeginDate, time.Local); err != nil {
|
||||
err = errors.Errorf("time.ParseInLocation(%s) error(%+v)", req.BeginDate, err)
|
||||
return
|
||||
}
|
||||
if et, err = time.ParseInLocation(TimeFormatDay, req.EndDate, time.Local); err != nil {
|
||||
err = errors.Errorf("time.ParseInLocation(%s) error(%+v)", req.EndDate, err)
|
||||
return
|
||||
}
|
||||
stime = xtime.Time(st.Unix())
|
||||
etime = xtime.Time(et.Unix())
|
||||
return
|
||||
}
|
||||
|
||||
// SignPayReq .
|
||||
type SignPayReq struct {
|
||||
DueDate string `json:"due_date" validate:"required"` // 0000-00-00
|
||||
PayValue int64 `json:"pay_value" validate:"min=1"` // thousand bit
|
||||
}
|
||||
|
||||
// MCNSignInfoReq req
|
||||
type MCNSignInfoReq struct {
|
||||
SignID int64 `form:"sign_id" validate:"min=1"`
|
||||
}
|
||||
|
||||
// MCNSignStateReq req .
|
||||
type MCNSignStateReq struct {
|
||||
State MCNSignState `form:"state" validate:"min=0"`
|
||||
PageArg
|
||||
}
|
||||
|
||||
// MCNSignStateOpReq .
|
||||
type MCNSignStateOpReq struct {
|
||||
SignID int64 `json:"sign_id" validate:"min=1"`
|
||||
Action MCNSignAction `json:"action" validate:"min=0"`
|
||||
RejectReason string `json:"reject_reason"`
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// MCNUPStateReq req .
|
||||
type MCNUPStateReq struct {
|
||||
State MCNUPState `form:"state" validate:"min=0"`
|
||||
PageArg
|
||||
}
|
||||
|
||||
// MCNUPStateOpReq req .
|
||||
type MCNUPStateOpReq struct {
|
||||
SignUpID int64 `json:"sign_up_id" validate:"min=1"`
|
||||
Action MCNUPAction `json:"action" validate:"min=0"`
|
||||
RejectReason string `json:"reject_reason"`
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// MCNListReq req .
|
||||
type MCNListReq struct {
|
||||
McnCommonReq
|
||||
Permits
|
||||
ExpireSign bool `form:"expire_sign"`
|
||||
ExpirePay bool `form:"expire_pay"`
|
||||
FansNumMin int64 `form:"fans_num_min"`
|
||||
FansNumMax int64 `form:"fans_num_max"`
|
||||
State MCNSignState `form:"state" default:"-1"`
|
||||
SortUP string `form:"sort_up"`
|
||||
SortAllFans string `form:"sort_all_fans"`
|
||||
SortRiseFans string `form:"sort_rise_fans"`
|
||||
SortTrueRiseFans string `form:"sort_true_rise_fans"`
|
||||
SortCheatFans string `form:"sort_cheat_fans"`
|
||||
Order string `form:"order" default:"s.mtime"`
|
||||
Sort string `form:"sort" default:"DESC"`
|
||||
PageArg
|
||||
ExportArg
|
||||
}
|
||||
|
||||
// MCNPayEditReq req .
|
||||
type MCNPayEditReq struct {
|
||||
ID int64 `json:"id" validate:"min=1"`
|
||||
MCNMID int64 `json:"mcn_mid" validate:"min=1"`
|
||||
SignID int64 `json:"sign_id" validate:"min=1"`
|
||||
DueDate string `json:"due_date" validate:"required"`
|
||||
PayValue int64 `json:"pay_value" validate:"min=1"`
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// MCNPayStateEditReq req .
|
||||
type MCNPayStateEditReq struct {
|
||||
ID int64 `json:"id" validate:"min=1"`
|
||||
MCNMID int64 `json:"mcn_mid" validate:"min=1"`
|
||||
SignID int64 `json:"sign_id" validate:"min=1"`
|
||||
State int8 `json:"state"`
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// MCNStateEditReq req .
|
||||
type MCNStateEditReq struct {
|
||||
ID int64 `json:"id" validate:"min=1"`
|
||||
MCNMID int64 `json:"mcn_mid" validate:"min=1"`
|
||||
Action MCNSignAction `json:"action"`
|
||||
State MCNSignState
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// MCNRenewalReq req .
|
||||
type MCNRenewalReq struct {
|
||||
ID int64 `json:"id" validate:"min=1"`
|
||||
MCNMID int64 `json:"mcn_mid" validate:"min=1"`
|
||||
BeginDate string `json:"begin_date" validate:"required"` // 0000-00-00
|
||||
EndDate string `json:"end_date" validate:"required"` // 0000-00-00
|
||||
ContractLink string `json:"contract_link" validate:"required"`
|
||||
SignPayInfo []*SignPayReq `json:"sign_pay_info"`
|
||||
Permits Permits `json:"permits"`
|
||||
Permission uint32
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// AttrPermitSet set Permission.
|
||||
func (req *MCNRenewalReq) AttrPermitSet() {
|
||||
req.Permission = req.Permits.GetAttrPermitVal()
|
||||
}
|
||||
|
||||
// MCNInfoReq req .
|
||||
type MCNInfoReq struct {
|
||||
McnCommonReq
|
||||
ID int64 `form:"id"`
|
||||
}
|
||||
|
||||
// MCNUPListReq req .
|
||||
type MCNUPListReq struct {
|
||||
SignID int64 `form:"sign_id" validate:"required"`
|
||||
DataType int8 `form:"data_type" validate:"min=1"`
|
||||
State MCNUPState `form:"state" default:"-1"`
|
||||
ActiveTID int64 `form:"active_tid"`
|
||||
FansNumMin int64 `form:"fans_num_min"`
|
||||
FansNumMax int64 `form:"fans_num_max"`
|
||||
UPMID int64 `form:"up_mid"`
|
||||
SortFansCount string `form:"sort_fans_count"`
|
||||
SortFansCountActive string `form:"sort_fans_count_active"`
|
||||
SortFansIncreaseAccumulate string `form:"sort_fans_increase_accumulate"`
|
||||
SortArchiveCount string `form:"sort_archive_count"`
|
||||
SortPlayCount string `form:"sort_play_count"`
|
||||
SortPubPrice string `form:"sort_pub_price"`
|
||||
UpType int8 `form:"up_type" default:"-1"`
|
||||
Order string `form:"order" default:"u.mtime"`
|
||||
Sort string `form:"sort" default:"DESC"`
|
||||
Permits
|
||||
PageArg
|
||||
ExportArg
|
||||
}
|
||||
|
||||
// MCNUPStateEditReq req .
|
||||
type MCNUPStateEditReq struct {
|
||||
ID int64 `json:"id" validate:"required"`
|
||||
SignID int64 `json:"sign_id" validate:"required"`
|
||||
MCNMID int64 `json:"mcn_mid" validate:"required"`
|
||||
UPMID int64 `json:"up_mid" validate:"required"`
|
||||
Action MCNUPAction `json:"action"`
|
||||
State MCNUPState
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// MCNUPRecommendReq req .
|
||||
type MCNUPRecommendReq struct {
|
||||
TID int64 `form:"tid"`
|
||||
UpMid int64 `form:"up_mid"`
|
||||
FansMin int64 `form:"fans_min"`
|
||||
FansMax int64 `form:"fans_max"`
|
||||
PlayMin int64 `form:"play_min"`
|
||||
PlayMax int64 `form:"play_max"`
|
||||
PlayAverageMin int64 `form:"play_average_min"`
|
||||
PlayAverageMax int64 `form:"play_average_max"`
|
||||
State MCNUPRecommendState `form:"state"`
|
||||
Source MCNUPRecommendSource `form:"source"`
|
||||
Order string `form:"order" default:"mtime"`
|
||||
Sort string `form:"sort" default:"DESC"`
|
||||
PageArg
|
||||
ExportArg
|
||||
}
|
||||
|
||||
// MCNCheatListReq req .
|
||||
type MCNCheatListReq struct {
|
||||
McnCommonReq
|
||||
UPMID int64 `form:"up_mid"`
|
||||
PageArg
|
||||
}
|
||||
|
||||
// MCNCheatUPListReq struct .
|
||||
type MCNCheatUPListReq struct {
|
||||
UPMID int64 `form:"up_mid" validate:"required"`
|
||||
PageArg
|
||||
}
|
||||
|
||||
// MCNImportUPInfoReq struct .
|
||||
type MCNImportUPInfoReq struct {
|
||||
McnCommonReq
|
||||
UPMID int64 `form:"up_mid" validate:"required"`
|
||||
}
|
||||
|
||||
// MCNImportUPRewardSignReq struct .
|
||||
type MCNImportUPRewardSignReq struct {
|
||||
SignID int64 `json:"sign_id" validate:"required"`
|
||||
UPMID int64 `json:"up_mid" validate:"required"`
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// RecommendUpReq req .
|
||||
type RecommendUpReq struct {
|
||||
UpMid int64 `json:"up_mid" validate:"min=1"`
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// MCNIncreaseListReq struct .
|
||||
type MCNIncreaseListReq struct {
|
||||
McnCommonReq
|
||||
DataType int8 `form:"data_type"`
|
||||
ActiveTID int64 `form:"active_tid" default:"65535"`
|
||||
PageArg
|
||||
}
|
||||
|
||||
// RecommendStateOpReq .
|
||||
type RecommendStateOpReq struct {
|
||||
UpMids []int64 `json:"up_mids"`
|
||||
Action MCNUPRecommendAction `json:"action" validate:"min=1"`
|
||||
UserName string
|
||||
UID int64
|
||||
}
|
||||
|
||||
// McnGetRankReq req to 获取排行
|
||||
type McnGetRankReq struct {
|
||||
McnCommonReq
|
||||
Tid int16 `form:"tid"` // 分区 1累计,2昨日,3上周,4上月 0全部
|
||||
DataType DataType `form:"data_type"`
|
||||
PageArg
|
||||
ExportArg
|
||||
}
|
||||
|
||||
// McnCommonReq common mcn
|
||||
type McnCommonReq struct {
|
||||
SignID int64 `form:"sign_id"`
|
||||
MCNMID int64 `form:"mcn_mid"`
|
||||
}
|
||||
|
||||
// TotalMcnDataReq .
|
||||
type TotalMcnDataReq struct {
|
||||
Date xtime.Time `form:"date" validate:"required"`
|
||||
}
|
76
app/admin/main/mcn/model/request_base.go
Normal file
76
app/admin/main/mcn/model/request_base.go
Normal file
@ -0,0 +1,76 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"math"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// const .
|
||||
const (
|
||||
// dateFmt = "20060102"
|
||||
dateTimeFmt = "20060102_150405"
|
||||
ResponeModelJSON = "json"
|
||||
ResponeModelCSV = "csv"
|
||||
)
|
||||
|
||||
func round(num float64) int {
|
||||
return int(num + math.Copysign(0.5, num))
|
||||
}
|
||||
|
||||
//ToFixed fix float precision
|
||||
func ToFixed(num float64, precision int) float64 {
|
||||
output := math.Pow(10, float64(precision))
|
||||
return float64(round(num*output)) / output // since go 1.9 doesn't have a math.Round function...
|
||||
}
|
||||
|
||||
// floatFormat format float to string
|
||||
func floatFormat(f float64) string {
|
||||
return strconv.FormatFloat(f, 'f', 2, 64)
|
||||
}
|
||||
|
||||
// intFormat format int to string
|
||||
func intFormat(i int64) string {
|
||||
return strconv.Itoa(int(i))
|
||||
}
|
||||
|
||||
//PageArg page arg
|
||||
type PageArg struct {
|
||||
Page int `form:"page" default:"1"`
|
||||
Size int `form:"size" default:"20"`
|
||||
}
|
||||
|
||||
//PageResult page result
|
||||
type PageResult struct {
|
||||
Page int `json:"page"`
|
||||
TotalCount int `json:"total_count"`
|
||||
}
|
||||
|
||||
//CheckPageValidation check the page validte, return limit offset
|
||||
func (arg *PageArg) CheckPageValidation() (limit, offset int) {
|
||||
if arg.Page < 1 {
|
||||
arg.Page = 1
|
||||
}
|
||||
if arg.Size > 100 || arg.Size <= 0 {
|
||||
arg.Size = 10
|
||||
}
|
||||
limit = arg.Size
|
||||
offset = (arg.Page - 1) * limit
|
||||
return
|
||||
}
|
||||
|
||||
//ToPageResult cast to page result
|
||||
func (arg *PageArg) ToPageResult(total int) (res PageResult) {
|
||||
res.TotalCount = total
|
||||
res.Page = arg.Page
|
||||
return
|
||||
}
|
||||
|
||||
//ExportArg export arg
|
||||
type ExportArg struct {
|
||||
Export string `form:"export"`
|
||||
}
|
||||
|
||||
//ExportFormat export format
|
||||
func (e *ExportArg) ExportFormat() string {
|
||||
return e.Export
|
||||
}
|
62
app/admin/main/mcn/model/request_example.go
Normal file
62
app/admin/main/mcn/model/request_example.go
Normal file
@ -0,0 +1,62 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/csv"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
xtime "go-common/library/time"
|
||||
)
|
||||
|
||||
// QueryActivityByIDReq arg
|
||||
type QueryActivityByIDReq struct {
|
||||
FromDate string `form:"from_date"` // 20180101
|
||||
ToDate string `form:"to_date"` // 20180102 closed interval [20180101, 20180102]
|
||||
ID int64 `form:"id"` // activity id, if not 0, FromDate and toDate not used
|
||||
PageArg
|
||||
ExportArg
|
||||
}
|
||||
|
||||
//UpSummaryBonusInfo bonus for one up info
|
||||
type UpSummaryBonusInfo struct {
|
||||
Mid int64 `json:"mid"`
|
||||
BilledMoney float64 `json:"billed_money"`
|
||||
UnbilledMoney float64 `json:"unbilled_money"`
|
||||
LastBillTime string `json:"last_bill_time"` // 20180101, 最近结算时间
|
||||
TmpBillTime xtime.Time `json:"-"` // 用来计算LastBillTime
|
||||
TotalBonusMoney float64 `json:"total_bonus_money"` // 所有的中奖金额
|
||||
}
|
||||
|
||||
//QueryUpBonusByMidResult query result
|
||||
type QueryUpBonusByMidResult struct {
|
||||
Result []*UpSummaryBonusInfo `json:"result"`
|
||||
PageResult
|
||||
}
|
||||
|
||||
//GetFileName get file name
|
||||
func (q *QueryUpBonusByMidResult) GetFileName() string {
|
||||
return fmt.Sprintf("%s_%s.csv", "结算记录", time.Now().Format(dateTimeFmt))
|
||||
}
|
||||
|
||||
//ToCsv to buffer
|
||||
func (q *QueryUpBonusByMidResult) ToCsv(writer *csv.Writer) {
|
||||
var title = []string{
|
||||
"UID",
|
||||
"已结算",
|
||||
"未结算",
|
||||
"最近结算时间"}
|
||||
writer.Write(title)
|
||||
if q == nil {
|
||||
return
|
||||
}
|
||||
for _, v := range q.Result {
|
||||
var record []string
|
||||
record = append(record,
|
||||
intFormat(v.Mid),
|
||||
floatFormat(v.BilledMoney),
|
||||
floatFormat(v.UnbilledMoney),
|
||||
v.LastBillTime,
|
||||
)
|
||||
writer.Write(record)
|
||||
}
|
||||
}
|
265
app/admin/main/mcn/model/statistics.go
Normal file
265
app/admin/main/mcn/model/statistics.go
Normal file
@ -0,0 +1,265 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
arcmodel "go-common/app/service/main/archive/model/archive"
|
||||
xtime "go-common/library/time"
|
||||
)
|
||||
|
||||
const (
|
||||
// TopDataLenth .
|
||||
TopDataLenth int = 5
|
||||
)
|
||||
|
||||
// DataType .
|
||||
type DataType int8
|
||||
|
||||
// DataType 数据类型,1累计,2昨日,3上周,4上月
|
||||
/* ENUM(
|
||||
Accumulate = 1
|
||||
Day = 2
|
||||
Week = 3
|
||||
Month = 4
|
||||
ActiveFans = 5
|
||||
)*/
|
||||
const (
|
||||
// DataTypeAccumulate is a DataType of type Accumulate
|
||||
DataTypeAccumulate DataType = 1
|
||||
// DataTypeDay is a DataType of type Day
|
||||
DataTypeDay DataType = 2
|
||||
// DataTypeWeek is a DataType of type Week
|
||||
DataTypeWeek DataType = 3
|
||||
// DataTypeMonth is a DataType of type Month
|
||||
DataTypeMonth DataType = 4
|
||||
// DataTypeActiveFans active fans
|
||||
DataTypeActiveFans DataType = 5
|
||||
)
|
||||
|
||||
// DataViewTypeSummary .
|
||||
type DataViewTypeSummary int8
|
||||
|
||||
const (
|
||||
// SignUpsAccumulate signed up accumulate amount.
|
||||
SignUpsAccumulate DataViewTypeSummary = 1
|
||||
// FansIncr signed up fans incr amount.
|
||||
FansIncr DataViewTypeSummary = 2
|
||||
// VideoUpsIncr signed up videoup incr amount.
|
||||
VideoUpsIncr DataViewTypeSummary = 3
|
||||
// PlaysIncr signed up paly incr amount.
|
||||
PlaysIncr DataViewTypeSummary = 4
|
||||
)
|
||||
|
||||
// DataViewFansTop .
|
||||
type DataViewFansTop int8
|
||||
|
||||
const (
|
||||
// McnFansIncr .
|
||||
McnFansIncr DataViewFansTop = 1
|
||||
// McnFansIncrRate .
|
||||
McnFansIncrRate DataViewFansTop = 2
|
||||
// UpFansIncr .
|
||||
UpFansIncr DataViewFansTop = 3
|
||||
// UpFansIncrRate .
|
||||
UpFansIncrRate DataViewFansTop = 4
|
||||
)
|
||||
|
||||
// MCNDataSummary .
|
||||
type MCNDataSummary struct {
|
||||
ID int64 `json:"id"`
|
||||
MCNID int64 `json:"mcn_mid"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
UPCount int64 `json:"up_count"`
|
||||
FansCountAccumulate int64 `json:"fans_count_accumulate"`
|
||||
FansCountOnline int64 `json:"fans_count_online"`
|
||||
FansCountReal int64 `json:"fans_count_real"`
|
||||
FansCountCheat int64 `json:"fans_count_cheat"`
|
||||
FansCountCheatAccumulate int64 `json:"fans_count_cheat_accumulate"`
|
||||
FansCountIncreaseDay int64 `json:"fans_count_increase_day"`
|
||||
PlayCountAccumulate int64 `json:"play_count_accumulate"`
|
||||
PlayCountIncreaseDay int64 `json:"play_count_increase_day"`
|
||||
ArchiveCountAccumulate int64 `json:"archive_count_accumulate"`
|
||||
ArchiveCountIncreaseDay int64 `json:"archive_count_increase_day"`
|
||||
ActiveTID int64 `json:"active_tid"`
|
||||
GenerateDate xtime.Time `json:"generate_date"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
}
|
||||
|
||||
// MCNDataUP .
|
||||
type MCNDataUP struct {
|
||||
ID int64 `json:"id"`
|
||||
MCNID int64 `json:"mcn_mid"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
UPMID int64 `json:"up_mid"`
|
||||
DataType int8 `json:"data_type"`
|
||||
FansCountAll int64 `json:"fans_count_all"`
|
||||
FansCountActive int64 `json:"fans_count_active"`
|
||||
FansIncreaseAccumulate int64 `json:"fans_increase_accumulate"`
|
||||
ArchiveCount int64 `json:"archive_count"`
|
||||
PlayCount int64 `json:"play_count"`
|
||||
FansIncreaseMonth int64 `json:"fans_increase_month"`
|
||||
GenerateDate xtime.Time `json:"generate_date"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
}
|
||||
|
||||
// MCNDataArchiveRank .
|
||||
type MCNDataArchiveRank struct {
|
||||
ID int64 `json:"id"`
|
||||
MCNID int64 `json:"mcn_mid"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
ArchiveID int64 `json:"archive_id"`
|
||||
ArchiveTitle string `json:"archive_title"`
|
||||
UPMID int64 `json:"up_mid"`
|
||||
LikeCountAccumulate int64 `json:"like_count_accumulate"`
|
||||
LikeCountIncrease int64 `json:"like_count_increase"`
|
||||
PlayCountIncrease int64 `json:"play_count_increase"`
|
||||
DataType int8 `json:"data_type"`
|
||||
TID int64 `json:"tid"`
|
||||
CtimeArchive xtime.Time `json:"ctime_archive"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
}
|
||||
|
||||
// RankDataBase 基本排行信息
|
||||
type RankDataBase struct {
|
||||
Tid int16 `json:"tid"`
|
||||
DataType DataType `json:"data_type"`
|
||||
}
|
||||
|
||||
// TidnameInfo tid name
|
||||
type TidnameInfo struct {
|
||||
Tid int16 `json:"tid"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// RankArchiveLikeInfo archive like rank info
|
||||
type RankArchiveLikeInfo struct {
|
||||
RankDataBase
|
||||
ArchiveID int64 `json:"archive_id"` // 稿件ID
|
||||
ArchiveTitle string `json:"archive_title"`
|
||||
Pic string `json:"pic"` // 封面
|
||||
TidName string `json:"tid_name"`
|
||||
LikesIncrease int64 `json:"likes_increase"`
|
||||
LikesAccumulate int64 `json:"likes_accumulate"`
|
||||
PlayIncrease int64 `json:"play_increase"`
|
||||
PlayAccumulate int64 `json:"play_accumulate"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Stat arcmodel.Stat3 `json:"stat"` // 统计信息
|
||||
Author arcmodel.Author3 `json:"author"` // up主信息
|
||||
}
|
||||
|
||||
// TotalMcnDataInfo .
|
||||
type TotalMcnDataInfo struct {
|
||||
BaseInfo *McnDataOverview `json:"base_info"`
|
||||
TopInfo *McnDataTopInfo `json:"top_info"`
|
||||
TypesInfo *McnDataTypesInfo `json:"types_info"`
|
||||
}
|
||||
|
||||
// McnDataTopInfo .
|
||||
type McnDataTopInfo struct {
|
||||
McnFansIncr []*FansRankIncr `json:"mcn_fans_incr"`
|
||||
McnFansRateIncr []*FansRankIncr `json:"mcn_fans_rate_incr"`
|
||||
UpFansIncr []*FansRankIncr `json:"up_fans_incr"`
|
||||
UpFansRateIncr []*FansRankIncr `json:"up_fans_rate_incr"`
|
||||
ArcLikesIncr []*LikesRankIncr `json:"arc_likes_incr"`
|
||||
}
|
||||
|
||||
// FansRankIncr .
|
||||
type FansRankIncr struct {
|
||||
SignID int64 `json:"sign_id"`
|
||||
Mid int64 `json:"mid"`
|
||||
Name string `json:"name"`
|
||||
Rank int16 `json:"rank"`
|
||||
FansIncr int64 `json:"fans_incr"`
|
||||
Fans int64 `json:"fans"`
|
||||
RateIncr int64 `json:"rate_incr"`
|
||||
}
|
||||
|
||||
// LikesRankIncr .
|
||||
type LikesRankIncr struct {
|
||||
McnMid int64 `json:"mcn_mid"`
|
||||
McnName string `json:"mcn_name"`
|
||||
UpMid int64 `json:"up_mid"`
|
||||
UpName string `json:"up_name"`
|
||||
AVID int64 `json:"avid"`
|
||||
AVTitle string `json:"av_title"`
|
||||
TID int16 `json:"tid"`
|
||||
TypeName string `json:"type_name"`
|
||||
LikesIncr int64 `json:"likes_incr"`
|
||||
PlayIncr int64 `json:"play_incr"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
}
|
||||
|
||||
// McnDataTypesInfo .
|
||||
type McnDataTypesInfo struct {
|
||||
SignUps []*DataTypes `json:"sign_ups"`
|
||||
FansIncr []*DataTypes `json:"fans_incr"`
|
||||
VideoupIncr []*DataTypes `json:"videoup_incr"`
|
||||
PlayIncr []*DataTypes `json:"play_incr"`
|
||||
}
|
||||
|
||||
// DataTypes .
|
||||
type DataTypes struct {
|
||||
TID int16 `json:"tid"`
|
||||
TypeName string `json:"type_name"`
|
||||
Total int64 `json:"total"`
|
||||
Amount int64 `json:"amount"`
|
||||
Rate int64 `json:"rate"`
|
||||
}
|
||||
|
||||
// McnDataOverview base data.
|
||||
type McnDataOverview struct {
|
||||
Mcns int64 `json:"mcns"`
|
||||
SignUps int64 `json:"sign_ups"`
|
||||
SignUpsIncr int64 `json:"sign_ups_incr"`
|
||||
Fans50 int64 `json:"fans_50"`
|
||||
Fans10 int64 `json:"fans_10"`
|
||||
Fans1 int64 `json:"fans_1"`
|
||||
FansIncr50 int64 `json:"fans_incr_50"`
|
||||
FansIncr10 int64 `json:"fans_incr_10"`
|
||||
FansIncr1 int64 `json:"fans_incr_1"`
|
||||
}
|
||||
|
||||
// McnRankFansOverview top5 data.
|
||||
type McnRankFansOverview struct {
|
||||
ID int64 `json:"id"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
Mid int64 `json:"mid"`
|
||||
DataView int8 `json:"data_view"`
|
||||
DataType int8 `json:"data_type"`
|
||||
Rank int16 `json:"rank"`
|
||||
FansIncr int64 `json:"fans_incr"`
|
||||
Fans int64 `json:"fans"`
|
||||
GenerateDate xtime.Time `json:"generate_date"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
}
|
||||
|
||||
// McnDataTypeSummary tids data.
|
||||
type McnDataTypeSummary struct {
|
||||
ID int64 `json:"id"`
|
||||
Tid int16 `json:"tid"`
|
||||
DataView int8 `json:"data_view"`
|
||||
DataType int8 `json:"data_type"`
|
||||
Amount int64 `json:"amount"`
|
||||
GenerateDate xtime.Time `json:"generate_date"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
}
|
||||
|
||||
// McnRankArchiveLikesOverview total mcn arc rank likes top
|
||||
type McnRankArchiveLikesOverview struct {
|
||||
ID int64 `json:"id"`
|
||||
McnMid int64 `json:"mcn_mid"`
|
||||
UpMid int64 `json:"up_mid"`
|
||||
SignID int64 `json:"sign_id"`
|
||||
Avid int64 `json:"avid"`
|
||||
Tid int16 `json:"tid"`
|
||||
Rank int16 `json:"rank"`
|
||||
DataType int8 `json:"data_type"`
|
||||
Likes int64 `json:"likes"`
|
||||
Plays int64 `json:"plays"`
|
||||
GenerateDate xtime.Time `json:"generate_date"`
|
||||
Ctime xtime.Time `json:"ctime"`
|
||||
Mtime xtime.Time `json:"mtime"`
|
||||
}
|
Reference in New Issue
Block a user