예제 #1
0
파일: account_c.go 프로젝트: zoe527/go2o
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)
}
예제 #2
0
파일: account_c.go 프로젝트: zoe527/go2o
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)
}