Browse Source

Merge branch 'develop-FileUpload-test' of http://192.168.0.12:3000/Coder/24Hour.Service into develop-FileUpload-test

develop-FileUpload-test
胡超1 2 years ago
parent
commit
5189e7ce16
  1. 4
      24Hour/24Hour.csproj
  2. 2
      24Hour/Controllers/system/SystemControllerController.cs
  3. 35
      24Hour/WechatMessagerClient.cs
  4. 9
      24Hour/appsettings.json
  5. 4
      24Hour/build/dockerbuild.txt
  6. 7
      Elight.Utility/Encrypt/AES.cs

4
24Hour/24Hour.csproj

@ -8,8 +8,8 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<UserSecretsId>e485308c-2f05-470b-b0a4-68f1ec2b3412</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<AssemblyVersion>1.0.3.7</AssemblyVersion>
<Version>1.0.3.7</Version>
<AssemblyVersion>1.0.3.9</AssemblyVersion>
<Version>1.0.3.9</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

2
24Hour/Controllers/system/SystemControllerController.cs

@ -188,7 +188,7 @@ namespace _24Hour.Controllers.system
UserDate.createuserId = _userdata.Id.ToString();
UserDate.createusername = _userdata.name;
UserDate.usertype = 0;
UserDate.photo = "/CaseFile/resource/headicon.png";
UserDate.photo = "/CaseFile/resource/headicon.aks";
//默认密码
UserDate.Password = string.IsNullOrEmpty(UserDate.Password) ? Elight.Utility.Encrypt.Md5.Encrypt32($"mr123456").ToLower() : Elight.Utility.Encrypt.Md5.Encrypt32(UserDate.Password).ToLower();
var roledata = new App_Sys_RoleUserModel();

35
24Hour/WechatMessagerClient.cs

