123456789101112131415161718192021222324252627282930 |
- package data_api
- import (
- "context"
- "gd_management/apis"
- "gd_management/common.in/utils"
- "gd_management/errors"
- "github.com/astaxie/beego/orm"
- "go.uber.org/zap"
- )
- func DataApiDeleteApi(ctx context.Context, req *apis.ManagementDataApiDeleteApiReq, reply *apis.ManagementDataApiDeleteApiReply) error {
- if req.DataApiId == 0 {
- return errors.ArgsError
- }
- o := orm.NewOrm()
- exist := o.QueryTable("t_gd_data_api_query_type").Filter("data_api_id", req.DataApiId).Exist()
- if exist {
- return errors.QeuryTypeInDataApi
- }
- _, err := o.Delete(&apis.DataApi{Id: req.DataApiId})
- if err != nil {
- l.Error("mysql",
- zap.String("sql", "delete from t_gd_data_api"),
- zap.String("fileds", utils.MarshalJsonString(req)),
- zap.String("error", err.Error()))
- return errors.DataBaseError
- }
- return nil
- }
|