当前位置: 首页>>代码示例>>Golang>>正文


Golang Message.Message方法代码示例

本文整理汇总了Golang中github.com/jsix/gof.Message.Message方法的典型用法代码示例。如果您正苦于以下问题:Golang Message.Message方法的具体用法?Golang Message.Message怎么用?Golang Message.Message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/jsix/gof.Message的用法示例。


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

示例1: Charge_post

func (this *memberC) Charge_post(ctx *web.Context) {
	var msg gof.Message
	var err error
	ctx.Request.ParseForm()
	partnerId := this.GetPartnerId(ctx)
	memberId, _ := strconv.Atoi(ctx.Request.FormValue("MemberId"))
	amount, _ := strconv.ParseFloat(ctx.Request.FormValue("Amount"), 32)
	if amount < 0 {
		msg.Message = "error amount"
	} else {
		rel := dps.MemberService.GetRelation(memberId)

		if rel.RegisterPartnerId != this.GetPartnerId(ctx) {
			err = partner.ErrPartnerNotMatch
		} else {
			title := fmt.Sprintf("客服充值%f", amount)
			err = dps.MemberService.Charge(partnerId, memberId, member.TypeBalanceServiceCharge, title, "", float32(amount))
		}
		if err != nil {
			msg.Message = err.Error()
		} else {
			msg.Result = true
		}
	}
	ctx.Response.JsonOutput(msg)
}
开发者ID:zoe527,项目名称:go2o,代码行数:26,代码来源:member_c.go

示例2: 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

示例3: Reset_pwd_post

func (this *memberC) Reset_pwd_post(ctx *web.Context) {
	var result gof.Message
	ctx.Request.ParseForm()
	memberId, _ := strconv.Atoi(ctx.Request.FormValue("member_id"))
	rl := dps.MemberService.GetRelation(memberId)
	partnerId := this.GetPartnerId(ctx)
	if rl == nil || rl.RegisterPartnerId != partnerId {
		result.Message = "无权进行当前操作"
	} else {
		newPwd := dps.MemberService.ResetPassword(memberId)
		result.Result = true
		result.Message = fmt.Sprintf("重置成功,新密码为: %s", newPwd)
	}
	ctx.Response.JsonOutput(result)
}
开发者ID:zoe527,项目名称:go2o,代码行数:15,代码来源:member_c.go

示例4: Convert_f2p_post

func (this *accountC) Convert_f2p_post(ctx *web.Context) {
	var msg gof.Message
	var err error
	ctx.Request.ParseForm()
	partnerId := this.GetPartner(ctx).Id
	amount, _ := strconv.ParseFloat(ctx.Request.FormValue("Amount"), 32)
	tradePwd := ctx.Request.FormValue("TradePwd")
	saleConf := dps.PartnerService.GetSaleConf(partnerId)

	memberId := this.GetMember(ctx).Id

	if _, err = dps.MemberService.VerifyTradePwd(memberId, tradePwd); err == nil {
		err = dps.MemberService.TransferFlow(memberId, member.KindBalancePresent,
			float32(amount), saleConf.FlowConvertCsn, domain.NewTradeNo(partnerId),
			fmt.Sprintf("%s转换", variable.AliasFlowAccount),
			fmt.Sprintf("%s转换%s", variable.AliasFlowAccount, variable.AliasPresentAccount))
	}

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

示例5: 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)
	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.MemberSha1Pwd(member.Pwd)
		memberId, err = dps.MemberService.SaveMember(&member)
		if err == nil {
			invId := dps.MemberService.GetMemberIdByInvitationCode(ctx.Request.FormValue("invi_code"))
			err = dps.MemberService.SaveRelation(memberId, "", invId,
				this.BaseC.GetPartnerId(ctx))
		}
	}

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

示例6: Transfer_f2m_post

