示例#1
0
func main() {
	p := pager.NewUrlPager(10, 1, nil)
	fmt.Println(p.PagerString())
	fmt.Println("--------------------------")

	p = pager.NewUrlPager(0, 0, nil)
	fmt.Println(p.PagerString())
	fmt.Println("--------------------------")
	p = pager.NewUrlPager(10, 10, nil)
	fmt.Println(p.PagerString())

	fmt.Println("--------------------------")
	p = pager.NewUrlPager(10, 9, nil)
	fmt.Println(p.PagerString())

	return

	context := glob.NewContext()
	goclient.Configure("tcp", ":"+context.Config().GetString(variable.SocketPort), context)
	context.DebugMode = true
	jsv.Configure(context)

	//fmt.Println(ording.NewSecret(101))

	go testRegister()
	go testPartner()
	go testSubmitOrder()

	testMemberLogin()
	for {
		time.Sleep(10 * time.Second)
		go testMemberLogin()
	}
}
示例#2
0
文件: server.go 项目: zoe527/go2o
//正在服务器上拿数据
func ServerListen(n, host string, c gof.App) {
	context = c
	jsv.Configure(c)
	serve := jsv.NewServer()
	serve.RegisterName("Member", &server.Member{})
	serve.RegisterName("Partner", &server.Partner{})

	addr, err := net.ResolveTCPAddr(n, host)
	checkErr(err)

	lis, err := net.ListenTCP(n, addr)
	checkErr(err)

	for {
		conn, err := lis.Accept()
		if err != nil {
			context.Log().Println("[ ERROR]:", err.Error())
			continue
		}
		// set timeout
		t := time.Now().Add(5 * time.Minute)
		conn.SetDeadline(t)

		go receiveConn(conn, serve)
	}
}
示例#3
0
文件: client.go 项目: zoe527/go2o
func Configure(net, addr string, c gof.App) {
	var err error
	_conn, err = jsv.Dial(net, addr)

	if err != nil {
		fmt.Println("[TCP]: Connect Refused,", addr)
		os.Exit(1)
	}

	jsv.Configure(c)
	Member = &memberClient{conn: _conn}
	Partner = &partnerClient{conn: _conn}
	Redirect = &redirectClient{conn: _conn}
}