@@ -214,6 +214,11 @@ namespace Learun.Application.Organization | |||||
/// </summary> | /// </summary> | ||||
[Column("F_EnrollmentInformation")] | [Column("F_EnrollmentInformation")] | ||||
public string F_EnrollmentInformation { get; set; } | public string F_EnrollmentInformation { get; set; } | ||||
/// <summary> | |||||
/// 统一社会信用代码 | |||||
/// </summary> | |||||
[Column("F_USCREDITCODE")] | |||||
public string F_USCreditCode { get; set; } | |||||
#endregion | #endregion | ||||
#region 扩展操作 | #region 扩展操作 | ||||
@@ -0,0 +1,41 @@ | |||||
using Learun.Util; | |||||
using System.Data; | |||||
using Learun.Application.TwoDevelopment.LR_Desktop; | |||||
using System.Web.Mvc; | |||||
using System.Collections.Generic; | |||||
namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-06-22 10:04 | |||||
/// 描 述:计算项目管理 | |||||
/// </summary> | |||||
public class DataCollectionController : MvcControllerBase | |||||
{ | |||||
private DataCollectionIBLL dataCollectionIBLL = new DataCollectionBLL(); | |||||
#region 视图功能 | |||||
/// <summary> | |||||
/// 主页面 | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public ActionResult Index() | |||||
{ | |||||
return View(); | |||||
} | |||||
#endregion | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult SyncCompany() | |||||
{ | |||||
dataCollectionIBLL.SaveXqjbsj(); | |||||
return Success("操作成功"); | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,28 @@ | |||||
@{ | |||||
ViewBag.Title = "智慧大脑数据采集"; | |||||
Layout = "~/Views/Shared/_Index.cshtml"; | |||||
} | |||||
<div class="lr-layout " > | |||||
<div class="lr-layout-center"> | |||||
<div class="lr-layout-wrap lr-layout-wrap-notitle "> | |||||
<div class="lr-layout-tool"> | |||||
<div class="lr-layout-tool-left"> | |||||
<a id="lr_company" class="btn btn-default"> 校区基础数据</a> | |||||
</div> | |||||
@*<div class="lr-layout-tool-right"> | |||||
<div class=" btn-group btn-group-sm"> | |||||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||||
</div> | |||||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | |||||
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||||
</div> | |||||
</div>*@ | |||||
</div> | |||||
<div class="lr-layout-body" id="gridtable"></div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
@Html.AppendJsFile("/Areas/LR_Desktop/Views/DataCollection/Index.js") |
@@ -0,0 +1,48 @@ | |||||
/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) | |||||
* Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
* 创建人:超级管理员 | |||||
* 日 期:2021-06-22 10:04 | |||||
* 描 述:计算项目管理 | |||||
*/ | |||||
var refreshGirdData; | |||||
var bootstrap = function ($, learun) { | |||||
"use strict"; | |||||
var page = { | |||||
init: function () { | |||||
page.initGird(); | |||||
page.bind(); | |||||
}, | |||||
bind: function () { | |||||
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) { | |||||
page.search(queryJson); | |||||
}, 220, 400); | |||||
$('#Type').lrDataItemSelect({ code: 'projectType' }); | |||||
// 刷新 | |||||
$('#lr_refresh').on('click', function () { | |||||
location.reload(); | |||||
}); | |||||
//校区基础数据 | |||||
$('#lr_company').on('click', function () { | |||||
learun.layerConfirm('是否确认推送校区基础数据!', function (res) { | |||||
if (res) { | |||||
learun.deleteForm(top.$.rootUrl + '/LR_Desktop/DataCollection/SyncCompany', function () { | |||||
refreshGirdData(); | |||||
}); | |||||
} | |||||
}); | |||||
}); | |||||
}, | |||||
// 初始化列表 | |||||
initGird: function () { | |||||
}, | |||||
search: function (param) { | |||||
} | |||||
}; | |||||
refreshGirdData = function () { | |||||
}; | |||||
page.init(); | |||||
} |
@@ -20,6 +20,10 @@ | |||||
<div id="F_ParentId"></div> | <div id="F_ParentId"></div> | ||||
</div> | </div> | ||||
<div class="col-xs-6 lr-form-item"> | <div class="col-xs-6 lr-form-item"> | ||||
<div class="lr-form-item-title">统一社会信用代码<font face="宋体">*</font></div> | |||||
<input id="F_USCreditCode" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||||
</div> | |||||
<div class="col-xs-12 lr-form-item"> | |||||
<div class="lr-form-item-title">成立时间</div> | <div class="lr-form-item-title">成立时间</div> | ||||
<input id="F_FoundedTime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker()" /> | <input id="F_FoundedTime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker()" /> | ||||
</div> | </div> | ||||
@@ -405,6 +405,7 @@ | |||||
<Compile Include="Areas\LR_CRMModule\Controllers\ReceivableController.cs" /> | <Compile Include="Areas\LR_CRMModule\Controllers\ReceivableController.cs" /> | ||||
<Compile Include="Areas\LR_CRMModule\Controllers\TrailRecordController.cs" /> | <Compile Include="Areas\LR_CRMModule\Controllers\TrailRecordController.cs" /> | ||||
<Compile Include="Areas\LR_CRMModule\LR_CRMModuleAreaRegistration.cs" /> | <Compile Include="Areas\LR_CRMModule\LR_CRMModuleAreaRegistration.cs" /> | ||||
<Compile Include="Areas\LR_Desktop\Controllers\DataCollectionController.cs" /> | |||||
<Compile Include="Areas\LR_Desktop\Controllers\DTChartController.cs" /> | <Compile Include="Areas\LR_Desktop\Controllers\DTChartController.cs" /> | ||||
<Compile Include="Areas\LR_Desktop\Controllers\DTListController.cs" /> | <Compile Include="Areas\LR_Desktop\Controllers\DTListController.cs" /> | ||||
<Compile Include="Areas\LR_Desktop\Controllers\DTSettingController.cs" /> | <Compile Include="Areas\LR_Desktop\Controllers\DTSettingController.cs" /> | ||||
@@ -1453,6 +1454,7 @@ | |||||
<Content Include="Areas\LR_CRMModule\Views\Receivable\ReceiptForm.js" /> | <Content Include="Areas\LR_CRMModule\Views\Receivable\ReceiptForm.js" /> | ||||
<Content Include="Areas\LR_CRMModule\Views\Receivable\ReportIndex.js" /> | <Content Include="Areas\LR_CRMModule\Views\Receivable\ReportIndex.js" /> | ||||
<Content Include="Areas\LR_CRMModule\Views\TrailRecord\Index.js" /> | <Content Include="Areas\LR_CRMModule\Views\TrailRecord\Index.js" /> | ||||
<Content Include="Areas\LR_Desktop\Views\DataCollection\Index.js" /> | |||||
<Content Include="Areas\LR_Desktop\Views\DTSetting\App\AppIndex.css" /> | <Content Include="Areas\LR_Desktop\Views\DTSetting\App\AppIndex.css" /> | ||||
<Content Include="Areas\LR_Desktop\Views\DTSetting\App\AppIndex.js" /> | <Content Include="Areas\LR_Desktop\Views\DTSetting\App\AppIndex.js" /> | ||||
<Content Include="Areas\LR_Desktop\Views\DTSetting\PC\PcIndex.css" /> | <Content Include="Areas\LR_Desktop\Views\DTSetting\PC\PcIndex.css" /> | ||||
@@ -7693,6 +7695,7 @@ | |||||
<Content Include="Areas\EducationalAdministration\Views\StuScore\AllStuScoreQueryIndex.cshtml" /> | <Content Include="Areas\EducationalAdministration\Views\StuScore\AllStuScoreQueryIndex.cshtml" /> | ||||
<Content Include="Areas\EducationalAdministration\Views\TextBookSolSub\StatisticsIndex.cshtml" /> | <Content Include="Areas\EducationalAdministration\Views\TextBookSolSub\StatisticsIndex.cshtml" /> | ||||
<Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexImport.cshtml" /> | <Content Include="Areas\LogisticsManagement\Views\Accommodation\IndexImport.cshtml" /> | ||||
<Content Include="Areas\LR_Desktop\Views\DataCollection\Index.cshtml" /> | |||||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | <None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | ||||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | <None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | ||||
<Content Include="Views\Login\Default-beifen.cshtml" /> | <Content Include="Views\Login\Default-beifen.cshtml" /> | ||||
@@ -104,14 +104,12 @@ | |||||
<!-- ================== 长阳智慧大脑数据采集 ================== --> | <!-- ================== 长阳智慧大脑数据采集 ================== --> | ||||
<!--接口地址--> | <!--接口地址--> | ||||
<add key="CYInsUrl" value="http://202.205.188.198:9000" /> | <add key="CYInsUrl" value="http://202.205.188.198:9000" /> | ||||
<!--授权类型--> | |||||
<add key="CYGrant_type" value="bjquanjiang" /> | |||||
<!--客户标识--> | <!--客户标识--> | ||||
<add key="CYClient_id" value="bjquanjiang" /> | |||||
<add key="CYClient_id" value="1" /> | |||||
<!--用户名--> | <!--用户名--> | ||||
<add key="CYUsername" value="bjquanjiang" /> | |||||
<add key="CYUsername" value="cytjzzzxzyjyzx" /> | |||||
<!--密码--> | <!--密码--> | ||||
<add key="CYPassword" value="bjquanjiang" /> | |||||
<add key="CYPassword" value="zLsSOh1drDuXBas3" /> | |||||
<!-- ================== 统一身份认证公钥密钥 ================== --> | <!-- ================== 统一身份认证公钥密钥 ================== --> | ||||
<add key="SSOPublicSecret" value="bjquanjiang" /> | <add key="SSOPublicSecret" value="bjquanjiang" /> | ||||
@@ -42,9 +42,27 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||||
// } | // } | ||||
// } | // } | ||||
//} | //} | ||||
#endregion | |||||
#endregion | |||||
public void SaveXqjbsj() | |||||
{ | |||||
try | |||||
{ | |||||
dataCollectionService.SaveXqjbsj(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
} | } |
@@ -4,24 +4,8 @@ using System.Collections.Generic; | |||||
namespace Learun.Application.TwoDevelopment.LR_Desktop | namespace Learun.Application.TwoDevelopment.LR_Desktop | ||||
{ | { | ||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-06-22 10:04 | |||||
/// 描 述:计算项目管理 | |||||
/// </summary> | |||||
public interface DataCollectionIBLL | public interface DataCollectionIBLL | ||||
{ | { | ||||
#region 获取数据 | |||||
///// <summary> | |||||
///// 获取页面显示列表数据 | |||||
///// </summary> | |||||
///// <param name="queryJson">查询参数</param> | |||||
///// <returns></returns> | |||||
//IEnumerable<CalculateProjectEntity> GetPageList(Pagination pagination, string queryJson); | |||||
#endregion | |||||
void SaveXqjbsj(); | |||||
} | } | ||||
} | } |
@@ -5,20 +5,21 @@ using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Configuration; | using System.Configuration; | ||||
using System.Data; | using System.Data; | ||||
using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using Learun.Application.Organization; | |||||
using Learun.Application.Base.SystemModule; | |||||
using Learun.Cache.Redis; | |||||
namespace Learun.Application.TwoDevelopment.LR_Desktop | namespace Learun.Application.TwoDevelopment.LR_Desktop | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-06-22 10:04 | |||||
/// 描 述:计算项目管理 | |||||
/// 智慧大脑数据采集 | |||||
/// </summary> | /// </summary> | ||||
public class DataCollectionService : RepositoryFactory | public class DataCollectionService : RepositoryFactory | ||||
{ | { | ||||
CacheByRedis _redis = new CacheByRedis(); | |||||
#region 获取数据 | #region 获取数据 | ||||
//接口地址 | //接口地址 | ||||
private static string InsUrl = ConfigurationManager.AppSettings["CYInsUrl"]; | private static string InsUrl = ConfigurationManager.AppSettings["CYInsUrl"]; | ||||
@@ -28,57 +29,164 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||||
private static string username = ConfigurationManager.AppSettings["CYUsername"]; | private static string username = ConfigurationManager.AppSettings["CYUsername"]; | ||||
//密码 | //密码 | ||||
private static string password = ConfigurationManager.AppSettings["CYPassword"]; | private static string password = ConfigurationManager.AppSettings["CYPassword"]; | ||||
//数据采集接口地址 | |||||
private static string saveIncrUrl = InsUrl + "/prod-api/api/web/collect/interface/saveIncrData"; | |||||
////令牌 | |||||
//private string access_token; | |||||
////刷新密钥 | |||||
//private string client_secret; | |||||
////刷新令牌 | |||||
//private string refresh_token; | |||||
//令牌 | |||||
private string access_token; | |||||
//刷新密钥 | |||||
private string client_secret; | |||||
//刷新令牌 | |||||
private string refresh_token; | |||||
private DataCollectionService() | |||||
public DataCollectionService() | |||||
{ | |||||
try | |||||
{ | |||||
var refresh_token = _redis.Read<string>("refresh_token"); | |||||
var access_token = _redis.Read<string>("access_token"); | |||||
if (string.IsNullOrEmpty(refresh_token) || string.IsNullOrEmpty(_redis.Read<string>("access_token"))) | |||||
{ | |||||
//用户授权 | |||||
login(); | |||||
} | |||||
else if (!string.IsNullOrEmpty(refresh_token) && string.IsNullOrEmpty(_redis.Read<string>("access_token"))) | |||||
{ | |||||
//刷新token | |||||
refresh(); | |||||
} | |||||
} | |||||
catch (ExceptionEx ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 用户授权 | |||||
/// </summary> | |||||
private void login() | |||||
{ | { | ||||
//用户授权 | |||||
var login_url = InsUrl + "/prod-api/api/web/collect/oauth2/login"; | |||||
var login_param = "{\"grant_type\":" + "" + ",\"client_id\":\"" + client_id + "\",\"username\":\"" + username + "\",\"password\":\"" + password + "\"}"; | |||||
var login_res_str = HttpMethods.Post(login_url, login_param); | |||||
var login_url = InsUrl + "/prod-api/api/web/collect/oauth2/login?grant_type=password&client_id=" + client_id + "&username=" + username + "&password=" + password; | |||||
var login_res_str = HttpMethods.Get(login_url); | |||||
var login_res = JsonConvert.DeserializeObject<InsResult>(login_res_str); | var login_res = JsonConvert.DeserializeObject<InsResult>(login_res_str); | ||||
var login_data = login_res.data; | var login_data = login_res.data; | ||||
access_token = ((dynamic)login_data).access_token; | |||||
_redis.Write($"access_token", ((dynamic)login_data)?.access_token, TimeSpan.FromSeconds(250)); | |||||
_redis.Write($"client_secret", ((dynamic)login_data)?.client_secret, TimeSpan.FromSeconds(170000)); | |||||
_redis.Write($"refresh_token", ((dynamic)login_data)?.refresh_token, TimeSpan.FromSeconds(250)); | |||||
} | |||||
/// <summary> | |||||
/// 刷新token | |||||
/// </summary> | |||||
private void refresh() | |||||
{ | |||||
var client_secret = (_redis.Read<string>("client_secret"))?.Replace("\"",""); | |||||
var refresh_token = (_redis.Read<string>("refresh_token"))?.Replace("\"", ""); | |||||
var refresh_url = | |||||
InsUrl + "/prod-api/api/web/collect/oauth2/refresh?grant_type=refresh_token&client_id=" + | |||||
client_id + "&client_secret=" + client_secret + "&refresh_token=" + refresh_token; | |||||
var refresh_res_str = HttpMethods.Get(refresh_url); | |||||
var refresh_res = JsonConvert.DeserializeObject<InsResult>(refresh_res_str); | |||||
if (refresh_res == null || ((dynamic)refresh_res)?.code != 200) | |||||
{ | |||||
_redis.Write($"refresh_token", "", TimeSpan.FromSeconds(60)); | |||||
//接口返回失败重新调用授权接口 | |||||
login(); | |||||
return; | |||||
} | |||||
_redis.Write($"access_token", ((dynamic)refresh_res)?.access_token, TimeSpan.FromSeconds(250)); | |||||
_redis.Write($"refresh_token", ((dynamic)refresh_res)?.refresh_token, TimeSpan.FromSeconds(250)); | |||||
} | |||||
/// <summary> | |||||
/// 校区基础数据 | |||||
/// </summary> | |||||
public void SaveXqjbsj() | |||||
{ | |||||
try | |||||
{ | |||||
var connect = (_redis.Read<string>("access_token")).Replace("\"", ""); | |||||
//校区信息 | |||||
var entity = this.BaseRepository().FindList<CompanyEntity>(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); | |||||
var pro = entity.F_ProvinceId.Substring(0, 2); | |||||
//区域信息 | |||||
var area = this.BaseRepository() | |||||
.FindList<AreaEntity>($"select * from LR_Base_Area where F_AreaId like '{pro}%'"); | |||||
var empCount = this.BaseRepository("CollegeMIS").FindObject($"select count(1) from EmpInfo where CheckMark = 1"); | |||||
var stuCount = this.BaseRepository("CollegeMIS").FindObject($"select count(1) from StuInfoBasic where CheckMark = 1"); | |||||
ParamModel paramModel = new ParamModel(); | |||||
paramModel.dataObjName = "ods_xqjcsj"; | |||||
var list = new List<object>(); | |||||
var param = new | |||||
{ | |||||
xygkjcsjid = entity.F_CompanyId, | |||||
provincejgbm = entity.F_ProvinceId, | |||||
provincejgmc = area.Where(x => x.F_AreaId == entity.F_ProvinceId).FirstOrDefault().F_AreaName, | |||||
cityjgbm = entity.F_CityId, | |||||
cityjgmc = area.Where(x => x.F_AreaId == entity.F_CityId).FirstOrDefault().F_AreaName, | |||||
countyjgbm = entity.F_CountyId, | |||||
countyjgmc = area.Where(x => x.F_AreaId == entity.F_CountyId).FirstOrDefault().F_AreaName, | |||||
//统一社会信用代码 | |||||
xxjgdm = entity.F_USCreditCode, | |||||
xxjgmc = entity.F_FullName, | |||||
xqbh = entity.F_EnCode, | |||||
xqmc = entity.F_FullName, | |||||
xqjc = entity.F_SortCode, | |||||
xqszdxzqh = "", | |||||
xqdz = "", | |||||
xqyzbm = "", | |||||
xqlxdh = "", | |||||
xqfzr = "", | |||||
//校区教职工总数 | |||||
xqjzgzs = empCount, | |||||
//校区学生总数 | |||||
xqxszs = stuCount, | |||||
xqclrq = "", | |||||
sjcjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") | |||||
}; | |||||
list.Add(param); | |||||
paramModel.fileds = list; | |||||
var json = JsonConvert.SerializeObject(paramModel); | |||||
var res = HttpMethods.HttpPostConnect(saveIncrUrl, json, connect); | |||||
} | |||||
catch (ExceptionEx ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | } | ||||
///// <summary> | |||||
///// 获取CalculateProject表实体数据 | |||||
///// </summary> | |||||
///// <param name="keyValue">主键</param> | |||||
///// <returns></returns> | |||||
//public CalculateProjectEntity GetCalculateProjectEntity(string keyValue) | |||||
//{ | |||||
// try | |||||
// { | |||||
// return this.BaseRepository("CollegeMIS").FindEntity<CalculateProjectEntity>(keyValue); | |||||
// } | |||||
// catch (Exception ex) | |||||
// { | |||||
// if (ex is ExceptionEx) | |||||
// { | |||||
// throw; | |||||
// } | |||||
// else | |||||
// { | |||||
// throw ExceptionEx.ThrowServiceException(ex); | |||||
// } | |||||
// } | |||||
//} | |||||
#endregion | #endregion | ||||
#region MyRegion | |||||
public class InsResult | public class InsResult | ||||
{ | { | ||||
public int code { get; set; } | public int code { get; set; } | ||||
public string msg { get; set; } | public string msg { get; set; } | ||||
public object data { get; set; } | public object data { get; set; } | ||||
} | } | ||||
public class ParamModel | |||||
{ | |||||
public string dataObjName { get; set; } | |||||
public List<object> fileds { get; set; } | |||||
} | |||||
#endregion | |||||
} | } | ||||
} | } |
@@ -191,7 +191,7 @@ namespace Learun.Util | |||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); | HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); | ||||
req.Method = "POST"; | req.Method = "POST"; | ||||
req.ContentType = "application/json;charset=UTF-8"; | req.ContentType = "application/json;charset=UTF-8"; | ||||
req.Headers.Add("Connect", connect); | |||||
req.Headers.Add("connect", connect); | |||||
byte[] data = Encoding.UTF8.GetBytes(json);//把字符串转换为字节 | byte[] data = Encoding.UTF8.GetBytes(json);//把字符串转换为字节 | ||||