移动系统liao
2024-08-22 e71dcccec6a1cf51c928a5143264cbbec105ff2f
cylsg/EzUpFile/EzFileUploadService.cs
@@ -10,6 +10,8 @@
using Microsoft.AspNetCore.Http;
using SqlSugar;
using System;
using System.Buffers.Text;
using System.Drawing;
using System.Globalization;
using System.Security.Policy;
@@ -339,6 +341,7 @@
                    idcordinfo = _tcs.IdCord(img64, PageName == "FRONT");
                    url = await UploadFilesFByBase64(_tcs.GetIdCordImg());
                    idcordinfo.AdvancedInfo = null;
                    return (idcordinfo, url);
@@ -487,8 +490,42 @@
                throw Oops.Oh(e.Message);
            }
        }
/// <inheritdoc/>
        public async Task<(bool, string)> IaiAddPerso(string imgBase64, string CoredID, string Name, int PersonGender)
        {
            if (string.IsNullOrEmpty(imgBase64))
            {
                throw Oops.Oh("没有内容");
            }
            //检查上传大小
            if (!CommonHelper.CheckBase64Size(imgBase64, 5))
            {
                throw Oops.Oh("上传文件大小超过限制,最大允许上传" + "5" + "M");
            }
            imgBase64 = imgBase64.Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换
            bool info = false;
            string url = "";
            try
            {
                info = _tcs.IaiAddPerso(imgBase64, CoredID, Name, PersonGender);
                url = await UploadFilesFByBase64(imgBase64);
                return (info, url);
            }
            catch (Exception e)
            {
                throw Oops.Oh(e.Message);
            }
        }
        #endregion
    }
}