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")) }
func (c *partnerC) CreatePartner_post(ctx *web.Context) { r, w := ctx.Request, ctx.Response 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.PartnerSha1Pwd(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 { // 初始化商户信息 } } w.Write(result.Marshal()) }