-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lkiuyu
committed
Apr 10, 2022
1 parent
2619061
commit e307e39
Showing
5 changed files
with
277 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace smsmanager | ||
{ | ||
public class HttpHelper | ||
{ | ||
|
||
public static string HttpGet(string Url) | ||
{ | ||
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; | ||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); | ||
request.Method = "GET"; | ||
request.ContentType = "text/html;charset=UTF-8"; | ||
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | ||
Stream myResponseStream = response.GetResponseStream(); | ||
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8); | ||
string retString = myStreamReader.ReadToEnd(); | ||
myStreamReader.Close(); | ||
myResponseStream.Close(); | ||
return retString; | ||
} | ||
|
||
public static string Post(string url, JObject obj) | ||
{ | ||
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; | ||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); | ||
request.Method = "POST"; | ||
request.ContentType = "application/json;charset=UTF-8"; | ||
var streamWriter = new StreamWriter(request.GetRequestStream()); | ||
streamWriter.Write(obj); | ||
streamWriter.Flush(); | ||
streamWriter.Close(); | ||
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | ||
Stream myResponseStream = response.GetResponseStream(); | ||
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.UTF8); | ||
string retString = myStreamReader.ReadToEnd(); | ||
myStreamReader.Close(); | ||
myResponseStream.Close(); | ||
return retString; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
|
||
@{ | ||
Layout = null; | ||
} | ||
|
||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>企业微信转发信息</title> | ||
<meta name="renderer" content="webkit"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | ||
<link rel="stylesheet" href="~/layuimini/lib/layui-v2.5.5/css/layui.css" media="all"> | ||
<link rel="stylesheet" href="~/layuimini/css/public.css" media="all"> | ||
<style> | ||
.layui-form-item .layui-input-company { | ||
width: auto; | ||
padding-right: 10px; | ||
line-height: 38px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="layuimini-container"> | ||
<form class="layui-form" action="WechatfowardStatusChange" method="post"> | ||
<div class="layuimini-main"> | ||
<div class="layui-form layuimini-form"> | ||
<div class="layui-form-item" style="display:none"> | ||
<label class="layui-form-label required">kg</label> | ||
<div class="layui-input-block"> | ||
<input type="text" name="kg" id="kg" value="" lay-verify="required" class="layui-input"> | ||
</div> | ||
</div> | ||
<div class="layui-form-item"> | ||
<label class="layui-form-label required">企业微信转发开关:</label> | ||
<div class="layui-input-block"> | ||
<input type="checkbox" @ViewBag.status name="open" lay-skin="switch" lay-filter="switchTest" lay-text="ON|OFF"> | ||
</div> | ||
</div> | ||
<div class="layui-form-item"> | ||
<label class="layui-form-label required">企业ID:</label> | ||
<div class="layui-input-block"> | ||
<input type="text" name="qyid" value="@ViewBag.qyid" lay-verify="required" class="layui-input" lay-reqtext="企业ID不能为空" placeholder="请输入企业ID"> | ||
</div> | ||
</div> | ||
<div class="layui-form-item"> | ||
<label class="layui-form-label required">自建应用ID:</label> | ||
<div class="layui-input-block"> | ||
<input type="text" name="apid" value="@ViewBag.apid" lay-verify="required" class="layui-input" lay-reqtext="自建应用ID不能为空" placeholder="请输入自建应用ID"> | ||
</div> | ||
</div> | ||
<div class="layui-form-item"> | ||
<label class="layui-form-label required">自建应用密钥:</label> | ||
<div class="layui-input-block"> | ||
<input type="text" name="ApplicationSecret" value="@ViewBag.ApplicationSecret" lay-verify="required|number" class="layui-input" lay-reqtext="自建应用密钥不能为空" placeholder="请输入自建应用密钥"> | ||
</div> | ||
</div> | ||
<div class="layui-form-item"> | ||
<div class="layui-input-block"> | ||
<input type="submit" class="layui-btn layui-btn-normal" value="提交" name="sub" /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
<script src="~/layuimini/lib/layui-v2.5.5/layui.js" charset="utf-8"></script> | ||
<script src="~/layuimini/js/lay-config.js?v=1.0.4" charset="utf-8"></script> | ||
<script> | ||
//监听指定开关 | ||
layui.use(['form'], function () { | ||
var form = layui.form | ||
form.on('switch(switchTest)', function (data) { | ||
document.getElementById("kg").value = this.checked ? 'true' : 'false'; | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters