MCPcopy Create free account
hub / github.com/Ayin-a/hk4e / getClientVersionByName

Method getClientVersionByName

dispatch/controller/dispatch_controller.go:39–67  ·  view source on GitHub ↗
(versionName string)

Source from the content-addressed store, hash-verified

37}
38
39func (c *Controller) getClientVersionByName(versionName string) (int, string) {
40 reg, err := regexp.Compile("[0-9]+")
41 if err != nil {
42 logger.Error("compile regexp error: %v", err)
43 return 0, ""
44 }
45 versionSlice := reg.FindAllString(versionName, -1)
46 version := 0
47 for index, value := range versionSlice {
48 v, err := strconv.Atoi(value)
49 if err != nil {
50 logger.Error("parse client version error: %v", err)
51 return 0, ""
52 }
53 if v >= 10 {
54 // 测试版本
55 if index != 2 {
56 logger.Error("invalid client version")
57 return 0, ""
58 }
59 v /= 10
60 }
61 for i := 0; i < 2-index; i++ {
62 v *= 10
63 }
64 version += v
65 }
66 return version, strconv.Itoa(version)
67}
68
69func (c *Controller) queryCurRegion(context *gin.Context) {
70 rspError := func() {

Callers 1

queryCurRegionMethod · 0.95

Calls 1

ErrorFunction · 0.92

Tested by

no test coverage detected