123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689 |
- 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 ""
- }
- }
|