本文整理汇总了Golang中go2o/src/core/domain/interface/partner.SiteConf类的典型用法代码示例。如果您正苦于以下问题:Golang SiteConf类的具体用法?Golang SiteConf怎么用?Golang SiteConf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SiteConf类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetSiteConf
// 获取站点配置
func (this *partnerRep) GetSiteConf(partnerId int) *partner.SiteConf {
var siteConf partner.SiteConf
if err := this.Connector.GetOrm().Get(partnerId, &siteConf); err == nil {
if len(siteConf.Host) == 0 {
var usr string
this.Connector.ExecScalar(
`SELECT usr FROM pt_partner WHERE id=?`,
&usr, partnerId)
siteConf.Host = fmt.Sprintf("%s.%s", usr,
infrastructure.GetApp().Config().
GetString(variable.ServerDomain))
}
return &siteConf
}
return nil
}
示例2: SaveSiteConf
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
}
示例3: SiteConf_post
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())
}