feat: 业务逻辑补全 — 佣金待审记录、C端订单重构、支付抽象、富友支付、卡设备状态联动
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
F-1: 佣金链断裂时创建 status=99 零额待审记录,新增修正接口 POST /commission-records/:id/resolve F-4: C端订单查询从 Handler 迁移至 Service 层,移除 SkipPermissionCtx J-1: 富友支付 JSAPI/MiniApp 预下单实现,回调补全签名验证 J-2: 平台钱包代购支持(buyerType 为空时使用资产所属代理钱包) J-3: 套餐激活后自动更新卡/设备 status=3,最后套餐过期后更新 status=4 支付抽象: 引入 PaymentProvider 接口 + 微信/富友适配器,CreateOrder 支持多支付渠道 修复: 设备/IoT卡响应 DTO 移除 omitempty,空值字段返回 null 而非省略
This commit is contained in:
@@ -172,7 +172,30 @@ func (s *Service) CalculateCostDiffCommission(ctx context.Context, order *model.
|
||||
|
||||
allocation, err := s.shopPackageAllocationStore.GetByShopAndPackage(ctx, currentShop.ID, packageID)
|
||||
if err != nil {
|
||||
s.logger.Warn("上级店铺未分配该套餐,跳过", zap.Uint("shop_id", currentShop.ID), zap.Uint("package_id", packageID))
|
||||
s.logger.Warn("上级店铺未分配该套餐,佣金链断裂",
|
||||
zap.Uint("shop_id", currentShop.ID),
|
||||
zap.Uint("package_id", packageID),
|
||||
zap.Uint("order_id", order.ID))
|
||||
pendingRecord := &model.CommissionRecord{
|
||||
BaseModel: model.BaseModel{
|
||||
Creator: order.Creator,
|
||||
Updater: order.Updater,
|
||||
},
|
||||
ShopID: currentShop.ID,
|
||||
OrderID: order.ID,
|
||||
IotCardID: order.IotCardID,
|
||||
DeviceID: order.DeviceID,
|
||||
CommissionSource: model.CommissionSourceCostDiff,
|
||||
Amount: 0,
|
||||
Status: constants.CommissionStatusPendingReview,
|
||||
Remark: fmt.Sprintf("套餐系列[%d]未分配给该代理(shop_id=%d),成本价差链路断裂,请人工核查", *order.SeriesID, currentShop.ID),
|
||||
}
|
||||
if createErr := s.commissionRecordStore.Create(ctx, pendingRecord); createErr != nil {
|
||||
s.logger.Warn("创建待审佣金记录失败",
|
||||
zap.Uint("shop_id", currentShop.ID),
|
||||
zap.Uint("order_id", order.ID),
|
||||
zap.Error(createErr))
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
@@ -503,9 +526,30 @@ func (s *Service) calculateChainOneTimeCommission(ctx context.Context, bottomSho
|
||||
parentShopID := *currentShop.ParentID
|
||||
parentSeriesAllocation, err := s.shopSeriesAllocationStore.GetByShopAndSeries(ctx, parentShopID, seriesID)
|
||||
if err != nil {
|
||||
s.logger.Warn("上级店铺未分配该系列,停止链式计算",
|
||||
s.logger.Warn("上级店铺未分配该系列,佣金链断裂",
|
||||
zap.Uint("parent_shop_id", parentShopID),
|
||||
zap.Uint("series_id", seriesID))
|
||||
zap.Uint("series_id", seriesID),
|
||||
zap.Uint("order_id", order.ID))
|
||||
pendingRecord := &model.CommissionRecord{
|
||||
BaseModel: model.BaseModel{
|
||||
Creator: order.Creator,
|
||||
Updater: order.Updater,
|
||||
},
|
||||
ShopID: parentShopID,
|
||||
OrderID: order.ID,
|
||||
IotCardID: cardID,
|
||||
DeviceID: deviceID,
|
||||
CommissionSource: model.CommissionSourceOneTime,
|
||||
Amount: 0,
|
||||
Status: constants.CommissionStatusPendingReview,
|
||||
Remark: fmt.Sprintf("套餐系列[%d]未分配给该代理(shop_id=%d),一次性佣金链路断裂,请人工核查", seriesID, parentShopID),
|
||||
}
|
||||
if createErr := s.commissionRecordStore.Create(ctx, pendingRecord); createErr != nil {
|
||||
s.logger.Warn("创建待审佣金记录失败",
|
||||
zap.Uint("shop_id", parentShopID),
|
||||
zap.Uint("order_id", order.ID),
|
||||
zap.Error(createErr))
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user