1234567891011121314151617181920212223242526272829 |
- package provider
- import (
- "context"
- "gd_management/apis"
- "gd_management/errors"
- "gd_management/impl/pubsub"
- "github.com/astaxie/beego/orm"
- )
- func ManagementDelProviderApi(ctx context.Context, req *apis.ManagementDelProviderApiReq, reply *apis.ManagementDelProviderApiReply) error {
- if req.ProviderApiId == 0 {
- return errors.ArgsError
- }
- if err := pubsub.PublishNameNotify("provider_api_id", req.ProviderApiId, 0); err != nil {
- return err
- }
- exist := orm.NewOrm().QueryTable("t_gd_api_provider_relation").Filter("provider_api_id", req.ProviderApiId).Exist()
- if exist {
- return errors.ProviderApiInApi
- }
- _, err := orm.NewOrm().Raw("delete from t_gd_provider_api where id = ?", req.ProviderApiId).Exec()
- if err != nil {
- return errors.DataBaseError
- }
- return nil
- }
|