mcn.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. package model
  2. // MCNSignState .
  3. type MCNSignState int8
  4. // const .
  5. const (
  6. // MCNSignStateUnKnown 未知状态
  7. MCNSignStateUnKnown MCNSignState = -1
  8. // MCNSignStateNoApply 未申请
  9. MCNSignStateNoApply MCNSignState = 0
  10. // MCNSignStateOnReview 待审核
  11. MCNSignStateOnReview MCNSignState = 1
  12. // MCNSignStateOnReject 已驳回
  13. MCNSignStateOnReject MCNSignState = 2
  14. // MCNSignStateOnSign 已签约
  15. MCNSignStateOnSign MCNSignState = 10
  16. // MCNSignStateOnCooling 冷却中
  17. MCNSignStateOnCooling MCNSignState = 11
  18. // MCNSignStateOnExpire 已到期
  19. MCNSignStateOnExpire MCNSignState = 12
  20. // MCNSignStateOnBlock 已封禁
  21. MCNSignStateOnBlock MCNSignState = 13
  22. // MCNSignStateOnClear 已清退
  23. MCNSignStateOnClear MCNSignState = 14
  24. // MCNSignStateOnPreOpen 待开启
  25. MCNSignStateOnPreOpen MCNSignState = 15
  26. // MCNSignStateOnDelete 已移除
  27. MCNSignStateOnDelete MCNSignState = 100
  28. )
  29. func (state MCNSignState) String() string {
  30. switch state {
  31. case MCNSignStateNoApply:
  32. return "未申请"
  33. case MCNSignStateOnReview:
  34. return "待审核"
  35. case MCNSignStateOnReject:
  36. return "已驳回"
  37. case MCNSignStateOnSign:
  38. return "已签约"
  39. case MCNSignStateOnCooling:
  40. return "冷却中"
  41. case MCNSignStateOnExpire:
  42. return "已到期"
  43. case MCNSignStateOnBlock:
  44. return "已封禁"
  45. case MCNSignStateOnClear:
  46. return "已清退"
  47. case MCNSignStateOnPreOpen:
  48. return "待开启"
  49. case MCNSignStateOnDelete:
  50. return "已移除"
  51. default:
  52. return ""
  53. }
  54. }
  55. // MCNSignAction .
  56. type MCNSignAction int8
  57. const (
  58. // MCNSignActionEntry 录入
  59. MCNSignActionEntry MCNSignAction = 0
  60. // MCNSignActionApply 申请
  61. MCNSignActionApply MCNSignAction = 1
  62. // MCNSignActionReject 驳回
  63. MCNSignActionReject MCNSignAction = 2
  64. // MCNSignActionPass 通过
  65. MCNSignActionPass MCNSignAction = 10
  66. // MCNSignActionBlock 封禁
  67. MCNSignActionBlock MCNSignAction = 13
  68. // MCNSignActionClear 清退
  69. MCNSignActionClear MCNSignAction = 14
  70. // MCNSignActionRenew 续约
  71. MCNSignActionRenew MCNSignAction = 16
  72. // MCNSignActionRestore 恢复
  73. MCNSignActionRestore MCNSignAction = 17
  74. // MCNSignActionPermit 签约用户权限变更(只用于记日志)
  75. MCNSignActionPermit MCNSignAction = 99
  76. // MCNSignActionDelete 移除
  77. MCNSignActionDelete MCNSignAction = 100
  78. )
  79. // GetState .
  80. func (action MCNSignAction) GetState(oldState MCNSignState) MCNSignState {
  81. switch action {
  82. // MCNSignActionEntry 录入
  83. case MCNSignActionEntry:
  84. return MCNSignStateNoApply
  85. // MCNSignActionApply 申请
  86. case MCNSignActionApply:
  87. return MCNSignStateOnReview
  88. // MCNSignActionReject 驳回
  89. case MCNSignActionReject:
  90. return MCNSignStateOnReject
  91. // MCNSignActionPass 通过
  92. case MCNSignActionPass:
  93. return MCNSignStateOnSign
  94. // MCNSignActionBlock 封禁
  95. case MCNSignActionBlock:
  96. return MCNSignStateOnBlock
  97. // MCNSignActionClear 清退
  98. case MCNSignActionClear:
  99. return MCNSignStateOnClear
  100. // MCNSignActionRenew 续约
  101. case MCNSignActionRenew:
  102. return MCNSignStateOnSign
  103. // MCNSignActionRestore 恢复
  104. case MCNSignActionRestore:
  105. switch oldState {
  106. case MCNSignStateOnBlock:
  107. return MCNSignStateOnSign
  108. case MCNSignStateOnClear:
  109. return MCNSignStateNoApply
  110. }
  111. // MCNSignActionDelete 移除
  112. case MCNSignActionDelete:
  113. return MCNSignStateOnDelete
  114. }
  115. return MCNSignState(MCNSignStateUnKnown)
  116. }
  117. // NotRejectState .
  118. func (state MCNSignState) NotRejectState() bool {
  119. return state != MCNSignStateOnReject
  120. }
  121. // NotRightAction .
  122. func (action MCNSignAction) NotRightAction() bool {
  123. return action == MCNSignActionReject || action == MCNSignActionPass || action == MCNSignActionDelete
  124. }
  125. // IsOnReviewState .
  126. func (state MCNSignState) IsOnReviewState(action MCNSignAction) bool {
  127. return state != MCNSignStateOnReview && action != MCNSignActionDelete
  128. }
  129. // IsRenewalState .
  130. func (state MCNSignState) IsRenewalState() bool {
  131. return state != MCNSignStateOnSign
  132. }
  133. // GetmsgType .
  134. func (action MCNSignAction) GetmsgType(oldState MCNSignState) MSGType {
  135. switch action {
  136. // MCNSignActionEntry 录入
  137. case MCNSignActionEntry:
  138. return MSGType(0)
  139. // MCNSignActionApply 申请
  140. case MCNSignActionApply:
  141. return MSGType(0)
  142. // MCNSignActionReject 驳回
  143. case MCNSignActionReject:
  144. return McnSignNoApplyPass
  145. // MCNSignActionPass 通过
  146. case MCNSignActionPass:
  147. return McnSignApplyPass
  148. // MCNSignActionBlock 封禁
  149. case MCNSignActionBlock:
  150. return McnBackstageBlock
  151. // MCNSignActionClear 清退
  152. case MCNSignActionClear:
  153. return McnBackstageClose
  154. // MCNSignActionRenew 续约
  155. case MCNSignActionRenew:
  156. return McnRenewcontract
  157. // MCNSignActionRestore 恢复
  158. case MCNSignActionRestore:
  159. switch oldState {
  160. case MCNSignStateOnBlock:
  161. return McnAccountRestore
  162. case MCNSignStateOnClear:
  163. return MSGType(0)
  164. }
  165. // MCNSignActionDelete 移除
  166. case MCNSignActionDelete:
  167. return MSGType(0)
  168. }
  169. return MSGType(0)
  170. }
  171. func (action MCNSignAction) String() string {
  172. switch action {
  173. case MCNSignActionEntry:
  174. return "mcn录入"
  175. case MCNSignActionApply:
  176. return "前台mcn申请"
  177. case MCNSignActionReject:
  178. return "驳回申请"
  179. case MCNSignActionPass:
  180. return "申请通过"
  181. case MCNSignActionBlock:
  182. return "封禁mcn"
  183. case MCNSignActionClear:
  184. return "清退mcn"
  185. case MCNSignActionRenew:
  186. return "续约mcn"
  187. case MCNSignActionRestore:
  188. return "恢复mcn"
  189. case MCNSignActionPermit:
  190. return "mcn权限变更"
  191. case MCNSignActionDelete:
  192. return "移除mcn"
  193. default:
  194. return ""
  195. }
  196. }
  197. // MCNUPState .
  198. type MCNUPState int8
  199. // const .
  200. const (
  201. // MCNUPStateUnKnown 未知状态
  202. MCNUPStateUnKnown MCNUPState = -1
  203. // MCNUPStateNoAuthorize 未授权
  204. MCNUPStateNoAuthorize MCNUPState = 0
  205. // MCNUPStateOnRefuse 已拒绝
  206. MCNUPStateOnRefuse MCNUPState = 1
  207. // MCNUPStateOnReview 待审核
  208. MCNUPStateOnReview MCNUPState = 2
  209. // MCNSignStateOnReject 已驳回
  210. MCNUPStateOnReject MCNUPState = 3
  211. // MCNUPStateOnSign 已签约
  212. MCNUPStateOnSign MCNUPState = 10
  213. // MCNUPStateOnFreeze 已冻结
  214. MCNUPStateOnFreeze MCNUPState = 11
  215. // MCNUPStateOnExpire 已到期
  216. MCNUPStateOnExpire MCNUPState = 12
  217. // MCNUPStateOnBlock 已封禁
  218. MCNUPStateOnBlock MCNUPState = 13
  219. // MCNUPStateOnClear 已解约
  220. MCNUPStateOnClear MCNUPState = 14
  221. // MCNUPStateOnPreOpen 待开启
  222. MCNUPStateOnPreOpen MCNUPState = 15
  223. // MCNUPStateOnDelete 已删除
  224. MCNUPStateOnDelete MCNUPState = 100
  225. )
  226. func (state MCNUPState) String() string {
  227. switch state {
  228. case MCNUPStateNoAuthorize:
  229. return "未授权"
  230. case MCNUPStateOnRefuse:
  231. return "已拒绝"
  232. case MCNUPStateOnReview:
  233. return "待审核"
  234. case MCNUPStateOnReject:
  235. return "已驳回"
  236. case MCNUPStateOnSign:
  237. return "已签约"
  238. case MCNUPStateOnFreeze:
  239. return "已冻结"
  240. case MCNUPStateOnExpire:
  241. return "已到期"
  242. case MCNUPStateOnBlock:
  243. return "已封禁"
  244. case MCNUPStateOnClear:
  245. return "已解约"
  246. case MCNUPStateOnDelete:
  247. return "已删除"
  248. default:
  249. return ""
  250. }
  251. }
  252. // MCNUPAction .
  253. type MCNUPAction int8
  254. const (
  255. // MCNUPActionBind 发起绑定
  256. MCNUPActionBind MCNUPAction = 0
  257. // MCNUPActionReject 运营驳回
  258. MCNUPActionReject MCNUPAction = 3
  259. // MCNUPActionAgree up主同意
  260. MCNUPActionAgree MCNUPAction = 4
  261. // MCNUPActionRefuse up主拒绝
  262. MCNUPActionRefuse MCNUPAction = 5
  263. // MCNUPActionPass 通过
  264. MCNUPActionPass MCNUPAction = 10
  265. // MCNUPActionFreeze 冻结
  266. MCNUPActionFreeze MCNUPAction = 11
  267. // MCNUPActionRelease 解约
  268. MCNUPActionRelease MCNUPAction = 14
  269. // MCNUPActionRestore 恢复
  270. MCNUPActionRestore MCNUPAction = 16
  271. )
  272. // GetState .
  273. func (action MCNUPAction) GetState() MCNUPState {
  274. switch action {
  275. // MCNUPActionBind 发起绑定
  276. case MCNUPActionBind:
  277. return MCNUPStateNoAuthorize
  278. // MCNUPActionReject 运营驳回
  279. case MCNUPActionReject:
  280. return MCNUPStateOnReject
  281. // MCNUPActionAgree up主同意
  282. case MCNUPActionAgree:
  283. return MCNUPStateOnReview
  284. // MCNUPActionRefuse up主拒绝
  285. case MCNUPActionRefuse:
  286. return MCNUPStateOnRefuse
  287. // MCNUPActionPass 通过
  288. case MCNUPActionPass:
  289. return MCNUPStateOnSign
  290. // MCNUPActionFreeze 冻结
  291. case MCNUPActionFreeze:
  292. return MCNUPStateOnFreeze
  293. // MCNUPActionRelease 解约
  294. case MCNUPActionRelease:
  295. return MCNUPStateOnClear
  296. // MCNUPActionRestore 恢复
  297. case MCNUPActionRestore:
  298. return MCNUPStateOnSign
  299. }
  300. return MCNUPState(MCNUPStateUnKnown)
  301. }
  302. // GetmsgType .
  303. func (action MCNUPAction) GetmsgType(isMcn bool) MSGType {
  304. switch {
  305. // MCNUPActionBind 发起绑定
  306. case action == MCNUPActionBind:
  307. return McnUpBindAuthApply
  308. // MCNUPActionRefuse up主拒绝
  309. case action == MCNUPActionRefuse:
  310. return McnUpBindAuthApplyRefuse
  311. // MCNUPActionAgree up主同意
  312. case action == MCNUPActionAgree:
  313. return McnUpBindAuthReview
  314. // MCNUPActionReject 运营驳回
  315. case action == MCNUPActionReject && isMcn:
  316. return McnUpBindAuthApplyNoPass
  317. case action == MCNUPActionReject && !isMcn:
  318. return UpMcnBindAuthApplyNoPass
  319. // MCNUPActionPass 通过
  320. case action == MCNUPActionPass && isMcn:
  321. return McnUpBindAuthApplyPass
  322. case action == MCNUPActionPass && !isMcn:
  323. return UpMcnBindAuthApplyPass
  324. // MCNUPActionFreeze 冻结
  325. case action == MCNUPActionFreeze && isMcn:
  326. return McnUpRelationFreeze
  327. case action == MCNUPActionFreeze && !isMcn:
  328. return UpMcnRelationFreeze
  329. // MCNUPActionRelease 解约
  330. case action == MCNUPActionRelease && isMcn:
  331. return McnUpRelationRelease
  332. case action == MCNUPActionRelease && !isMcn:
  333. return UpMcnRelationRelease
  334. // MCNUPActionRestore 恢复
  335. case action == MCNUPActionRestore && isMcn:
  336. return MSGType(0)
  337. case action == MCNUPActionRestore && !isMcn:
  338. return MSGType(0)
  339. }
  340. return MSGType(0)
  341. }
  342. func (action MCNUPAction) String() string {
  343. switch action {
  344. case MCNUPActionBind:
  345. return "mcn发起绑定"
  346. case MCNUPActionReject:
  347. return "运营驳回"
  348. case MCNUPActionAgree:
  349. return "up主同意"
  350. case MCNUPActionRefuse:
  351. return "up主拒绝"
  352. case MCNUPActionPass:
  353. return "审核通过"
  354. case MCNUPActionFreeze:
  355. return "up主申请冻结"
  356. case MCNUPActionRelease:
  357. return "up主和mcn相互解约"
  358. case MCNUPActionRestore:
  359. return "恢复up主和mcn的合同"
  360. default:
  361. return ""
  362. }
  363. }
  364. // NotRightAction .
  365. func (action MCNUPAction) NotRightAction() bool {
  366. return action == MCNUPActionReject || action == MCNUPActionPass
  367. }
  368. // NoRejectState .
  369. func (action MCNUPAction) NoRejectState() bool {
  370. return action != MCNUPActionReject
  371. }
  372. // NotRightState .
  373. func (state MCNUPState) NotRightState() bool {
  374. return state == MCNUPStateOnReject || state == MCNUPStateOnSign
  375. }
  376. // IsOnReviewState .
  377. func (state MCNUPState) IsOnReviewState() bool {
  378. return state != MCNUPStateOnReview
  379. }
  380. // MCNSignCycleAction .
  381. type MCNSignCycleAction int8
  382. // const .
  383. const (
  384. // MCNSignCycleActionUp 变更
  385. MCNSignCycleActionUp MCNSignCycleAction = iota
  386. // MCNSignCycleActionAdd 新增
  387. MCNSignCycleActionAdd
  388. // MCNSignCycleActionDel 删除
  389. MCNSignCycleActionDel
  390. )
  391. func (act MCNSignCycleAction) String() string {
  392. switch act {
  393. case MCNSignCycleActionUp:
  394. return "变更"
  395. case MCNSignCycleActionAdd:
  396. return "新增"
  397. case MCNSignCycleActionDel:
  398. return "删除"
  399. default:
  400. return ""
  401. }
  402. }
  403. // MCNPayState .
  404. type MCNPayState int8
  405. // const .
  406. const (
  407. // MCNPayNo 未支付
  408. MCNPayNo MCNPayState = 0
  409. // MCNPayed 已支付
  410. MCNPayed MCNPayState = 1
  411. // MCNPayDel 已删除
  412. MCNPayDel MCNPayState = 100
  413. )
  414. func (mps MCNPayState) String() string {
  415. switch mps {
  416. case MCNPayNo:
  417. return "未支付"
  418. case MCNPayed:
  419. return "已支付"
  420. case MCNPayDel:
  421. return "已删除"
  422. default:
  423. return ""
  424. }
  425. }
  426. // MCNUPRecommendState .
  427. type MCNUPRecommendState int8
  428. // const .
  429. const (
  430. // MCNUPRecommendStateUnKnown 未知状态
  431. MCNUPRecommendStateUnKnown MCNUPRecommendState = 0
  432. // MCNUPRecommendStateOff 未推荐
  433. MCNUPRecommendStateOff MCNUPRecommendState = 1
  434. // MCNUPRecommendStateOn 推荐中
  435. MCNUPRecommendStateOn MCNUPRecommendState = 2
  436. // MCNUPRecommendStateBan 禁止推荐
  437. MCNUPRecommendStateBan MCNUPRecommendState = 3
  438. // MCNUPRecommendStateDel 移除中
  439. MCNUPRecommendStateDel MCNUPRecommendState = 100
  440. )
  441. func (state MCNUPRecommendState) String() string {
  442. switch state {
  443. case MCNUPRecommendStateOff:
  444. return "未推荐"
  445. case MCNUPRecommendStateOn:
  446. return "推荐中"
  447. case MCNUPRecommendStateBan:
  448. return "禁止推荐"
  449. case MCNUPRecommendStateDel:
  450. return "移除中"
  451. default:
  452. return "未知状态"
  453. }
  454. }
  455. // MCNUPRecommendSource .
  456. type MCNUPRecommendSource int8
  457. // const .
  458. const (
  459. // MCNUPRecommendSourceUnKnown 未知来源
  460. MCNUPRecommendSourceUnKnown MCNUPRecommendSource = iota
  461. // MCNUPRecommendSourceAuto 自动添加(大数据)
  462. MCNUPRecommendSourceAuto
  463. // MCNUPRecommendStateManual 手动添加
  464. MCNUPRecommendStateManual
  465. )
  466. func (source MCNUPRecommendSource) String() string {
  467. switch source {
  468. case MCNUPRecommendSourceAuto:
  469. return "自动添加(大数据)"
  470. case MCNUPRecommendStateManual:
  471. return "手动添加"
  472. default:
  473. return "未知来源"
  474. }
  475. }
  476. // MCNUPRecommendAction .
  477. type MCNUPRecommendAction int8
  478. // const .
  479. const (
  480. // MCNUPRecommendActionOn 推荐
  481. MCNUPRecommendActionOn MCNUPRecommendAction = iota + 1
  482. // MCNUPRecommendActionBan 禁止推荐
  483. MCNUPRecommendActionBan
  484. // MCNUPRecommendActionRestore 恢复
  485. MCNUPRecommendActionRestore
  486. // MCNUPRecommendActionAdd 手动添加
  487. MCNUPRecommendActionAdd
  488. // MCNUPRecommendActionDel 移除
  489. MCNUPRecommendActionDel
  490. )
  491. // GetState .
  492. func (action MCNUPRecommendAction) GetState() MCNUPRecommendState {
  493. switch action {
  494. // MCNUPRecommendActionOn 推荐
  495. case MCNUPRecommendActionOn:
  496. return MCNUPRecommendStateOn
  497. // MCNUPRecommendActionBan 禁止推荐
  498. case MCNUPRecommendActionBan:
  499. return MCNUPRecommendStateBan
  500. // MCNUPRecommendActionRestore 恢复
  501. case MCNUPRecommendActionRestore:
  502. return MCNUPRecommendStateOff
  503. // MCNUPRecommendActionAdd 手动添加
  504. case MCNUPRecommendActionAdd:
  505. return MCNUPRecommendStateOff
  506. // MCNUPRecommendActionDel 移除
  507. case MCNUPRecommendActionDel:
  508. return MCNUPRecommendStateDel
  509. }
  510. return MCNUPRecommendStateUnKnown
  511. }
  512. func (action MCNUPRecommendAction) String() string {
  513. switch action {
  514. case MCNUPRecommendActionOn:
  515. return "推荐"
  516. case MCNUPRecommendActionBan:
  517. return "禁止推荐"
  518. case MCNUPRecommendActionRestore:
  519. return "恢复"
  520. case MCNUPRecommendActionAdd:
  521. return "手动添加"
  522. case MCNUPRecommendActionDel:
  523. return "移除"
  524. default:
  525. return ""
  526. }
  527. }
  528. // MCNUPPermissionState .
  529. type MCNUPPermissionState int8
  530. // const .
  531. const (
  532. // MCNUPPermissionStateUnKnown 未知状态
  533. MCNUPPermissionStateUnKnown MCNUPPermissionState = -1
  534. // MCNUPPermissionStateNoAuthorize 待Up主同意
  535. MCNUPPermissionStateNoAuthorize MCNUPPermissionState = 0
  536. // MCNUPStateOnRefuse Up主拒绝
  537. MCNUPPermissionStateOnRefuse MCNUPPermissionState = 1
  538. // MCNUPPermissionStateReview 待审中
  539. MCNUPPermissionStateReview MCNUPPermissionState = 2
  540. // MCNUPPermissionStatePass 已通过
  541. MCNUPPermissionStatePass MCNUPPermissionState = 3
  542. // MCNUPPermissionStateFail 已驳回
  543. MCNUPPermissionStateFail MCNUPPermissionState = 4
  544. // MCNUPPermissionStateDel 已删除
  545. MCNUPPermissionStateDel MCNUPPermissionState = 100
  546. )
  547. func (state MCNUPPermissionState) String() string {
  548. switch state {
  549. case MCNUPPermissionStateNoAuthorize:
  550. return "待Up主同意"
  551. case MCNUPPermissionStateOnRefuse:
  552. return "Up主拒绝"
  553. case MCNUPPermissionStateReview:
  554. return "待审中"
  555. case MCNUPPermissionStatePass:
  556. return "已通过"
  557. case MCNUPPermissionStateFail:
  558. return "已驳回"
  559. case MCNUPPermissionStateDel:
  560. return "已删除"
  561. default:
  562. return "未知状态"
  563. }
  564. }
  565. // MCNUPPermissionAction .
  566. type MCNUPPermissionAction int8
  567. // const .
  568. const (
  569. // MCNUPPermissionActionOn 通过
  570. MCNUPPermissionActionOn MCNUPPermissionAction = iota + 1
  571. // MCNUPPermissionActionFail 驳回
  572. MCNUPPermissionActionFail
  573. // MCNUPPermissionActionDel 移除
  574. MCNUPPermissionActionDel
  575. )
  576. // NotRightAction .
  577. func (action MCNUPPermissionAction) NotRightAction() bool {
  578. return action == MCNUPPermissionActionOn || action == MCNUPPermissionActionFail
  579. }
  580. // GetState .
  581. func (action MCNUPPermissionAction) GetState() MCNUPPermissionState {
  582. switch action {
  583. // MCNUPPermissionActionOn 通过
  584. case MCNUPPermissionActionOn:
  585. return MCNUPPermissionStatePass
  586. // MCNUPPermissionActionFail 驳回
  587. case MCNUPPermissionActionFail:
  588. return MCNUPPermissionStateFail
  589. // MCNUPPermissionActionDel 移除
  590. case MCNUPPermissionActionDel:
  591. return MCNUPPermissionStateDel
  592. }
  593. return MCNUPPermissionStateUnKnown
  594. }
  595. func (action MCNUPPermissionAction) String() string {
  596. switch action {
  597. case MCNUPPermissionActionOn:
  598. return "通过"
  599. case MCNUPPermissionActionFail:
  600. return "驳回"
  601. case MCNUPPermissionActionDel:
  602. return "移除"
  603. default:
  604. return ""
  605. }
  606. }
  607. // AttrBasePermit .
  608. type AttrBasePermit uint
  609. // const .
  610. const (
  611. AttrBasePermitBit AttrBasePermit = 0 // 基础权限
  612. AttrDataPermitBit AttrBasePermit = 1 // 数据权限
  613. AttrRecPermitBit AttrBasePermit = 2 // 推荐权限
  614. AttrDepartPermitBit AttrBasePermit = 3 // 起飞权限
  615. )
  616. // PermitMap .
  617. var PermitMap = map[AttrBasePermit]struct{}{
  618. AttrBasePermitBit: {},
  619. AttrDataPermitBit: {},
  620. AttrRecPermitBit: {},
  621. AttrDepartPermitBit: {},
  622. }
  623. func (p AttrBasePermit) String() string {
  624. switch p {
  625. case AttrBasePermitBit:
  626. return "基础权限"
  627. case AttrDataPermitBit:
  628. return "数据权限"
  629. case AttrRecPermitBit:
  630. return "推荐权限"
  631. case AttrDepartPermitBit:
  632. return "起飞权限"
  633. default:
  634. return ""
  635. }
  636. }