• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang member.ValueMember类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中go2o/src/core/domain/interface/member.ValueMember的典型用法代码示例。如果您正苦于以下问题:Golang ValueMember类的具体用法?Golang ValueMember怎么用?Golang ValueMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ValueMember类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: PostRegisterInfo_post

func (this *UserC) PostRegisterInfo_post(ctx *web.Context) {
	ctx.Request.ParseForm()
	var member member.ValueMember
	web.ParseFormToEntity(ctx.Request.Form, &member)
	if i := strings.Index(ctx.Request.RemoteAddr, ":"); i != -1 {
		member.RegIp = ctx.Request.RemoteAddr[:i]
	}

	var memberId int
	var err error

	if len(member.Usr) == 0 || len(member.Pwd) == 0 {
		err = errors.New("注册信息不完整")
	} else {
		member.Pwd = domain.Md5MemberPwd(member.Usr, member.Pwd)
		memberId, err = dps.MemberService.SaveMember(&member)
		if err == nil {
			invId := dps.MemberService.GetMemberIdByInvitationCode(ctx.Request.FormValue("inviCode"))
			err = dps.MemberService.SaveRelation(memberId, "", invId,
				this.BaseC.GetPartnerId(ctx))
		}
	}

	if err != nil {
		this.BaseC.ResultOutput(ctx, gof.Message{Message: "注册失败!错误:" + err.Error()})
	} else {
		this.BaseC.ResultOutput(ctx, gof.Message{Result: true})
	}
}
开发者ID:linux-mac,项目名称:go2o,代码行数:29,代码来源:user_c.go


示例2: validate

func (this *Member) validate(v *member.ValueMember) error {
	v.Usr = strings.ToLower(strings.TrimSpace(v.Usr)) // 小写并删除空格
	v.Name = strings.TrimSpace(v.Name)
	v.Email = strings.ToLower(strings.TrimSpace(v.Email))
	v.Phone = strings.TrimSpace(v.Phone)

	if len([]rune(v.Usr)) < 6 {
		return member.ErrUserLength
	}
	if !userRegex.MatchString(v.Usr) {
		return member.ErrUserValidErr
	}

	if this.GetAggregateRootId() != 0 && len([]rune(v.Name)) < 2 {
		return member.ErrPersonName
	}

	if len(v.Email) != 0 && !emailRegex.MatchString(v.Email) {
		return member.ErrEmailValidErr
	}
	if len(v.Phone) != 0 && !phoneRegex.MatchString(v.Phone) {
		return member.ErrPhoneValidErr
	}
	if len(v.Qq) != 0 && !qqRegex.MatchString(v.Qq) {
		return member.ErrQqValidErr
	}
	return nil
}
开发者ID:zoe527,项目名称:go2o,代码行数:28,代码来源:member.go


示例3: RegisterMember

