chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package workerdiagnostic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/workerdiagnostic/v1"
|
||||
workerdiagnosticservice "git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service/workerdiagnostic"
|
||||
)
|
||||
|
||||
type Controller struct {
|
||||
service *workerdiagnosticservice.Service
|
||||
}
|
||||
|
||||
func New(service *workerdiagnosticservice.Service) *Controller {
|
||||
return &Controller{service: service}
|
||||
}
|
||||
|
||||
func (c *Controller) Diagnostic(ctx context.Context, req *v1.DiagnosticReq) (*v1.DiagnosticRes, error) {
|
||||
result, err := c.service.Publish(ctx, req.Message)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.DiagnosticRes{
|
||||
TraceID: result.TraceID,
|
||||
Queue: result.Queue,
|
||||
SentAt: result.SentAt,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user