Example #1
0
File: sale.go Project: zoe527/go2o
// 创建销售标签
func (this *Sale) CreateSaleTag(v *sale.ValueSaleTag) sale.ISaleTag {
	if v == nil {
		return nil
	}
	v.PartnerId = this.GetAggregateRootId()
	return this._saleTagRep.CreateSaleTag(v)
}
Example #2
0
func (this *saleC) Save_stag_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
	}
	ctx.Response.JsonOutput(result)
}
Example #3
0
// 保存销售标签
func (this *saleTagRep) SaveSaleTag(partnerId int, v *sale.ValueSaleTag) (int, error) {
	orm := this.GetOrm()
	var err error
	v.PartnerId = partnerId
	if v.Id > 0 {
		_, _, err = orm.Save(v.Id, v)
	} else {
		_, _, err = orm.Save(nil, v)
		this.Connector.ExecScalar("SELECT MAX(id) FROM gs_sale_tag WHERE partner_id=?", &v.Id, partnerId)
	}
	return v.Id, err
}