terminate.go 879 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package service
  2. import (
  3. "context"
  4. "fmt"
  5. "github.com/caixw/lib.go/conv"
  6. "strings"
  7. "youngee_m_api/db"
  8. "youngee_m_api/model/http_model"
  9. "github.com/sirupsen/logrus"
  10. )
  11. var Terminate *terminate
  12. type terminate struct {
  13. }
  14. // TaskTerminate 同意初稿
  15. func (*terminate) TaskTerminate(ctx context.Context, request http_model.TaskTerminateRequest) (*http_model.TaskTerminateData, error) {
  16. var TaskIDList []int
  17. TaskIDs := strings.Split(request.TaskIds, ",")
  18. for _, taskId := range TaskIDs {
  19. TaskIDList = append(TaskIDList, conv.MustInt(taskId, 0))
  20. }
  21. fmt.Printf("acc request %+v", TaskIDList)
  22. err := db.Terminate(ctx, TaskIDList, request.ProjectIds)
  23. if err != nil {
  24. logrus.WithContext(ctx).Errorf("[Terminate service] call CreateTerminate error,err:%+v", err)
  25. return nil, err
  26. }
  27. res := &http_model.TaskTerminateData{
  28. TaskIds: TaskIDList,
  29. }
  30. return res, nil
  31. }