互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.3 KiB

5 years ago
5 years ago
5 years ago
  1. package activity_service
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "hudongzhuanjia/models"
  5. )
  6. //func GetModuleService(moduleName string, activityId int64) (*models.ActivityModuleService, bool, error) {
  7. // hids := make([]int64, 0)
  8. // err := core.GetXormAuto().Table(new(models.ModuleServiceHistory)).Select("id").
  9. // Where("is_delete=0 and name=?", moduleName).Find(&hids)
  10. // if err != nil {
  11. // return nil, false, err
  12. // }
  13. // moduleService := new(models.ActivityModuleService)
  14. // exist, err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).
  15. // In("service_module_history_id", hids).Get(moduleService)
  16. // return moduleService, exist, err
  17. //}
  18. //type ModuleService struct {
  19. // models.ActivityModuleService `xorm:"extends"`
  20. // History models.ModuleServiceHistory `xorm:"extends"`
  21. //}
  22. func GetModuleService(moduleName, activityId interface{}) (*models.ActivityModuleService, bool, error) {
  23. module := new(models.ActivityModuleService)
  24. exist, err := core.GetXormAuto().Table(module).Alias("s").
  25. Join("LEFT", new(models.ModuleServiceHistory).Alias("h"),
  26. "s.service_module_history_id=h.id").
  27. Where("s.activity_id=? and s.is_delete=0 and h.name=?", activityId, moduleName).
  28. Get(module)
  29. return module, exist, err
  30. }