func (this *accountC) Transfer_f2m_post(ctx *web.Context) {
	var msg gof.Message
	var err error
	ctx.Request.ParseForm()
	form := ctx.Request.Form
	partnerId := this.GetPartner(ctx).Id
	toMemberId, _ := strconv.Atoi(form.Get("ToId"))
	amount, _ := strconv.ParseFloat(form.Get("Amount"), 32)
	tradePwd := form.Get("TradePwd")
	saleConf := dps.PartnerService.GetSaleConf(partnerId)
	memberId := this.GetMember(ctx).Id

	if toMemberId == memberId {
		err = errors.New("无法转账到自己账号")
	} else {
		if _, err = dps.MemberService.VerifyTradePwd(memberId, tradePwd); err == nil {
			err = dps.MemberService.TransferFlowTo(memberId, toMemberId, member.KindBalanceFlow,
				float32(amount), saleConf.TransCsn, domain.NewTradeNo(partnerId),
				variable.AliasFlowAccount+"转账", "转入"+variable.AliasFlowAccount)
		}
	}

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

示例7: Profile_post

func (this *configC) Profile_post(ctx *web.Context) {
	partnerId := this.GetPartnerId(ctx)
	r, w := ctx.Request, ctx.Response
	var result gof.Message
	r.ParseForm()

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

	//更新
	origin, _ := dps.PartnerService.GetPartner(partnerId)
	e.ExpiresTime = origin.ExpiresTime
	e.JoinTime = origin.JoinTime
	e.LastLoginTime = origin.LastLoginTime
	e.LoginTime = origin.LoginTime
	e.Pwd = origin.Pwd
	e.UpdateTime = time.Now().Unix()
	e.Id = partnerId

	id, err := dps.PartnerService.SavePartner(partnerId, &e)

	if err != nil {
		result.Message = err.Error()
	} else {
		result.Result = true
		result.Data = id
	}
	w.Write(result.Marshal())
}
开发者ID:zoe527,项目名称:go2o,代码行数:29,代码来源:config_c.go

示例8: Save_coupon_post

// 保存优惠券
func (this *promC) Save_coupon_post(ctx *web.Context) {
	partnerId := this.GetPartnerId(ctx)
	r := ctx.Request
	r.ParseForm()

	var result gof.Message

	e := promotion.ValuePromotion{}
	web.ParseFormToEntity(r.Form, &e)
	e2 := promotion.ValueCoupon{}
	web.ParseFormToEntity(r.Form, &e2)

	e.PartnerId = partnerId
	e.TypeFlag = promotion.TypeFlagCoupon

	const layout string = "2006-01-02 15:04:05"
	bt, _ := time.Parse(layout, r.FormValue("BeginTime"))
	ot, _ := time.Parse(layout, r.FormValue("OverTime"))
	e2.BeginTime = bt.Unix()
	e2.OverTime = ot.Unix()

	id, err := dps.PromService.SaveCoupon(partnerId, &e, &e2)

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

示例9: Save_cb_post

// 保存现金返现
func (this *promC) Save_cb_post(ctx *web.Context) {
	partnerId := this.GetPartnerId(ctx)
	r := ctx.Request
	r.ParseForm()

	var result gof.Message

	e := promotion.ValuePromotion{}
	web.ParseFormToEntity(r.Form, &e)
	e2 := promotion.ValueCashBack{}
	web.ParseFormToEntity(r.Form, &e2)

	e.PartnerId = partnerId
	e.TypeFlag = promotion.TypeFlagCashBack

	id, err := dps.PromService.SaveCashBackPromotion(partnerId, &e, &e2)

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

示例10: Login_post

func (this *mainC) Login_post(ctx *web.Context) {
	r := ctx.Request
	var msg gof.Message
	r.ParseForm()
	usr, pwd := r.Form.Get("uid"), r.Form.Get("pwd")

	if domain.Md5Pwd(pwd, usr) == ctx.App.Config().GetString("webmaster_valid_md5") {
		ctx.Session().Set("master_id", 1)
		if err := ctx.Session().Save(); err != nil {
			msg.Message = err.Error()
		} else {
			msg.Result = true
		}
	} else {
		msg.Message = "用户或密码不正确!"
	}
	ctx.Response.Write(msg.Marshal())
}
开发者ID:zoe527,项目名称:go2o,代码行数:18,代码来源:main_c.go

示例11: Disconnect

// 断开
func (this *MemberC) Disconnect(ctx *web.Context) {
	var result gof.Message
	if util.MemberHttpSessionDisconnect(ctx) {
		result.Result = true
	} else {
		result.Message = "disconnect fail"
	}
	ctx.Response.JsonOutput(result)
}
开发者ID:jackyan,项目名称:go2o,代码行数:10,代码来源:member_c.go

示例12: Disconnect

// 断开
func (this *MemberC) Disconnect(ctx *echox.Context) error {
	var result gof.Message
	if util.MemberHttpSessionDisconnect(ctx) {
		result.Result = true
	} else {
		result.Message = "disconnect fail"
	}
	return ctx.JSON(http.StatusOK, result)
}
开发者ID:yonglehou,项目名称:go2o,代码行数:10,代码来源:member_c.go

示例13: applyCoupon

func (this *ShoppingC) applyCoupon(ctx *web.Context) {
	var result gof.Message
	if !this.prepare(ctx) {
		result.Message = "请先登陆"
	} else {
		p := this.BaseC.GetPartner(ctx)
		m := this.BaseC.GetMember(ctx)

		code := ctx.Request.FormValue("code")
		data, err := dps.ShoppingService.BuildOrder(p.Id, m.Id, "", code)
		if err != nil {
			result.Message = err.Error()
		} else {
			ctx.Response.JsonOutput(data)
			return
		}
	}

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

示例14: Index_post

func (this *loginC) Index_post(ctx *web.Context) {
	r := ctx.Request
	r.ParseForm()
	var result gof.Message
	usr, pwd := r.Form.Get("usr"), r.Form.Get("pwd")
	b, m, err := dps.MemberService.Login(-1, usr, pwd)
	if b {
		ctx.Session().Set("member", m)
		ctx.Session().Save()
		result.Result = true
	} else {
		if err != nil {
			result.Message = err.Error()
		} else {
			result.Message = "登陆失败"
		}
	}
	js, _ := json.Marshal(result)
	ctx.Response.Write(js)

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

示例15: Login_post

func (this *UserC) Login_post(ctx *web.Context) {
	r := ctx.Request
	r.ParseForm()
	var result gof.Message
	partnerId := this.BaseC.GetPartnerId(ctx)
	usr, pwd := r.Form.Get("usr"), r.Form.Get("pwd")
	b, m, err := dps.MemberService.Login(partnerId, usr, pwd)

	if b {
		ctx.Session().Set("member", m)
		ctx.Session().Save()
		result.Result = true
	} else {
		if err != nil {
			result.Message = err.Error()
		} else {
			result.Message = "登陆失败"
		}
	}
	ctx.Response.JsonOutput(result)
}
开发者ID:jackyan,项目名称:go2o,代码行数:21,代码来源:user_c.go


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