package h5 import ( "context" "gd_management/apis" "gd_management/errors" "github.com/astaxie/beego/orm" ) func ManagementH5ServiceUpdateCombo(ctx context.Context, req *apis.ManagementH5ServiceUpdateComboReq, reply *apis.ManagementH5ServiceUpdateComboReply) error { if req.ComboId == 0 { return errors.ArgsError } o := orm.NewOrm() var h5Combo apis.TGdH5ServiceCombo err := o.QueryTable("t_gd_h5_service_combo").Filter("id", req.ComboId).One(&h5Combo) if err != nil { if err != orm.ErrNoRows { return errors.DataBaseError } else { return errors.DataComboNotExist } } if req.Price != h5Combo.Price { h5Combo.Price = req.Price } if req.Count != h5Combo.Count { h5Combo.Count = req.Count } if req.TotalDay != h5Combo.TotalDay { h5Combo.TotalDay = req.TotalDay } o.Update(&h5Combo) return nil }