Exemplo n.º 1
0
// 保存等级
func (this *LevelManager) SaveLevel(v *valueobject.MemberLevel) (int, error) {
	v.PartnerId = this._partnerId
	// 如果新增(非初始化)等级自动设置值
	if v.Id <= 0 && len(this._levelSet) == 0 {
		v.Value = this.getMaxLevelValue() + 1
	}
	this._levelSet = nil
	return this._rep.SaveMemberLevel(this._partnerId, v)
}
Exemplo n.º 2
0
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)
}