feat: 停复机新规则转正,删除总开关与旧口径
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m35s

- 删除总开关 stop_resume.unified_rule_enabled(配置、加载、部署工作流与 docker-compose.prod.yml 环境变量)
- 复机不看停机原因:删除只对轮询停因复机的旧分支与 ListByDeviceIDAndPollingStopReasons;设备复机取全部停机卡
- 实名门槛只按卡所属通道实名管控判断,删除行业卡与卡/设备实名策略放行;暂停轮询的卡不自动停复机无条件生效
- 通道阈值新周期解锁后的复机条件固定为新规则复机条件
- 资产自动续费复机同步新规则:不看停因、暂停轮询不复机、设备取全部停机卡、复机成功清除停因
- 实名轮询不再按行业卡跳过;所属运营商账户未开启实名管控时跳过查询,但卡未实名且所在资产有等待实名激活的套餐时照常查询,避免囤货套餐无法激活
This commit is contained in:
邹进
2026-10-25 18:13:51 +09:00
parent 457abaabd7
commit f49baff7c2
15 changed files with 155 additions and 159 deletions

View File

@@ -166,7 +166,7 @@ func (s *StopResumeService) QueryAutoRenewalResumeState(ctx context.Context, ass
}
// autoRenewalResumeCards 解析自动续费资产对应的待复机卡:卡资产取自身,设备资产取该设备下
// 因轮询原因停机的绑定卡(复用既有设备卡查询,不另立绑定关系口径)。
// 全部停机的绑定卡(不看停机原因,复用既有设备卡查询,不另立绑定关系口径)。
func (s *StopResumeService) autoRenewalResumeCards(ctx context.Context, assetType string, assetID uint) ([]*model.IotCard, error) {
if assetID == 0 {
return nil, errors.New(errors.CodeInvalidParam, "自动续费复机资产无效")
@@ -179,7 +179,7 @@ func (s *StopResumeService) autoRenewalResumeCards(ctx context.Context, assetTyp
}
return []*model.IotCard{card}, nil
case constants.AssetWalletResourceTypeDevice:
cards, err := s.iotCardStore.ListByDeviceIDAndPollingStopReasons(ctx, assetID)
cards, err := s.iotCardStore.ListByDeviceIDAndNetworkStatus(ctx, assetID, constants.NetworkStatusOffline)
if err != nil {
return nil, errors.Wrap(errors.CodeDatabaseError, err, "查询设备待复机卡失败")
}
@@ -197,11 +197,13 @@ func (s *StopResumeService) autoRenewalCardReady(ctx context.Context, card *mode
if card.NetworkStatus == constants.NetworkStatusOnline {
return false, "卡当前已在线,无需复机", nil
}
if isRiskGatewayExtend(card.GatewayExtend) {
return false, "网关扩展状态为风险停机或已销户,不自动复机", nil
// 与停复机规则一致:不看停机原因;卡或所在设备暂停轮询的不自动复机(风险停机与已销户的卡已关闭轮询)。
suspended, err := s.autoControlSuspended(ctx, card)
if err != nil {
return false, "", err
}
if !isPollingStopReason(card.StopReason) {
return false, "停因不属于可轮询复机范围,不自动复机", nil
if suspended {
return false, "卡或所在设备已暂停轮询,不自动复机", nil
}
blocked, err := s.channelThresholdBlocked(ctx, card)
if err != nil {
@@ -266,10 +268,8 @@ func (s *StopResumeService) autoRenewalResumeCard(ctx context.Context, card *mod
"network_status": constants.NetworkStatusOnline,
"resumed_at": time.Now(),
}
// 判定已限定停因属于可轮询复机范围,复机成功后清除停因,与既有轮询复机口径一致。
if isPollingStopReason(card.StopReason) {
fields["stop_reason"] = ""
}
// 复机成功后清除停因,与轮询复机口径一致。
fields["stop_reason"] = ""
if err := s.updateCardAndAppendNetworkSeries(ctx, card, fields,
constants.CardObservationSceneBusinessResume, "online", uuid.NewString(), actionCode, summary, attempt.log.IntegrationID); err != nil {
if logErr := s.completeCardCommandAttempt(ctx, attempt, nil, false); logErr != nil {