Exemple #1
0
func main() {

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

	fmt.Println(domain.NewApiId(105))
	fmt.Println(domain.Md5MemberPwd("u1000", "123456"))
	fmt.Println(1 << 2)
}
Exemple #2
0
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"))
}
Exemple #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])
	}
}
Exemple #4
0
func (c *partnerC) CreatePartner_post(ctx *web.Context) {
	r, w := ctx.Request, ctx.ResponseWriter
	var result gof.Message
	var isCreate bool
	r.ParseForm()

	partner := partner.ValuePartner{}
	web.ParseFormToEntity(r.Form, &partner)

	dt := time.Now()
	anousPwd := strings.Repeat("*", 10) //匿名密码
	if len(partner.Pwd) != 0 && partner.Pwd != anousPwd {
		partner.Pwd = domain.Md5PartnerPwd(partner.Usr, partner.Pwd)
	}

	//更新
	if partner.Id > 0 {
		original, _ := dps.PartnerService.GetPartner(partner.Id)
		partner.JoinTime = original.JoinTime
		partner.ExpiresTime = original.ExpiresTime
		partner.UpdateTime = dt.Unix()

		if partner.Pwd == anousPwd {
			partner.Pwd = original.Pwd
		}
	} else {
		partner.JoinTime = dt.Unix()
		partner.ExpiresTime = dt.AddDate(10, 0, 0).Unix()
		partner.UpdateTime = dt.Unix()
		isCreate = true
	}

	id, err := dps.PartnerService.SavePartner(partner.Id, &partner)
	if err != nil {
		result.Message = err.Error()
	} else {
		result.Data = id
		result.Result = true
		if isCreate {
			// 初始化商户信息
			dps.PartnerService.InitDefaultLevels(id) // 初始化等级
			dps.SaleService.InitSaleTags(id)         // 初始化销售标签
		}
	}
	w.Write(result.Marshal())
}
Exemple #5
0
func (this *loginSession) AdministratorLogin(w http.ResponseWriter, usr string, pwd string) bool {
	loginTokenResult := domain.Md5PartnerPwd(usr, pwd)
	loginResult := loginTokenResult == ctx.App.Config().GetString("master_token")

	if loginResult {

		//存入cookie
		expires := time.Now()
		expires = expires.Add(3600 * 72 * 1e9) //72H
		cookie := http.Cookie{Name: "mtkey",
			Value:   loginTokenResult,
			Expires: expires}
		http.SetCookie(w, &cookie)
		web.Seria2json(w, true, "", nil)
		return true
	}
	return false
}
Exemple #6
0
// 验证用户密码并返回编号
func (this *partnerService) Verify(usr, pwd string) int {
	ep := domain.Md5PartnerPwd(usr, pwd)
	return this._query.Verify(usr, ep)
}