香堤湾 更新消息模板

This commit is contained in:
Yuan
2024-09-12 19:00:52 +08:00
parent d2996857b1
commit dedf55aca4
7 changed files with 503 additions and 119 deletions

View File

@@ -1,4 +1,5 @@
using System;
using Google.Protobuf.WellKnownTypes;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
@@ -9,6 +10,7 @@ namespace Appointment.Entity
public class WechatHelper
{
private static HttpClient _HttpClient = null;
static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(WechatHelper));
static WechatHelper()
{
@@ -25,7 +27,7 @@ namespace Appointment.Entity
public ApiResult<WeChatLoginRes> Code2Session(string code)
{
string appId = BaseConfig.App(new string[] { "WeChat", "AppId" });
if(string.IsNullOrWhiteSpace(appId)) ApiResult<WeChatLoginRes>.Failed("缺少配置参数 [AppId]!");
if (string.IsNullOrWhiteSpace(appId)) ApiResult<WeChatLoginRes>.Failed("缺少配置参数 [AppId]!");
string appSecret = BaseConfig.App(new string[] { "WeChat", "AppSecret" });
if (string.IsNullOrWhiteSpace(appSecret)) ApiResult<WeChatLoginRes>.Failed("缺少配置参数 [AppSecret]!");
@@ -40,6 +42,7 @@ namespace Appointment.Entity
if (res.StatusCode == HttpStatusCode.OK)
{
var result = Encoding.Default.GetString(res.Content.ReadAsByteArrayAsync().Result);
log.Info($"jscode2session:{result}");
if (string.IsNullOrWhiteSpace(result) || result.IndexOf("session_key") == -1)
{
return ApiResult<WeChatLoginRes>.Failed("调用微信接口失败,可能code已失效");
@@ -58,7 +61,7 @@ namespace Appointment.Entity
//
public class LoveInnGetAccessTokenReq
{
{
public string AppId { get; set; }
public string AppName { get; set; }