本文整理汇总了Golang中github.com/jsix/gof.Message.Marshal方法的典型用法代码示例。如果您正苦于以下问题:Golang Message.Marshal方法的具体用法?Golang Message.Marshal怎么用?Golang Message.Marshal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jsix/gof.Message
的用法示例。
在下文中一共展示了Message.Marshal方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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())
}
示例2: DelCategory_post
func (this *categoryC) DelCategory_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.Response
var result gof.Message
r.ParseForm()
categoryId, _ := strconv.Atoi(r.Form.Get("id"))
//删除分类
err := dps.SaleService.DeleteCategory(partnerId, categoryId)
if err != nil {
result = gof.Message{Result: false, Message: err.Error()}
} else {
result = gof.Message{Result: true, Message: ""}
}
w.Write(result.Marshal())
}
示例3: SaveArea_post
func (this *coverageAreaC) SaveArea_post(ctx *web.Context) {
r, w := ctx.Request, ctx.Response
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())
}
示例4: SaveCategory_post
//修改门店信息
func (this *categoryC) SaveCategory_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.Response
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())
}
示例5: 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())
}
示例6: SaveShop_post
//修改门店信息
func (this *shopC) SaveShop_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.Response
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())
}
示例7: CreatePartner_post
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())
}
示例8: SaleConf_post
func (this *configC) SaleConf_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.Response
var result gof.Message
r.ParseForm()
e := partner.SaleConf{}
web.ParseFormToEntity(r.Form, &e)
e.PartnerId = partnerId
err := dps.PartnerService.SaveSaleConf(partnerId, &e)
if err != nil {
result = gof.Message{Result: false, Message: err.Error()}
} else {
result = gof.Message{Result: true, Message: ""}
}
w.Write(result.Marshal())
}
示例9: 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())
}
示例10: Bind_coupon_post
func (this *promC) Bind_coupon_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.Response
var result gof.Message
r.ParseForm()
id, err := strconv.Atoi(r.FormValue("id"))
if err == nil {
memberIds := strings.TrimSpace(r.FormValue("member_ids"))
if memberIds == "" {
result.Message = "请选择会员"
} else {
idArr := strings.Split(memberIds, ",")
err = dps.PromService.BindCoupons(partnerId, id, idArr)
}
}
if err != nil {
result.Result = false
result.Message = err.Error()
} else {
result.Result = true
}
w.Write(result.Marshal())
}