-
Notifications
You must be signed in to change notification settings - Fork 1
/
tool.go
executable file
·94 lines (78 loc) · 2.12 KB
/
tool.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package agora
import (
"fmt"
"math"
)
const pageSize = 4
const pageSize8 = 8
// GetPageSize method
func GetPageSize(isDualCamera int8) int {
if isDualCamera == 1 {
return pageSize
} else {
return pageSize8
}
}
// GetTotalPage method.
func GetTotalPage(total int, isDualCamera int8) int8 {
if isDualCamera == 1 {
return int8(math.Ceil(float64(total) / float64(pageSize)))
} else {
return int8(math.Ceil(float64(total) / float64(pageSize8)))
}
}
// GetWrittenMeetingNo - 获取笔试考场id
func GetWrittenMeetingNo(env string, examroomID uint, uids []uint, uid uint, isDualCamera int8) string {
// w
pos := int(0)
for _idx, _uid := range uids {
if _uid == uid {
pos = _idx + 1
break
}
}
pageN := GetTotalPage(pos, isDualCamera)
return ToWrittenMeetingNo(env, examroomID, pageN)
}
// GetInviteMeetingNo - 获取面试候考区考场id
func GetInviteMeetingNo(env string, examroomID uint, uids []uint, uid uint, isDualCamera int8) string {
// w
pos := int(0)
for _idx, _uid := range uids {
if _uid == uid {
pos = _idx + 1
break
}
}
pageN := GetTotalPage(pos, isDualCamera)
return ToInviteMeetingNo(env, examroomID, pageN)
}
// ToWrittenMeetingNo - 拼接笔试考场id
func ToWrittenMeetingNo(env string, examroomID uint, pageN int8) string {
return fmt.Sprintf("%s_w_%d_%d", env, examroomID, pageN)
}
// 拼接面试候考区考场id
func ToInviteMeetingNo(env string, examroomID uint, pageN int8) string {
return fmt.Sprintf("%s_c_%d_%d", env, examroomID, pageN)
}
// GetMeetingNo - 获取考场id
func GetMeetingNo(env string, id uint) string {
// m
return fmt.Sprintf("%s_m_%d", env, id)
}
// GetCandidateMeetingNo - 获取侯考场id
func GetCandidateMeetingNo(env string, id uint) string {
return fmt.Sprintf("%s_c_%d", env, id)
}
// GetExamineeIDStr - 获取考生idstr
func GetExamineeIDStr(uid uint) string {
return fmt.Sprintf("10%d", uid)
}
// GetCandidateExamineeIDStr - 获取考生idstr
func GetCandidateExamineeIDStr(uid uint) string {
return fmt.Sprintf("11%d", uid)
}
// GetServerIDStr - 获取服务端id,用于录制
func GetServerIDStr() string {
return fmt.Sprintf("90")
}