func (this *Partner) RegisterMember(m *jsv.Args, r *jsv.Result) error {

	var err error

	e := member.ValueMember{}

	if err = jsv.UnmarshalMap((*m)["json"], &e); err != nil {
		return err
	}
	var cardId string
	var tgId int
	var partnerId int

	cardId = (*m)["card_id"].(string)
	tgId, _ = strconv.Atoi((*m)["tg_id"].(string))
	partnerId, _ = strconv.Atoi((*m)["partner_id"].(string))

	//如果卡片ID为空时,自动生成
	if cardId == "" {
		cardId = time.Now().Format("200601021504")
	}
	e.RegFrom = "WEB"

	e.Pwd = domain.MemberSha1Pwd(e.Pwd)
	id, err := dps.MemberService.SaveMember(&e)

	if err == nil {
		dps.MemberService.SaveRelation(id, cardId, tgId, partnerId)
		r.Result = true
		return nil
	}
	return err
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:33,代码来源:partner.go


示例4: PostRegisterInfo_post

func (this *UserC) PostRegisterInfo_post(ctx *web.Context) {
	ctx.Request.ParseForm()
	var result gof.Message
	var member member.ValueMember

	web.ParseFormToEntity(ctx.Request.Form, &member)
	code := ctx.Request.FormValue("invi_code")

	if i := strings.Index(ctx.Request.RemoteAddr, ":"); i != -1 {
		member.RegIp = ctx.Request.RemoteAddr[:i]
	}

	var memberId int
	var partnerId int
	var err error

	partnerId = this.GetPartnerId(ctx)
	if len(member.Usr) == 0 || len(member.Pwd) == 0 {
		result.Message = "1000:注册信息不完整"
		ctx.Response.JsonOutput(result)
		return
	}

	if err = dps.PartnerService.CheckRegisterMode(partnerId, code); err != nil {
		result.Message = err.Error()
		ctx.Response.JsonOutput(result)
		return
	}

	var invId int
	if len(code) > 0 {
		invId = dps.MemberService.GetMemberIdByInvitationCode(code)
		if invId <= 0 {
			result.Message = "1011:推荐码不正确"
			ctx.Response.JsonOutput(result)
			return
		}
	}

	member.Pwd = domain.MemberSha1Pwd(member.Pwd)
	memberId, err = dps.MemberService.SaveMember(&member)
	if err == nil {
		err = dps.MemberService.SaveRelation(memberId, "", invId, partnerId)
	}

	if err != nil {
		result.Message = err.Error()
	} else {
		result.Result = true
	}
	ctx.Response.JsonOutput(result)
}
开发者ID:zoe527,项目名称:go2o,代码行数:52,代码来源:user_c.go


示例5: SetValue

// 设置值
func (this *Member) SetValue(v *member.ValueMember) error {
	v.Usr = this._value.Usr
	if err := this.validate(v); err != nil {
		return err
	}
	this._value.Address = v.Address
	this._value.Birthday = v.Birthday
	this._value.Qq = v.Qq
	this._value.Email = v.Email
	this._value.LastLoginTime = v.LastLoginTime
	this._value.Phone = v.Phone
	this._value.Pwd = v.Pwd
	this._value.Name = v.Name
	this._value.Sex = v.Sex
	this._value.RegFrom = v.RegFrom
	if v.Avatar != "" {
		this._value.Avatar = v.Avatar
	}
	if len(this._value.InvitationCode) == 0 {
		this._value.InvitationCode = v.InvitationCode
	}

	if len(v.TradePwd) == 0 {
		this._value.TradePwd = v.TradePwd
	}

	if len(this._value.Qq) != 0 && len(this._value.Email) != 0 &&
		len(this._value.Birthday) != 0 && len(this._value.Address) != 0 &&
		len(this._value.Phone) != 0 && len(this._value.Avatar) != 0 &&
		this._value.Sex != 0 {
		this.notifyOnProfileComplete()
	}
	return nil
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:35,代码来源:member.go


示例6: Register

// 注册
func (this *MemberC) Register(ctx *web.Context) {
	if this.BaseC.Requesting(ctx) {
		r := ctx.Request
		var result dto.MessageResult

		var partnerId int = this.GetPartnerId(ctx)
		var invMemberId int // 邀请人
		var usr string = r.FormValue("usr")
		var pwd string = r.FormValue("pwd")
		var registerFrom string = r.FormValue("reg_from")          // 注册来源
		var invitationCode string = r.FormValue("invitation_code") // 推荐码
		var regIp string
		if i := strings.Index(r.RemoteAddr, ":"); i != -1 {
			regIp = r.RemoteAddr[:i]
		}

		fmt.Println(usr, pwd, "REGFROM:", registerFrom, "INVICODE:", invitationCode)

		// 检验
		if len(invitationCode) != 0 {
			invMemberId = dps.MemberService.GetMemberIdByInvitationCode(invitationCode)
			if invMemberId == 0 {
				result.Message = "推荐/邀请人不存在!"
				ctx.Response.JsonOutput(result)
				return
			}
		}

		var member member.ValueMember
		member.Usr = usr
		member.Pwd = domain.MemberSha1Pwd(pwd)
		member.RegIp = regIp
		member.RegFrom = registerFrom

		memberId, err := dps.MemberService.SaveMember(&member)
		if err == nil {
			result.Result = true
			err = dps.MemberService.SaveRelation(memberId, "-", invMemberId, partnerId)
		}

		if err != nil {
			result.Message = err.Error()
		}

		ctx.Response.JsonOutput(result)
	}
}
开发者ID:jackyan,项目名称:go2o,代码行数:48,代码来源:member_c.go


示例7: Profile_post

func (this *basicC) Profile_post(ctx *web.Context) {
	mm := this.GetMember(ctx)
	r := ctx.Request
	var result gof.Message
	r.ParseForm()
	clientM := new(member.ValueMember)
	web.ParseFormToEntity(r.Form, clientM)
	clientM.Id = mm.Id
	_, err := dps.MemberService.SaveMember(clientM)

	if err != nil {
		result = gof.Message{Result: false, Message: err.Error()}
	} else {
		result = gof.Message{Result: true}
	}
	ctx.Response.JsonOutput(result)
}
开发者ID:sunxboy,项目名称:go2o,代码行数:17,代码来源:basic_c.go


示例8: Profile_post

func (this *basicC) Profile_post(ctx *web.Context) {
	mm := this.GetMember(ctx)
	r, w := ctx.Request, ctx.ResponseWriter
	var result gof.Message
	r.ParseForm()
	clientM := new(member.ValueMember)
	web.ParseFormToEntity(r.Form, clientM)
	clientM.Id = mm.Id
	_, err := goclient.Member.SaveMember(clientM, mm.DynamicToken)

	if err != nil {
		result = gof.Message{Result: false, Message: err.Error()}
	} else {
		result = gof.Message{Result: true}
	}
	w.Write(result.Marshal())
}
开发者ID:honj51,项目名称:go2o,代码行数:17,代码来源:basic_c.go


示例9: Profile_post

func (this *basicC) Profile_post(ctx *web.Context) {
	mm := this.GetMember(ctx)
	r := ctx.Request
	var result gof.Message
	r.ParseForm()
	m := new(member.ValueMember)
	web.ParseFormToEntity(r.Form, m)
	m.Id = mm.Id
	_, err := dps.MemberService.SaveMember(m)

	if err != nil {
		result.Message = err.Error()
	} else {
		result.Result = true
		this.ReCacheMember(ctx, m.Id)
	}
	ctx.Response.JsonOutput(result)
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:18,代码来源:basic_c.go


示例10: PostRegisterInfo_post

func (this *userC) PostRegisterInfo_post(ctx *web.Context) {
	r, w := ctx.Request, ctx.Response
	p := this.GetPartner(ctx)
	r.ParseForm()
	var member member.ValueMember
	web.ParseFormToEntity(r.Form, &member)
	if i := strings.Index(r.RemoteAddr, ":"); i != -1 {
		member.RegIp = r.RemoteAddr[:i]
	}
	b, err := goclient.Partner.RegisterMember(&member, p.Id, 0, "")
	if b {
		w.Write([]byte(`{"result":true}`))
	} else {
		if err != nil {
			w.Write([]byte(fmt.Sprintf(`{"result":false,"message":"%s"}`, err.Error())))
		} else {
			w.Write([]byte(`{"result":false}`))
		}

	}
}
开发者ID:AlwaysOnline,项目名称:go2o,代码行数:21,代码来源:user_c.go


示例11: SaveMember

func (this *Member) SaveMember(m *jsv.Args, r *jsv.Result) error {
	memberId, err := Verify(m)
	if err != nil {
		return err
	}

	var e member.ValueMember
	err = jsv.UnmarshalMap((*m)["json"], &e)
	if err != nil {
		return err
	}
	e.Id = memberId
	_, err = dps.MemberService.SaveMember(&e)

	if err != nil {
		jsv.LogErr(err)
		r.Message = err.Error()
	} else {
		r.Result = true
	}
	return nil
}
开发者ID:qinchong1988,项目名称:go2o,代码行数:22,代码来源:member.go


示例12: create

// 创建会员
func (this *Member) create(m *member.ValueMember) (int, error) {
	if this.UsrIsExist() {
		return -1, errors.New("用户名已经被使用")
	}
	t := time.Now().Unix()
	m.State = 1
	m.RegTime = t
	m.LastLoginTime = t
	m.Level = 1
	m.Exp = 1
	m.Avatar = "resource/no_avatar.gif"
	m.Birthday = "1970-01-01"
	m.DynamicToken = m.Pwd
	m.Exp = 0

	if len(m.RegFrom) == 0 {
		m.RegFrom = "API-INTERNAL"
	}

	// 如果昵称为空,则跟用户名相同
	if len(m.Name) == 0 {
		m.Name = m.Usr
	}
	m.InvitationCode = this.generateInvitationCode() // 创建一个邀请码

	id, err := this._rep.SaveMember(m)
	if id != 0 {
		this._value.Id = id
	}
	return id, err
}
开发者ID:kevinhuo88888,项目名称:go2o,代码行数:32,代码来源:member.go



注:本文中的go2o/src/core/domain/interface/member.ValueMember类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang partner.IPartner类代码示例发布时间:2022-05-28
下一篇:
Golang member.IMember类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap