Files
iotlcm/openapi/internal/service/common.go
T

42 lines
1.6 KiB
Go

package service
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model"
"git.5iot.com/iotlcm-public/iotlcm-openapi/internal/model/entity"
)
type (
ICommon interface {
BuildBatchNo(ctx context.Context, prefix string) (string, error)
BuildRenewBatchNo(ctx context.Context) (string, error)
SaveBatchMain(ctx context.Context, tx gdb.TX, batch *entity.BatchMain, executionMode int) error
SaveBatchDetail(ctx context.Context, tx gdb.TX, detail *entity.BatchDetail) error
SaveBatchDetails(ctx context.Context, tx gdb.TX, details []*entity.BatchDetail) error
Publish(ctx context.Context, queue string, data any) error
SubmitRenew(ctx context.Context, in *model.CommonRenewParam) (*model.CommonRenewRes, error)
SubmitSingleRenew(ctx context.Context, card model.CommonRenewCard, appID, packageID, remark string, validity int) (*model.CommonSingleRenewRes, error)
SubmitBatchRenew(ctx context.Context, appID string, cards []model.CommonRenewCard, iccids []string, packageID, remark string, validity int) (*model.CommonRenewRes, error)
SubmitTrafficCutoffConfig(ctx context.Context, in *model.CommonTrafficCutoffConfigParam) (*model.CommonTrafficCutoffConfigRes, error)
SubmitSingleTrafficCutoffConfig(ctx context.Context, in *model.CommonTrafficCutoffSingleParam) (*model.CommonSingleTrafficCutoffRes, error)
}
)
var (
localCommon ICommon
)
func Common() ICommon {
if localCommon == nil {
panic("implement not found for interface ICommon, forgot register?")
}
return localCommon
}
func RegisterCommon(i ICommon) {
localCommon = i
}