@ -21,31 +21,34 @@ namespace _24Hour
private readonly HttpClient httpCliet;
// 实例化MemoryCache对象
MemoryCache cache = MemoryCache.Default;
private readonly IConfiguration _configuration;
/// <summary>
/// 小程序AppID
/// </summary>
private string appid = "wx48108a0c98a3dab0";
private string appid;
/// <summary>
/// 小程序AppID
/// </summary>
private string secret = "wx48108a0c98a3dab0";
private string secret;
/// <summary>
/// 微信公众号AppID
/// </summary>
private string Gzhappid = "wx48108a0c98a3dab0";
private string Gzhappid;
/// <summary>
/// 微信公众号密码
/// </summary>
private string Gzhsecret = "wx48108a0c98a3dab0";
private string Gzhsecret;
/// <summary>
/// 微信公众号模板Id
/// </summary>
private string GzhtemplateId = "wx48108a0c98a3dab0";
private string GzhtemplateId;
/// <summary>
/// 小程序secretID
/// </summary>
private string secid = "e752e4fba67526eca21313a18c96a58f";
private string secid;
private string miniprogram_state;
private string GzhTemplateId1;
private string GzhTemplateId2;
private string TemplateIdSuccess { get; set; } = "";
private string TemplateIdFail { get; set; } = "";
private readonly ILogger<WechatMessagerClient> logger;
@ -56,7 +59,7 @@ namespace _24Hour
httpCliet.DefaultRequestHeaders.Add("Accept", "application/json");
httpCliet.DefaultRequestHeaders.Add("User-Agent", "HttpClientFactory-Sample");
httpCliet.DefaultRequestHeaders.ConnectionClose = true;
_configuration = configuration;
appid =AES.Decrypt( $"{configuration.GetSection("Wechat:appid").Value}");
secret = AES.Decrypt($"{configuration.GetSection("Wechat:secret").Value}");
@ -66,6 +69,9 @@ namespace _24Hour
GzhtemplateId = AES.Decrypt($"{configuration.GetSection("WechatGzh:templateId").Value}");
TemplateIdSuccess = AES.Decrypt($"{configuration.GetSection("Wechat:templateIdSuccess").Value}");
TemplateIdFail = AES.Decrypt($"{configuration.GetSection("Wechat:templateIdFail").Value}");
GzhTemplateId1 = AES.Decrypt($"{configuration.GetSection("WechatGzh:templateId1").Value}");
GzhTemplateId2 = AES.Decrypt($"{configuration.GetSection("WechatGzh:templateId2").Value}");
miniprogram_state = $"{configuration.GetSection("Wechat:miniprogram_state").Value}";
}
//小程序获取openId
public async Task<Result> GetOpenId(string code)
@ -166,9 +172,9 @@ namespace _24Hour
{
touser = useropenId,
//兼容北关区模板id,那边的配置文件没有模板id的字段
template_id = string.IsNullOrEmpty(TemplateIdSuccess) ? "XgrMTq1gwDfMJI6vN0jsSEv3xGy7v3amh0JMWj4SnAY" : TemplateIdSuccess,
template_id = TemplateIdSuccess,
page = "pages/selfService/reception/reception",
miniprogram_state = $"{_configuration.GetSection("Wechat:miniprogram_state").Value}",
miniprogram_state = miniprogram_state,
lang = "zh_CN",
data = new
{
@ -239,10 +245,9 @@ namespace _24Hour
msg = new
{
touser = useropenId,
//兼容北关区模板id,那边的配置文件没有模板id的字段
template_id = string.IsNullOrEmpty(TemplateIdFail) ? "bfA-t5EN4pkQzAOS17SRPRKvmMteaJt0kw3YKIcovIQ" : TemplateIdFail,
template_id = TemplateIdFail,
page = "pages/selfService/reception/reception",
miniprogram_state = $"{_configuration.GetSection("Wechat:miniprogram_state").Value}",
miniprogram_state = miniprogram_state,
lang = "zh_CN",
data = new
{
@ -389,7 +394,7 @@ namespace _24Hour
msg = new
{
touser = useropenId,
template_id = $"{_configuration.GetSection("WechatGzh:templateId1").Value}",
template_id = GzhTemplateId1,
//miniprogram =new{
// appid= appid,
// pagepath= "pages/selfService/reception/reception"
@ -467,7 +472,7 @@ namespace _24Hour
msg = new
{
touser = useropenId,
template_id = $"{_configuration.GetSection("WechatGzh:templateId2").Value}",
template_id = GzhTemplateId2,
//miniprogram =new{
// appid= appid,
// pagepath= "pages/selfService/reception/reception"

9
24Hour/appsettings.json

@ -106,11 +106,18 @@
//
"appid": "RECYZUdJHpWAwXo08m/QJuIjHfS6q5UrCJz+IgmywFY=",
"secret": "e51ZCctUQowt/VJgla/AwbYI4iPcu7yy7YphDTylwYJBmKtAgUh8ITocgrxAStfI",
"templateId": "Kmo3TKZfOrGe95+NVto2SmH93A0x1DgjtVjBIy3I3o46tood38KiDHqI61CAk382"
"templateId": "Kmo3TKZfOrGe95+NVto2SmH93A0x1DgjtVjBIy3I3o46tood38KiDHqI61CAk382",
//
"templateId1": "cCIkyiWffdAJEX4QQyxsmdaPt-JKib5I4rhCflwcebU",
//
"templateId2": "68FkacsufQ5klTZTM4qFcZHfQrsDrAQeiu6R0Chb6B8"
//
//"appid": "wx3a65effe2f8808c3",
//"secret": "e645ec6643cd844ac1129b2eb7680477",
//"templateId": "cwSTQjLRh-xhnpz41jGlPxMty_EOJBlyjuBNGEP6FyU"
//"templateId": "cwSTQjLRh-xhnpz41jGlPxMty_EOJBlyjuBNGEP6FyU"
//"templateId2": "cwSTQjLRh-byAZoJ5yt3ieIUiWBZSdrT/oObHO49dLftjvsdGW3Gvsf/uTC5f0SvFU2mhrq9QQ"
//
//

4
24Hour/build/dockerbuild.txt

@ -1,6 +1,6 @@
create images
docker build -t twentyfoursvc:1.0.2.4 .
docker save -o d://twentyfoursvc.1.0.2.5.tar twentyfoursvc:1.0.2.5
docker save -o d://twentyfoursvc.1.0.3.7.tar twentyfoursvc:1.0.3.7
docker on windows for fake data
create container
docker run --name twentyfoursvc -p 8098:8098 -v D://dockerconfigs/24hourconfig/appsettings.json:/app/appsettings.json -v /etc/localtime:/etc/localtime -d twentyfoursvc:1.0.1.5
@ -201,7 +201,7 @@ for 2.0 proxyclient
docker run --name twentysysproxy.1.0.1.5 -p 5194:5194 -v /home/twentysysproxy/config/appsettings.json:/app/appsettings.json -v /etc/localtime:/etc/localtime --restart=always --link mysql --network twentytotwneyfour --network-alias twentyproxy -d twentysysproxy:1.0.1.5
docker save -o d://twentysysproxy.1.0.1.6.tar twentysysproxy:1.0.1.6

7
Elight.Utility/Encrypt/AES.cs

@ -38,6 +38,8 @@ namespace Elight.Utility.Encrypt
/// <param name="toDecrypt">密文</param>
/// <returns>结果</returns>
public static string Decrypt(string toDecrypt)
{
try
{
byte[] keyArray = Encoding.UTF8.GetBytes("12345678901234567890123456789012");
byte[] toEncryptArray = Convert.FromBase64String(toDecrypt);
@ -54,5 +56,10 @@ namespace Elight.Utility.Encrypt
return Encoding.UTF8.GetString(resultArray);
}
catch
{
return "";
}
}
}
}

Loading…
Cancel
Save