provider_relation_init.go 510 B

123456789101112131415161718192021
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package data_api
  4. import (
  5. "gd_management/apis"
  6. "github.com/astaxie/beego/orm"
  7. )
  8. func InitProviderRelation() {
  9. o := orm.NewOrm()
  10. count, _ := o.QueryTable("t_gd_data_api_provider_api_relation").Count()
  11. if count > 0 {
  12. return
  13. }
  14. tabs := []apis.ManagementDataApiBaseApi{}
  15. o.QueryTable("t_gd_child_data_api").All(&tabs)
  16. for _, v := range tabs {
  17. insertDataApiProviderRelation(v.Id, v.ApiId)
  18. }
  19. }