icesimba.mall.go
2.32 KB
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
95
96
97
package main
import (
"common"
"flag"
"fmt"
//"crypto/md5"
//"encoding/hex"
//"fmt"
//"time"
. "client/icesimba.mall/apis"
db "client/icesimba.mall/database"
)
func main() {
// defer db.SqlDB.Close()
//config := common.NewConfig("/root/sdkPlatform/bin/sdkRoute.conf")
configPath := flag.String("config", "./sdkRoute.conf", "config path")
flag.Parse()
fmt.Printf("config[%v]", *configPath)
config := common.NewConfig(*configPath)
//数据库
db.Init(config.DBMysql)
sdkhttp := common.NewHttp(config)
sdkhttp.RegisterFunc("QueryMalls", QueryMallsByGameIdApi)
//sdkhttp.RegisterFunc("InsertOrUpdateMall", InsertOrUpdateMallApi)
sdkhttp.RegisterFunc("QueryGoodsInMall", QueryGoodsByMallIdApi)
//sdkhttp.RegisterFunc("InsertOrUpdateGoods", InsertOrUpdateGoodsApi)
sdkhttp.RegisterFunc("QueryProps", QueryPropsOfGoodsApi)
sdkhttp.Activate("icesimba.mall")
}
//MD5加密
// md5Ctx := md5.New()
// md5Ctx.Write([]byte("test"))
// cipherStr := md5Ctx.Sum(nil)
// fmt.Print(cipherStr)
// fmt.Print("\n")
// fmt.Print(hex.EncodeToString(cipherStr))
// var start string
// _ = db.SqlDB.QueryRow("select starttime from ice_reward_user where userid=1").Scan(
// &start,
// )
// fmt.Println("start", start)
//测试输出时间
// fmt.Println("Unix...", time.Now().Unix())
// fmt.Println("Mill...", time.Now().UnixNano()/1000000)
// fmt.Println("UnixNano...", time.Now().UnixNano())
// fmt.Println("Nanosecond...", time.Now().Nanosecond())
// t, _ := time.Parse("2006-01-02 15:04:05", "2017-07-26 10:37:47")
// fmt.Println("t...", t.Local())
// fmt.Println("utc...", time.Now().Local())
// stmt, _ := db.SqlDB.Prepare("update ice_reward_user set starttime=? where userid=1")
// _, _ = stmt.Exec(
// time.Local,
// )
// _ = db.SqlDB.QueryRow("select starttime from ice_reward_user where userid=1").Scan(
// &start,
// )
// fmt.Println("start", start)
/*
package main
import (
"fmt"
"reflect"
)
func main() {
ice := &User{"icesimba", 100}
v := reflect.ValueOf(ice)
e := object.Elem()
t := e.Type()
for i := 0; i < e.NumField(); i++ {
field := e.Field(i)
fmt.Printf("%d. %s %s = %v \n", i, t.Field(i).Name, field.Type(), field.Interface())
}
ice.Say()
mbn := v.MethodByName("Say")
mbn.Call([]reflect.Value{})
}
type User struct {
Name string
Age int
}
func (u *User) Say() {
fmt.Println("I'm " + u.Name + ". Nice to meet you! ")
}
*/