123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package h5
- import (
- "context"
- "gd_management/apis"
- "gd_management/errors"
- // "fmt"
- "github.com/astaxie/beego/orm"
- )
- func ManagementH5ServiceGetComboList(ctx context.Context, req *apis.ManagementH5ServiceGetComboListReq, reply *apis.ManagementH5ServiceGetComboListReply) error {
- if req.H5ServiceId == 0 {
- return errors.ArgsError
- }
- o := orm.NewOrm()
- var err error
- err = o.Raw("select is_free from t_gd_h5_service where id=?", req.H5ServiceId).QueryRow(&reply.IsFree)
- if err != nil {
- if err != orm.ErrNoRows {
- return errors.DataBaseError
- }
- }
- _, err = o.QueryTable("t_gd_h5_service_combo").Filter("h5_service_id", req.H5ServiceId).Filter("type", 0).All(&reply.FreeCombos)
- if err != nil {
- if err != orm.ErrNoRows {
- return errors.DataBaseError
- }
- }
- _, err = o.QueryTable("t_gd_h5_service_combo").Filter("h5_service_id", req.H5ServiceId).Filter("type", 1).All(&reply.TotalCountCombos)
- if err != nil {
- if err != orm.ErrNoRows {
- return errors.DataBaseError
- }
- }
- _, err = o.QueryTable("t_gd_h5_service_combo").Filter("h5_service_id", req.H5ServiceId).Filter("type", 2).All(&reply.DayCountCombos)
- if err != nil {
- if err != orm.ErrNoRows {
- return errors.DataBaseError
- }
- }
- return nil
- }
|