From 72ccd32e36fbc848740165b01b9a75ba014adf2c Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期二, 28 四月 2026 17:05:39 +0800
Subject: [PATCH] 添加 蓝牙打印机获取 打印模板 API 新增 锦隆 物料条码 80×60 100×60 ZPL指令 打印模板
---
WebAPI/Controllers/WebAPIController.cs | 428 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 416 insertions(+), 12 deletions(-)
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 19f9edd..5251999 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -20,6 +20,7 @@
using WebAPI.Models;
using WebAPI.Service;
using SyntacticSugar.constant;
+using System.Text.RegularExpressions;
namespace WebAPI.Controllers
{
@@ -340,6 +341,7 @@
/// <returns></returns>
[Route("Web/GetUser")]
[HttpGet]
+ [AllowAnonymous]
public object GetUser(string UserName, string PassWord, string HOrgName)
{
try
@@ -384,11 +386,23 @@
}
}
+ if (!oSystemParameter.ShowBill(ref DBUtility.ClsPub.sErrInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鐧诲綍寮傚父锛乀oken 鐢熸垚寮傚父锛屾棤娉曡幏鍙栧叕鍙镐俊鎭紒";
+ }
+
+ string tokenStr = Utility.JWTHelper.GenerateToken(ds.Tables[0].Rows[0]["Czybm"].ToString(), ds.Tables[0].Rows[0]["Czymc"].ToString());
+
+
objjson.code = "0";
objjson.count = 1;
objjson.Message = "[0000-1-073]鐧诲綍鎴愬姛锛�";
objjson.data = ds.Tables[0];
- return objjson;
+ JObject jobjJsonResult = JObject.FromObject(objjson);
+ jobjJsonResult["token"] = tokenStr;
+ return jobjJsonResult;
}
catch (Exception e)
@@ -396,7 +410,7 @@
objjson.code = "0";
objjson.count = 0;
- objjson.Message = "[0000-1-074]鐧诲綍寮傚父锛�" + e.Message;
+ objjson.Message = "[0000-1-074]鐧诲綍寮傚父锛�" + e;
objjson.data = null;
return objjson; ;
}
@@ -2619,6 +2633,7 @@
/// <returns></returns>
[Route("Web/GetDataBases")]
[HttpGet]
+ [AllowAnonymous]
public object GetDataBases()
{
try
@@ -18965,6 +18980,7 @@
/// <returns></returns>
[Route("Web/GetOrganizations")]
[HttpGet]
+ [AllowAnonymous]
public object GetOrganizations()
{
try
@@ -18997,6 +19013,7 @@
/// <returns></returns>
[Route("Web/BaseInfo")]
[HttpGet]
+ [AllowAnonymous]
public object GetBaseInfo()
{
try
@@ -20457,7 +20474,7 @@
{
objjson.code = "0";
objjson.count = 0;
- objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+ objjson.Message = "鑾峰彇澶辫触" + ex.Message.ToString();
objjson.data = null;
return objjson;
}
@@ -20952,7 +20969,18 @@
{
objjson.code = "0";
objjson.count = 0;
- objjson.Message = "鑾峰彇澶辫触,鏄庣粏鏌ユ棤鏁版嵁";
+ if(Type == "DJ")
+ {
+ objjson.Message = "鑾峰彇澶辫触,妯″叿鏃犵粦瀹氱殑鐐规瑙勭▼";
+ }
+ else if (Type == "BY")
+ {
+ objjson.Message = "鑾峰彇澶辫触,妯″叿鏃犵粦瀹氱殑淇濆吇瑙勭▼";
+ }
+ else
+ {
+ objjson.Message = "鑾峰彇澶辫触,鏄庣粏鏌ユ棤鏁版嵁";
+ }
objjson.data = null;
return objjson;
}
@@ -21153,12 +21181,12 @@
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl");
- if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"]) //鏄惁绠$悊鍛�
- {
- //涓嶆槸绠$悊鍛�
- sWhere += " and 鍒跺崟浜� = '" + user + "'";
- }
+ //ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl");
+ //if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"]) //鏄惁绠$悊鍛�
+ //{
+ // //涓嶆槸绠$悊鍛�
+ // sWhere += " and 鍒跺崟浜� = '" + user + "'";
+ //}
string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere + " order by 鏃ユ湡 desc, hmainid desc");
@@ -21765,6 +21793,8 @@
public string HTranslationText_English { get; set; }
public string HTranslationText_Spain { get; set; }
public List<MenuLoad> childMenus { get; set; }
+ public DateTime HMakeDate { get; set; }
+ public string HMaker { get; set; }
}
[Route("Web/MenuList")]
@@ -21871,6 +21901,163 @@
}
#endregion
+
+ #region 鏋勫缓璺敱宓屽瀵硅薄
+ [Route("Web/MenuList_1")]
+ [HttpGet]
+ public object MenuList_1(string HMakeName, string HType)
+ {
+ try
+ {
+ string filePath = HttpContext.Current.Server.MapPath($"~/RouterDisplay/DisplayConfig.json");
+ string directory = Path.GetDirectoryName(filePath);
+ if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+ {
+ Directory.CreateDirectory(directory);
+ }
+ DateTime lastWriteTime = File.GetLastWriteTime(filePath);
+ lastWriteTime = new DateTime(lastWriteTime.Year, lastWriteTime.Month, lastWriteTime.Day, lastWriteTime.Hour, 0, 0);
+ DataSet ds = oCN.RunProcReturn($"select top 1 HMakeDate from Gy_Menu_1_build ORDER BY HMakeDate desc ", "Gy_Menu_1_build");
+
+ DateTime dbTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["HMakeDate"]);
+ dbTime = new DateTime(dbTime.Year, dbTime.Month, dbTime.Day, dbTime.Hour, 0, 0);
+
+ if (dbTime> lastWriteTime)
+ {
+ List<MenuLoad> mu = new List<MenuLoad>(); //浠ョ埗瀛愮骇缁撴瀯瀛樻斁鑿滃崟娓呭崟淇℃伅
+ SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //鏁版嵁搴撴搷浣滃伐鍏�
+ string sql = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HType + "' order by HPosition";
+ ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet"); //鏌ヨ褰撳墠鐢ㄦ埛鐨勮嚜瀹氫箟鑿滃崟鏁版嵁
+ if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鏈夎缃繃鑷畾涔変俊鎭紝鑻ヨ褰曟暟涓�0锛屽垯娌℃湁璁剧疆杩囷紝鍔犺浇鎵�鏈夌殑鑿滃崟淇℃伅
+ {
+ string sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Gy_MenuDefineSet where HMakeName=" +
+ "(select top 1 c.GroupName from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId " +
+ "left join System_UserGroup c on b.GroupId = c.GroupID where a.Czymc ='" + HMakeName + "' order by len(c.GroupName ))";
+ ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet"); //鏌ヨ鐢ㄦ埛缁戝畾鐨勮鑹� 鏄惁璁剧疆鑿滃崟淇℃伅 鍙栬鑹插悕绉版渶鐭殑涓�涓�
+ if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0))
+ {
+ sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Gy_MenuDefineSet where HMakeName = 'admin' and HType = '" + HType + "' order by HPosition";
+ ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet"); //鏌ヨadmin 鏄惁璁剧疆鑿滃崟淇℃伅
+ if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0))
+ {
+ sql = "Select HitemID,HNumber,HName,HPartentID,HLevel,Hurl,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain,HPicNum from Gy_Menu_1_build where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID ";
+ ds = oCn.RunProcReturn(sql, "Gy_Menu_1_build");
+ }
+
+ }
+ }
+
+ for (int i = 0; i < ds.Tables[0].Rows.Count; i++) //灏嗚彍鍗曠殑鏍硅妭鐐逛繚瀛樺埌鍒楄〃menu涓�
+ {
+ if (ds.Tables[0].Rows[i]["HPartentID"].ToString() == "0" || ds.Tables[0].Rows[i]["HitemID"].ToString() == ds.Tables[0].Rows[i]["HPartentID"].ToString()) //鍒ゆ柇鏄惁鏈�澶栧眰鏍硅妭鐐�
+ {
+ MenuLoad tbj = new MenuLoad();
+ tbj.HitemID = ds.Tables[0].Rows[i]["HitemID"].ToString();
+ tbj.HNumber = ds.Tables[0].Rows[i]["HNumber"].ToString();
+ tbj.HName = ds.Tables[0].Rows[i]["HName"].ToString();
+ tbj.HPartentID = ds.Tables[0].Rows[i]["HPartentID"].ToString();
+ tbj.HLevel = int.Parse(ds.Tables[0].Rows[i]["HLevel"].ToString());
+ tbj.Hurl = ds.Tables[0].Rows[i]["Hurl"].ToString();
+ tbj.HShowMode = ds.Tables[0].Rows[i]["HShowMode"].ToString();
+ tbj.HTranslationText_English = ds.Tables[0].Rows[i]["HTranslationText_English"].ToString();
+ tbj.HTranslationText_Spain = ds.Tables[0].Rows[i]["HTranslationText_Spain"].ToString();
+ if (ds.Tables[0].Rows[i]["HPicNum"] != null)
+ {
+ tbj.HPicNum = ds.Tables[0].Rows[i]["HPicNum"].ToString();
+ }
+ mu.Add(tbj);
+ }
+ }
+ diguiLoad(ds.Tables[0], mu); //浣跨敤閫掑綊锛屽皢闇�瑕佸姞杞界殑鏁版嵁浠ョ埗瀛愮骇鐨勭粨鏋勫瓨鏀惧湪mu涓�
+
+
+ objJsonResult.code = "1";//淇″彿鍙傛暟
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
+ objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(mu);
+ return objJsonResult;
+ }
+ else
+ {
+ string josncontext = File.ReadAllText(filePath);
+ objJsonResult.code = "2";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
+ objJsonResult.data = josncontext;
+ return objJsonResult;
+ }
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ澶辫触锛�";
+ objJsonResult.data = e.ToString();
+ return objJsonResult;
+ }
+ }
+
+ public class RequestDto
+ {
+ public string content { get; set; }
+ }
+ [Route("Web/buildRouteObj")]
+ [HttpPost]
+ public object buildRouteObj([FromBody] RequestDto request)
+ {
+ string filePath = HttpContext.Current.Server.MapPath($"~/RouterDisplay/DisplayConfig.json");
+ try
+ {
+ string jsonContent = request.content;
+ if (string.IsNullOrEmpty(jsonContent))
+ {
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "JSON 鍐呭涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrWhiteSpace(filePath))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏂囦欢璺緞涓嶈兘涓虹┖銆傦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string directory = Path.GetDirectoryName(filePath);
+ if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+ {
+ Directory.CreateDirectory(directory);
+ }
+ string contentToWrite = jsonContent;
+
+ File.WriteAllText(filePath, contentToWrite);
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏂囦欢淇濆瓨鎴愬姛锛岃矾寰勪负"+filePath;
+ objJsonResult.data = null;
+ LogService.Write($"璺緞涓簕filePath}");
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+
+ LogService.Write("Exception锛�" + e.ToString());
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+
#region [鑿滃崟鐩綍鑷畾涔塢
@@ -22677,6 +22864,7 @@
/// <returns></returns>
[Route("Web/GetModuleName")]
[HttpGet]
+ [AllowAnonymous]
public object GetModuleName(string HModuleType)
{
try
@@ -23280,6 +23468,7 @@
#region 鐢ㄤ簬杩炴帴鐨勫仴搴峰害妫�楠岋紝鍙鑳借闂�氳繖涓帴鍙o紝鍒欒〃鏄庤繛鎺ュ彲鐢�
[Route("Health")]
[HttpGet]
+ [AllowAnonymous]
public IHttpActionResult CheckHealth()
{
// 杩斿洖 200 鐘舵�佺爜 纭鍋ュ悍鐘舵��
@@ -23746,11 +23935,15 @@
foreach (var param in rawParams)
{
bool isMatched = false;
- // 閬嶅巻鎵�鏈夊伐鑹哄垎绫伙紝鍒ゆ柇鍙傛暟鍚嶆槸鍚﹀寘鍚鍒嗙被鍚嶇О
+ // 閬嶅巻鎵�鏈夊伐鑹哄垎绫伙紝鍒ゆ柇鍙傛暟鍚嶆槸浠ヨ鍒嗙被鍚嶇О寮�澶�
foreach (string category in categoryNames)
{
- if (param.TechParamName.Contains(category))
+ if (param.TechParamName.StartsWith(category))
{
+ if(param.TechParamName.Length != category.Length)
+ {
+ param.TechParamName = param.TechParamName.Substring(category.Length);
+ }
groupedParams[category].Add(param);
isMatched = true;
break; // 鍖归厤鍒扮涓�涓垎绫诲悗鍋滄锛堥伩鍏嶉噸澶嶅尮閰嶏級
@@ -23812,5 +24005,216 @@
}
}
#endregion
+
+ #region APP鐧诲綍鏉冮檺楠岃瘉鎺ュ彛
+ /// <summary>
+ /// APP鐧诲綍鏉冮檺楠岃瘉鎺ュ彛
+ /// </summary>
+ [Route("Auth/CheckAppLoginAuth")]
+ [HttpPost]
+ public object CheckAppLoginAuth()
+ {
+ try
+ {
+ // 鑾峰彇璇锋眰鍙傛暟
+ string orgID = HttpContext.Current.Request.Form["orgID"] ?? "";
+ string orgName = HttpContext.Current.Request.Form["orgName"] ?? "";
+ string serverUrl = HttpContext.Current.Request.Form["serverUrl"] ?? "";
+ string phoneType = HttpContext.Current.Request.Form["phoneType"] ?? "";
+ string userAccount = HttpContext.Current.Request.Form["userAccount"] ?? "";
+ string other = HttpContext.Current.Request.Form["other"] ?? "";
+ // 鍙傛暟楠岃瘉
+ if (string.IsNullOrEmpty(userAccount))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "璐﹀彿涓嶈兘涓虹┖!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrEmpty(orgID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "缁勭粐ID涓嶈兘涓虹┖!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ // 鍙傛暟瀹夊叏澶勭悊锛堥槻姝㈡敞鍏ワ級
+ orgID = orgID.Replace("'", "''");
+ orgName = orgName.Replace("'", "''");
+ serverUrl = serverUrl.Replace("'", "''");
+ phoneType = phoneType.Replace("'", "''");
+ userAccount = userAccount.Replace("'", "''");
+
+ // 鎵ц鍥哄畾瀛樺偍杩囩▼
+ string sql = $"EXEC SP_CheckAppLoginAuth '{orgID}', '{orgName}', '{serverUrl}', '{phoneType}','{userAccount}','{other}'";
+ ds = oCN.RunProcReturn(sql, "SP_CheckAppLoginAuth");
+
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ int result = Convert.ToInt32(ds.Tables[0].Rows[0]["Result"]);
+ string message = ds.Tables[0].Rows[0]["Message"].ToString();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = message;
+ objJsonResult.data = ds.Tables[0];
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "楠岃瘉鎺ュ彛杩斿洖寮傚父!";
+ objJsonResult.data = null;
+ }
+
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 钃濈墮鎵撳嵃鏈鸿幏鍙栨墦鍗版ā鏉�
+ public class PrintRequestDto
+ {
+ public string ptMode { get; set; }
+ public string templateName { get; set; }
+ public JArray msg { get; set; } // 浣犵殑鎵归噺鏁版嵁
+ }
+ /// <summary>
+ /// ptMode: 鎵撳嵃妯″紡锛屽嵆闇�瑕侀偅绉嶆墦鍗版寚浠わ紝CPCL,TSPL,ESC,ZPL 涓�夋嫨
+ /// templateName: 妯℃澘鍚嶏紝鏍规嵁妯℃澘鍘绘寚瀹氱洰褰曚笅鏍规嵁鍚庣紑鎵炬枃浠�
+ /// msg: 鎵撳嵃鍐呭
+ /// </summary>
+ /// <param name="ptMode"></param>
+ /// <param name="templateName"></param>
+ /// <param name="msg"></param>
+ /// <returns></returns>
+ [Route("WebAPI/getBLEPrintTemplate")]
+ [HttpPost]
+ public object getBLEPrintTemplate([FromBody] PrintRequestDto dto)
+ {
+ var ptMode = dto.ptMode;
+ var templateName = dto.templateName;
+ var msg = dto.msg;
+ if (string.IsNullOrWhiteSpace(ptMode))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏈�夋嫨鎵撳嵃妯″紡锛屾棤娉曠敓鎴愭墦鍗版ā鏉�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (string.IsNullOrWhiteSpace(templateName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏈�夋嫨鎵撳嵃妯℃澘锛屾棤娉曠敓鎴愭墦鍗版ā鏉�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string suffix = ".txt";
+ string folder = "ptTemplate";
+ // 鍖归厤 {{ 瀛楁鍚� }} 鎵�闇�姝e垯琛ㄨ揪寮� 鏀寔涓枃
+ var regex = new Regex(@"{{\s*([\u4e00-\u9fa5a-zA-Z0-9_\s]+?)\s*}}", RegexOptions.Compiled);
+
+ if (ptMode == "ZPL")
+ {
+ suffix = ".zpl";
+ folder = "ZPLTemplate";
+ }
+
+ try
+ {
+ // 璇诲彇妯℃澘鏂囦欢
+ string rootPath = System.Web.HttpContext.Current.Server.MapPath("~/");
+ string templateDir = Path.Combine(rootPath, folder);
+ string templateFile = Path.Combine(templateDir, templateName+suffix);
+
+ // 濡傛灉鐩綍涓嶅瓨鍦�
+ if (!Directory.Exists(templateDir))
+ {
+ Directory.CreateDirectory(templateDir);
+ }
+
+ // 濡傛灉鏂囦欢涓嶅瓨鍦�
+ if (!File.Exists(templateFile))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.Message = $"妯℃澘鏂囦欢涓嶅瓨鍦細{templateFile}";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ // 璇诲彇妯℃澘锛圲TF8 鏀寔涓枃锛�
+ string templateContent = File.ReadAllText(templateFile, Encoding.UTF8);
+
+ // 閫愯璇诲彇妯℃澘鏂囦欢
+ var lines = templateContent.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None);
+ var sb = new StringBuilder();
+
+ foreach(JToken JOneKVP in msg)
+ {
+ if(JOneKVP is JObject item)
+ {
+ foreach (var line in lines)
+ {
+ string currentLine = line;
+
+ // 璺宠繃娉ㄩ噴琛� //
+ if (currentLine.TrimStart().StartsWith("//"))
+ {
+ continue;
+ }
+
+ // 姝e垯琛ㄨ揪寮忓尮閰� {{ 瀛楁鍚� }} 鎵�鍦ㄨ鐨勫瓧娈碉紝濡傛灉鏈夛紝鍒欒繘琛屾浛鎹紝娌℃湁锛屽垯榛樿涓虹┖瀛楃涓�
+ currentLine = regex.Replace(currentLine, match =>
+ {
+ string fieldName = match.Groups[1].Value.Trim();
+ if (msg != null && item.ContainsKey(fieldName))
+ {
+ return item[fieldName]?.ToString() ?? "";
+ }
+ return "";
+ });
+ // 灏嗘墍鏈� \n 鐨勬崲琛岀 鏇挎崲涓� \r\n
+
+ sb.Append(currentLine);
+ sb.Append("\r\n"); // 鏍囧噯鎹㈣
+ }
+ }
+ }
+
+
+ string result = sb.ToString().TrimEnd();
+ // 杩斿洖娓叉煋鍚庣殑鎵撳嵃鎸囦护
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = $"妯℃澘娓叉煋鎴愬姛";
+ objJsonResult.data = result;
+ return objJsonResult;
+ }
+ catch (Exception ex)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"妯℃澘娓叉煋澶辫触锛歿ex.Message}";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ }
+ #endregion
}
}
--
Gitblit v1.9.1