package admin_agent import ( "context" "bdrp-server/app/main/api/internal/svc" "bdrp-server/app/main/api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type AdminUpdateSystemConfigLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewAdminUpdateSystemConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AdminUpdateSystemConfigLogic { return &AdminUpdateSystemConfigLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *AdminUpdateSystemConfigLogic) AdminUpdateSystemConfig(req *types.AdminUpdateSystemConfigReq) (resp *types.AdminUpdateSystemConfigResp, err error) { if req.CommissionSafeMode != nil { if err := l.svcCtx.AgentConfigModel.SetCommissionSafeMode(l.ctx, *req.CommissionSafeMode); err != nil { logx.Errorf("更新佣金安全防御模式失败: %v", err) return nil, err } logx.Infof("更新系统配置:佣金安全防御模式设置为 %v", *req.CommissionSafeMode) } resp = &types.AdminUpdateSystemConfigResp{ Success: true, } return }