icesimba.mall.go 2.32 KB
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! ")
}
*/