本文整理汇总了Golang中github.com/atnet/gof/web.ParseFormToEntity函数的典型用法代码示例。如果您正苦于以下问题:Golang ParseFormToEntity函数的具体用法?Golang ParseFormToEntity怎么用?Golang ParseFormToEntity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseFormToEntity函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: 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:henrylee2cn,项目名称:go2o,代码行数:26,代码来源:prom_c.go
示例2: 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:henrylee2cn,项目名称:go2o,代码行数:32,代码来源:prom_c.go
示例3: 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
示例4: Profile_post
func (this *configC) Profile_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.ResponseWriter
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:xianmau,项目名称:go2o,代码行数:29,代码来源:config_c.go
示例5: SaveDeliver_post
func (this *basicC) SaveDeliver_post(ctx *web.Context) {
m := this.GetMember(ctx)
r := ctx.Request
r.ParseForm()
var e member.DeliverAddress
web.ParseFormToEntity(r.Form, &e)
e.MemberId = m.Id
_, err := dps.MemberService.SaveDeliverAddress(m.Id, &e)
if err != nil {
this.resultOutput(ctx, gof.Message{Result: false, Message: err.Error()})
} else {
this.resultOutput(ctx, gof.Message{Result: true})
}
}
开发者ID:xianmau,项目名称:go2o,代码行数:14,代码来源:basic_c.go
示例6: SaveDeliver_post
func (this *basicC) SaveDeliver_post(ctx *web.Context) {
m := this.GetMember(ctx)
var result gof.Message
r := ctx.Request
r.ParseForm()
var e member.DeliverAddress
web.ParseFormToEntity(r.Form, &e)
e.MemberId = m.Id
_, err := dps.MemberService.SaveDeliverAddress(m.Id, &e)
if err != nil {
result.Message = err.Error()
} else {
result.Result = true
}
ctx.Response.JsonOutput(result)
}
开发者ID:sunxboy,项目名称:go2o,代码行数:16,代码来源:basic_c.go
示例7: 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
示例8: SaveArea_post
func (this *coverageAreaC) SaveArea_post(ctx *web.Context) {
r, w := ctx.Request, ctx.ResponseWriter
var result gof.Message
r.ParseForm()
coverageArea := delivery.CoverageValue{}
web.ParseFormToEntity(r.Form, &coverageArea)
id, err := dps.DeliverService.CreateCoverageArea(&coverageArea)
if err != nil {
result = gof.Message{Result: true, Message: err.Error()}
} else {
result = gof.Message{Result: true, Message: "", Data: id}
}
w.Write(result.Marshal())
}
开发者ID:xianmau,项目名称:go2o,代码行数:17,代码来源:coverage_area_c.go
示例9: SaveCategory_post
//修改门店信息
func (this *categoryC) SaveCategory_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.ResponseWriter
var result gof.Message
r.ParseForm()
e := sale.ValueCategory{}
web.ParseFormToEntity(r.Form, &e)
id, err := dps.SaleService.SaveCategory(partnerId, &e)
if err != nil {
result = gof.Message{Result: false, Message: err.Error()}
} else {
result = gof.Message{Result: true, Message: "", Data: id}
}
w.Write(result.Marshal())
}
开发者ID:honj51,项目名称:go2o,代码行数:18,代码来源:category_c.go
示例10: 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
示例11: CreatePartner_post
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())
}
开发者ID:xianmau,项目名称:go2o,代码行数:46,代码来源:partner_c.go
示例12: Bank_info_post
func (this *accountC) Bank_info_post(ctx *web.Context) {
m := this.GetMember(ctx)
r := ctx.Request
var msg gof.Message
r.ParseForm()
e := new(member.BankInfo)
web.ParseFormToEntity(r.Form, e)
e.MemberId = m.Id
err := dps.MemberService.SaveBankInfo(e)
if err != nil {
msg.Message = err.Error()
} else {
msg.Result = true
}
ctx.Response.JsonOutput(msg)
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:17,代码来源:account_c.go
示例13: 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
示例14: SaveDeliver_post
func (this *basicC) SaveDeliver_post(ctx *web.Context) {
m := this.GetMember(ctx)
w, r := ctx.ResponseWriter, ctx.Request
r.ParseForm()
var e member.DeliverAddress
web.ParseFormToEntity(r.Form, &e)
e.MemberId = m.Id
b, err := goclient.Member.SaveDeliverAddr(m.Id, m.DynamicToken, &e)
if err == nil {
if b {
w.Write([]byte(`{"result":true}`))
} else {
w.Write([]byte(`{"result":false}`))
}
} else {
w.Write([]byte(fmt.Sprintf(`{"result":false,"message":"%s"}`, err.Error())))
}
}
开发者ID:honj51,项目名称:go2o,代码行数:18,代码来源:basic_c.go
示例15: SaveShop_post
//修改门店信息
func (this *shopC) SaveShop_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.ResponseWriter
var result gof.Message
r.ParseForm()
shop := partner.ValueShop{}
web.ParseFormToEntity(r.Form, &shop)
id, err := dps.PartnerService.SaveShop(partnerId, &shop)
if err != nil {
result = gof.Message{Result: true, Message: err.Error()}
} else {
result = gof.Message{Result: true, Message: "", Data: id}
}
w.Write(result.Marshal())
}
开发者ID:xianmau,项目名称:go2o,代码行数:19,代码来源:shop_c.go
示例16: ApplyCash_post
func (this *accountC) ApplyCash_post(ctx *web.Context) {
m := this.GetMember(ctx)
r, w := ctx.Request, ctx.ResponseWriter
var result gof.Message
r.ParseForm()
e := new(member.BankInfo)
web.ParseFormToEntity(r.Form, e)
e.MemberId = m.Id
err := goclient.Member.SaveBankInfo(m.Id, m.DynamicToken, e)
if err != nil {
result = gof.Message{Result: false, Message: err.Error()}
} else {
result = gof.Message{Result: true}
}
w.Write(result.Marshal())
}
开发者ID:xianmau,项目名称:go2o,代码行数:18,代码来源:account_c.go
示例17: SaveMLevel_post
func (this *memberC) SaveMLevel_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r := ctx.Request
var result gof.Message
r.ParseForm()
e := valueobject.MemberLevel{}
web.ParseFormToEntity(r.Form, &e)
e.PartnerId = this.GetPartnerId(ctx)
id, err := dps.PartnerService.SaveMemberLevel(partnerId, &e)
if err != nil {
result.Message = err.Error()
} else {
result.Result = true
result.Data = id
}
ctx.Response.JsonOutput(result)
}
开发者ID:sunxboy,项目名称:go2o,代码行数:20,代码来源:member_c.go
示例18: SaveImage_post
func (this *adC) SaveImage_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r := ctx.Request
r.ParseForm()
var result gof.Message
e := ad.ValueImage{}
web.ParseFormToEntity(r.Form, &e)
id, err := dps.AdvertisementService.SaveImage(partnerId, e.AdvertisementId, &e)
if err != nil {
result.Message = err.Error()
} else {
result.Result = true
result.Data = id
}
ctx.Response.JsonOutput(result)
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:20,代码来源:ad_c.go
示例19: SaveItem_post
func (this *goodsC) SaveItem_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.Response
var result gof.Message
r.ParseForm()
e := sale.ValueItem{}
web.ParseFormToEntity(r.Form, &e)
e.State = 1 //todo: 暂时使用
id, err := dps.SaleService.SaveItem(partnerId, &e)
if err != nil {
result = gof.Message{Result: true, Message: err.Error()}
} else {
result = gof.Message{Result: true, Message: "", Data: id}
}
w.Write(result.Marshal())
}
开发者ID:AlwaysOnline,项目名称:go2o,代码行数:20,代码来源:goods_c.go
示例20: SaveSTag_post
func (this *saleC) SaveSTag_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r := ctx.Request
var result gof.Message
r.ParseForm()
e := sale.ValueSaleTag{}
web.ParseFormToEntity(r.Form, &e)
e.PartnerId = this.GetPartnerId(ctx)
id, err := dps.SaleService.SaveSaleTag(partnerId, &e)
if err != nil {
result.Message = err.Error()
} else {
result.Result = true
result.Data = id
}
this.JsonOutput(ctx, result)
}
开发者ID:xianmau,项目名称:go2o,代码行数:20,代码来源:sale_c.go
注:本文中的github.com/atnet/gof/web.ParseFormToEntity函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论