forked from a7a2/cp33client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathready.go
executable file
·63 lines (58 loc) · 1.36 KB
/
ready.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
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"strconv"
// "time"
"github.com/henrylee2cn/surfer"
)
func getCron(gameId string) {
var err error
var resp *http.Response
resp, err = surfer.Download(&surfer.Request{
Url: getOpenDataApiUrl + gameId,
//DownloaderID: 1,
})
if err != nil {
fmt.Println("getCron()43:", err.Error())
return
}
defer resp.Body.Close()
var b []byte
b, err = ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("getCron()50:", err.Error())
return
}
var openInfo OpenInfo
err = json.Unmarshal(b, &openInfo)
if err != nil {
fmt.Println("getCron()61:", err.Error())
return
}
if openInfo.Last_open != "" {
return
}
//fmt.Println("getCron()64:", openInfo.Last_period, " ", diffTime)
openInfo.checkIsGot(strconv.Itoa(openInfo.Last_period))
}
func (self *OpenInfo) checkIsGot(period string) {
if redisClient.Exists("Client_"+strconv.Itoa(self.Type)+"_"+strconv.Itoa(self.Last_period)).Val() == 0 { //不存在
switch self.Type {
case 1:
//fmt.Println("checkIsGot():1 ", time.Now(), " period=", period)
go cqssc_163_com(self.Type, &period)
go cqssc_cqcp_net(self.Type, &period)
case 7:
go xzssc_xjflcp_com(self.Type, &period)
case 9:
go pk10_bwlc_net(self.Type, &period)
case 4:
go tjssc_icaile_com(self.Type, &period)
default:
fmt.Println("checkIsGot():default")
}
}
}