All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m10s
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
package iot_card
|
|
|
|
import (
|
|
"context"
|
|
|
|
assetAuditSvc "github.com/break/junhong_cmp_fiber/internal/service/asset_audit"
|
|
"github.com/break/junhong_cmp_fiber/internal/model"
|
|
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
|
)
|
|
|
|
// AssetAuditService 资产审计服务接口。
|
|
type AssetAuditService interface {
|
|
LogOperation(ctx context.Context, log *model.AssetOperationLog)
|
|
}
|
|
|
|
func (s *Service) logCardAudit(ctx context.Context, p assetAuditSvc.BuildLogParams) {
|
|
if s == nil || s.assetAuditService == nil {
|
|
return
|
|
}
|
|
if p.Operator.Type == "" {
|
|
p.Operator = assetAuditSvc.OperatorFromContext(ctx)
|
|
}
|
|
if p.AssetType == "" {
|
|
p.AssetType = constants.AssetTypeIotCard
|
|
}
|
|
s.assetAuditService.LogOperation(ctx, assetAuditSvc.BuildLog(ctx, p))
|
|
}
|
|
|
|
func (s *StopResumeService) logCardAudit(ctx context.Context, p assetAuditSvc.BuildLogParams) {
|
|
if s == nil || s.assetAuditService == nil {
|
|
return
|
|
}
|
|
if p.Operator.Type == "" {
|
|
p.Operator = assetAuditSvc.OperatorFromContext(ctx)
|
|
}
|
|
if p.AssetType == "" {
|
|
p.AssetType = constants.AssetTypeIotCard
|
|
}
|
|
s.assetAuditService.LogOperation(ctx, assetAuditSvc.BuildLog(ctx, p))
|
|
}
|
|
|
|
func cardSnapshot(card *model.IotCard) map[string]any {
|
|
if card == nil {
|
|
return nil
|
|
}
|
|
return map[string]any{
|
|
"id": card.ID,
|
|
"iccid": card.ICCID,
|
|
"shop_id": card.ShopID,
|
|
"status": card.Status,
|
|
"series_id": card.SeriesID,
|
|
"enable_polling": card.EnablePolling,
|
|
"realname_policy": card.RealnamePolicy,
|
|
"real_name_status": card.RealNameStatus,
|
|
"network_status": card.NetworkStatus,
|
|
"stop_reason": card.StopReason,
|
|
}
|
|
}
|