Exemple #1
0
func (this *partnerRep) SaveSiteConf(partnerId int, v *partner.SiteConf) error {
	defer this.renew(v.PartnerId)

	var err error
	if v.PartnerId > 0 {
		_, _, err = this.Connector.GetOrm().Save(v.PartnerId, v)
	} else {
		v.PartnerId = partnerId
		_, _, err = this.Connector.GetOrm().Save(nil, v)
	}
	return err
}
Exemple #2
0
func (this *configC) SiteConf_post(ctx *web.Context) {
	partnerId := this.GetPartnerId(ctx)
	r, w := ctx.Request, ctx.ResponseWriter
	var result gof.Message
	r.ParseForm()

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

	//更新
	origin := dps.PartnerService.GetSiteConf(partnerId)
	e.Host = origin.Host
	e.PartnerId = partnerId

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

	if err != nil {
		result = gof.Message{Result: false, Message: err.Error()}
	} else {
		result = gof.Message{Result: true, Message: ""}
	}
	w.Write(result.Marshal())
}