sunpengfei
2025-11-28 312ebed2d86858e4fb57ec09679244e9b806b57f
ApiTools.Core/Utils/WxmpUtils/WxmpUtils.cs
@@ -161,11 +161,6 @@
            if (option == null || option.AppId.IsNull() || option.AppSecret.IsNull())
                throw Oops.Oh(EnumErrorCodeType.s400, "发送订阅消息失败,缺失配置:WxmpOptions");
            command.EnvVersion = option.EnvVersion;
            //if (!options.Value.SubscribMessageTemplates.ContainsKey(command.TemplateId))
            //    throw Oops.Oh(EnumErrorCodeType.s400, "发送订阅消息失败,模板不存在");
            //var template = options.Value.SubscribMessageTemplates[command.TemplateId];
            //command.TemplateId = template.TemplateId;
            //if (command.Page.IsNull()) command.Page = template.Page;
            var accessToken = await GetAccessToken(command.WxmpCode);
            var jsonContent = JsonConvert.SerializeObject(command, new JsonSerializerSettings
            {
@@ -176,13 +171,10 @@
                .WithQueryParameter("access_token", accessToken)
                .SetJsonContent(jsonContent));
            response.EnsureSuccessStatusCode();
            if (response.Content.Headers.ContentType.ToString() == "application/json; charset=UTF-8")
            {
                var jsonResult = await response.Content.ReadAsStringAsync();
                var callback = jsonResult.JsonTo<WxmpSendSubscribMessageResponse>();
                if (callback == null || callback.ErrorCode != 0)
                    throw Oops.Oh(EnumErrorCodeType.s510, $"发送订阅消息失败:{callback.ErrorMessage},请联系管理员");
            }
            var jsonResult = await response.Content.ReadAsStringAsync();
            var callback = jsonResult.JsonTo<WxmpSendSubscribMessageResponse>();
            if (callback == null || callback.ErrorCode != 0)
                throw Oops.Oh(EnumErrorCodeType.s510, $"发送订阅消息失败:{callback.ErrorMessage},请联系管理员");
        }
    }
}