-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.go
80 lines (74 loc) · 1.48 KB
/
main.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
package main
import (
"NetopGO/models"
_ "NetopGO/routers"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
"time"
)
func init() {
models.RegisterDB()
orm.RunSyncdb("default", true, true)
}
func main() {
orm.Debug = true
o := orm.NewOrm()
// psw := "nbs2010"
// encode := models.Base64Encode([]byte(psw))
// beego.Info(string(encode))
// decode, _ := models.Base64Decode(encode)
// beego.Info(string(decode))
passwd := string(models.Base64Encode([]byte("nbs2010")))
admin := &models.User{
Name: "admin",
Passwd: passwd,
Email: "[email protected]",
Dept: "op",
Created: time.Now(),
Auth: 1,
Tel: "18202808939",
}
o.Insert(admin)
dba := &models.User{
Name: "dba",
Passwd: passwd,
Email: "[email protected]",
Dept: "op",
Created: time.Now(),
Auth: 2,
Tel: "18202808939",
}
o.Insert(dba)
guest := &models.User{
Name: "guest",
Passwd: passwd,
Email: "[email protected]",
Dept: "op",
Created: time.Now(),
Auth: 3,
Tel: "18202808939",
}
o.Insert(guest)
host := &models.Host{
Name: "ucd-ty-ice-log-1",
Ip: "192.168.2.17",
Cpu: "4核",
Mem: "8GB",
Disk: "1TB",
Idc: "Ucloud",
Rootpwd: passwd,
Readpwd: passwd,
Group: "flume",
Created: time.Now(),
}
o.Insert(host)
group := &models.Group{
Name: "flume",
Conment: "flume",
Created: time.Now(),
}
o.Insert(group)
// str := "nbs2010"
// beego.Info(models.Md5Encode([]byte(str)))
beego.Run()
}