This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/break/junhong_cmp_fiber/internal/model"
|
||||
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
||||
assetService "github.com/break/junhong_cmp_fiber/internal/service/asset"
|
||||
customerBinding "github.com/break/junhong_cmp_fiber/internal/service/customer_binding"
|
||||
pollingSvc "github.com/break/junhong_cmp_fiber/internal/service/polling"
|
||||
"github.com/break/junhong_cmp_fiber/internal/store/postgres"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/config"
|
||||
@@ -29,7 +30,7 @@ var clientRealnameValidator = validator.New()
|
||||
// ClientRealnameHandler C 端实名认证处理器
|
||||
type ClientRealnameHandler struct {
|
||||
assetService *assetService.Service
|
||||
personalDeviceStore *postgres.PersonalCustomerDeviceStore
|
||||
customerBinding *customerBinding.Service
|
||||
iotCardStore *postgres.IotCardStore
|
||||
deviceSimBindingStore *postgres.DeviceSimBindingStore
|
||||
carrierStore *postgres.CarrierStore
|
||||
@@ -41,7 +42,7 @@ type ClientRealnameHandler struct {
|
||||
// NewClientRealnameHandler 创建 C 端实名认证处理器
|
||||
func NewClientRealnameHandler(
|
||||
assetSvc *assetService.Service,
|
||||
personalDeviceStore *postgres.PersonalCustomerDeviceStore,
|
||||
binding *customerBinding.Service,
|
||||
iotCardStore *postgres.IotCardStore,
|
||||
deviceSimBindingStore *postgres.DeviceSimBindingStore,
|
||||
carrierStore *postgres.CarrierStore,
|
||||
@@ -51,7 +52,7 @@ func NewClientRealnameHandler(
|
||||
) *ClientRealnameHandler {
|
||||
return &ClientRealnameHandler{
|
||||
assetService: assetSvc,
|
||||
personalDeviceStore: personalDeviceStore,
|
||||
customerBinding: binding,
|
||||
iotCardStore: iotCardStore,
|
||||
deviceSimBindingStore: deviceSimBindingStore,
|
||||
carrierStore: carrierStore,
|
||||
@@ -89,11 +90,11 @@ func (h *ClientRealnameHandler) GetRealnameLink(c *fiber.Ctx) error {
|
||||
}
|
||||
|
||||
// 4. 验证资产归属(个人客户必须绑定过该资产)
|
||||
owned, err := h.personalDeviceStore.ExistsByCustomerAndDevice(ctx, customerID, asset.VirtualNo)
|
||||
owned, err := h.customerBinding.OwnsAsset(ctx, customerID, asset.AssetType, asset.AssetID)
|
||||
if err != nil {
|
||||
logger.GetAppLogger().Error("查询资产归属失败",
|
||||
zap.Uint("customer_id", customerID),
|
||||
zap.String("virtual_no", asset.VirtualNo),
|
||||
zap.Uint("asset_id", asset.AssetID),
|
||||
zap.Error(err))
|
||||
return errors.New(errors.CodeInternalError, "查询资产归属失败")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user