YL
2021-09-05 769fcb3a22019a76fd12c13f549610e70f1ad452
nothing
1个文件已添加
2个文件已修改
71 ■■■■■ 已修改文件
CLOUDWEB/CLOUDWEB.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/LogService.cs 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/WebService1.asmx.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/CLOUDWEB.csproj
@@ -317,6 +317,7 @@
    <Compile Include="Global.asax.cs">
      <DependentUpon>Global.asax</DependentUpon>
    </Compile>
    <Compile Include="LogService.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Site.Master.cs">
      <DependentUpon>Site.Master</DependentUpon>
CLOUDWEB/LogService.cs
New file
@@ -0,0 +1,57 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CLOUDWEB
{
    public class LogService
    {
        private static readonly object lockObj = new object();
        #region 日志
        public static void Write(object obj, string filePath = "Vlog", bool isAppend = true)
        {
            try
            {
                lock (lockObj)
                {
                    filePath = $@"{filePath}\webapi{DateTime.Now.ToString("yyyyMMdd")}.txt";
                    filePath = AppDomain.CurrentDomain.BaseDirectory + filePath;
                    if (!System.IO.Directory.Exists(Path.GetDirectoryName(filePath)))
                    {
                        System.IO.Directory.CreateDirectory(Path.GetDirectoryName(filePath));
                    }
                    bool fileExists = System.IO.File.Exists(filePath);
                    //不存在 则创建该文件
                    if (!fileExists)
                    {
                        System.IO.File.Create(filePath).Close();
                    }
                    using (StreamWriter writer = new StreamWriter(filePath, isAppend))
                    {
                        //存在的时候才写一行
                        if (fileExists && isAppend)
                        {
                            writer.WriteLine();
                        }
                        var content = obj is string ? obj : JsonConvert.SerializeObject(obj);
                        writer.WriteLine($"{DateTime.Now} {content}");
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        #endregion
    }
}
CLOUDWEB/WebService1.asmx.cs
@@ -5292,6 +5292,16 @@
                    string dbId = Pub_Class.ClsPub.sCLOUDAcc; //AotuTest117
                    bool bLogin = client.Login(dbId, sCLOUDUseName, sCLOUDPsd, 2052);
                    string msgReport = dbId + ';' + sCLOUDUseName + ';' + sCLOUDPsd + ';' + 2052;
                    LogService.Write($"{Pub_Class.ClsPub.sCLOUDUrl}、{dbId}、{sCLOUDUseName}、{sCLOUDPsd}");
                    LogService.Write(sJson);
                    if (bLogin)
                    {
                        var result = client.Execute<string>("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save",
@@ -5308,7 +5318,8 @@
                            new object[] { "PRD_MORPT", sJson3 }); //审核单据
                            HReturn = result.ToString() + "," + result2.ToString() + "," + result3.ToString();
                            LogService.Write(sJson2);
                            LogService.Write(sJson3);
                        }
                        else
                        {