Exemplo n.º 1
0
Arquivo: test.go Projeto: honj51/go2o
func main() {

	fmt.Println(domain.Md5PartnerPwd("wzo2o", "12345"))

	fmt.Println(domain.NewApiId(105))
	fmt.Println(domain.Md5MemberPwd("u1000", "123456"))
	fmt.Println(1 << 2)
}
Exemplo n.º 2
0
Arquivo: test.go Projeto: xianmau/go2o
func main() {

	fmt.Println(domain.Md5PartnerPwd("wzo2o", "12345"))

	fmt.Println(domain.NewApiId(105))
	fmt.Println(domain.Md5MemberPwd("u1000", "123456"))
	fmt.Println(1 << 2)
	fmt.Println(util.IsMobileAgent("Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"))
}
Exemplo n.º 3
0
func main() {

	fmt.Println(domain.Md5PartnerPwd("wzo2o", "12345"))

	fmt.Println(domain.NewApiId(105))
	fmt.Println(domain.Md5MemberPwd("123456"))
	fmt.Println(1 << 2)
	fmt.Println(util.IsMobileAgent("Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"))

	tagRegexp := regexp.MustCompile("\\s*([^:\\|]+):([^:\\|]+)\\s*\\|*")
	matches := tagRegexp.FindAllStringSubmatch("G1:10|G2:12|G3:14", -1)
	for i := 0; i < len(matches); i++ {
		fmt.Println(i, "---", matches[i][1], matches[i][2])
	}
}
Exemplo n.º 4
0
// 创建商户
func (this *Partner) createPartner() (int, error) {
	if id := this.GetAggregateRootId(); id > 0 {
		return id, nil
	}

	v := this._value
	id, err := this._rep.SavePartner(v)
	if err != nil {
		return id, err
	}

	//todo:事务

	// 初始化商户信息
	this._value.Id = id

	// SiteConf
	this._siteConf = &partner.SiteConf{
		IndexTitle: "线上商店-" + v.Name,
		SubTitle:   "线上商店-" + v.Name,
		Logo:       v.Logo,
		State:      1,
		StateHtml:  "",
	}
	err = this._rep.SaveSiteConf(id, this._siteConf)
	this._siteConf.PartnerId = id

	// SaleConf
	this._saleConf = &partner.SaleConf{
		AutoSetupOrder:  1,
		IntegralBackNum: 0,
	}
	err = this._rep.SaveSaleConf(id, this._saleConf)
	this._saleConf.PartnerId = id

	// 创建API
	this._apiInfo = &partner.ApiInfo{
		ApiId:     domain.NewApiId(id),
		ApiSecret: domain.NewSecret(id),
		WhiteList: "*",
		Enabled:   1,
	}
	err = this._rep.SaveApiInfo(id, this._apiInfo)

	return id, err
}
Exemplo n.º 5
0
func main() {
	fmt.Println(crypto.Sha1([]byte("rskd3p")))
	fmt.Println(domain.PartnerSha1Pwd("zs", "gcY!zs1654320s"))

	fmt.Println(domain.NewApiId(105))
	fmt.Println(domain.MemberSha1Pwd("jumy257"))
	fmt.Println(1 << 2)
	fmt.Println(util.IsMobileAgent("Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"))

	tagRegexp := regexp.MustCompile("\\s*([^:\\|]+):([^:\\|]+)\\s*\\|*")
	matches := tagRegexp.FindAllStringSubmatch("G1:10|G2:12|G3:14", -1)
	for i := 0; i < len(matches); i++ {
		fmt.Println(i, "---", matches[i][1], matches[i][2])
	}

	fmt.Println("/main/change_device?device=3&return_url=/main/t/123" +
		url.QueryEscape("?return_url=/app"))
}