Преглед изворни кода

处理存储在table表的第三方信息接口

Li пре 2 година
родитељ
комит
bdda4a53f4

+ 0 - 284
TEAMModelBI/Controllers/BITable/CompanyUserController.cs

@@ -1,284 +0,0 @@
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Options;
-using System;
-using System.Collections.Generic;
-using System.Text.Json;
-using System.Threading.Tasks;
-using TEAMModelBI.Models;
-using TEAMModelOS.Models;
-using TEAMModelOS.SDK.Context.BI;
-using TEAMModelOS.SDK.Context.Constant;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.Extension;
-using TEAMModelOS.SDK.Models;
-using TEAMModelOS.SDK.Models.Table;
-
-namespace TEAMModelBI.Controllers.BITable
-{
-    [Route("bizusertable")]
-    [ApiController]
-    public class CompanyUserController : ControllerBase
-    {
-        public readonly AzureCosmosFactory _azureCosmos;
-        public readonly AzureStorageFactory _azureStorage;
-        public readonly DingDing _dingDing;
-        public readonly Option _option;
-
-        public CompanyUserController(AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option)
-        {
-            _azureCosmos = azureCosmos;
-            _azureStorage = azureStorage;
-            _dingDing = dingDing;
-            _option = option?.Value;
-        }
-
-        /// <summary>
-        /// 新增和修改第三方用户信息
-        /// </summary>
-        /// <param name="bizUser"></param>
-        /// <param name="site"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("set-bizuser")]
-        public async Task<IActionResult> SetBizUser([FromBody] BusinessUser bizUser, [FromHeader] string site)
-        {
-            var tableClient = _azureStorage.GetCloudTableClient();
-            if ($"{site}".Equals(BIConst.Global))
-            {
-                tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
-            }
-
-            var table = tableClient.GetTableReference("IESOpenApi");
-            if (bizUser.RowKey != null)
-            {
-                BusinessUser tempUser = table.Get<BusinessUser>(partitionKey: "BusinessUser", rowKey: $"{bizUser.RowKey}");
-                if (tempUser != null)
-                {
-                    bizUser.PartitionKey = "BusinessUser";
-                    bizUser = await table.SaveOrUpdate<BusinessUser>(bizUser);
-                }
-                else
-                {
-                    bizUser.PartitionKey = "BusinessUser";
-                    bizUser.RowKey = Guid.NewGuid().ToString();
-                    string salt = Utils.CreatSaltString(8);
-                    bizUser.salt = string.IsNullOrEmpty(bizUser.pwd) ? Utils.HashedPassword(bizUser.mobile, salt) : Utils.HashedPassword(bizUser.pwd, salt);
-
-                    bizUser = await table.SaveOrUpdate<BusinessUser>(bizUser);
-                }
-            }
-            else
-            {
-                bizUser.PartitionKey = "BusinessUser";
-                bizUser.RowKey = Guid.NewGuid().ToString();
-                string salt = Utils.CreatSaltString(8);
-                bizUser.salt = string.IsNullOrEmpty(bizUser.pwd) ? Utils.HashedPassword(bizUser.mobile, salt) : Utils.HashedPassword(bizUser.pwd, salt);
-
-                bizUser = await table.SaveOrUpdate<BusinessUser>(bizUser);
-            }
-
-            return Ok(new { state = 200, bizUser });
-        }
-
-        /// <summary>
-        /// 重置密码
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("res-pwd")]
-        public async Task<IActionResult> ResetPwd(JsonElement jsonElement) 
-        {
-            try
-            {
-                if (jsonElement.TryGetProperty("mobile", out JsonElement mobile)) return BadRequest();
-                jsonElement.TryGetProperty("pwd", out JsonElement pwd);
-                jsonElement.TryGetProperty("site", out JsonElement site);
-
-                var tableClient = _azureStorage.GetCloudTableClient();
-                if ($"{site}".Equals(BIConst.Global))
-                {
-                    tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
-                }
-                var table = tableClient.GetTableReference("IESOpenApi");
-
-                List<BusinessUser> bizUsers = await table.QueryWhereString<BusinessUser>($" PartitionKey eq 'BusinessUser' and mobile eq '{mobile}'");
-
-                string salt = Utils.CreatSaltString(8);
-                string resPwd = string.IsNullOrEmpty($"{pwd}") ? Utils.HashedPassword($"{mobile}", salt) : Utils.HashedPassword($"{pwd}", salt);
-                foreach (var item in bizUsers)
-                {
-                    item.salt = salt;
-                    item.pwd = resPwd;
-                }
-
-                bizUsers = await table.SaveOrUpdateAll<BusinessUser>(bizUsers);
-
-                //BusinessUser bizUser = table.Get<BusinessUser>(partitionKey: "BusinessUser", rowKey: $"{mobile}");
-                //bizUser.RowKey = Guid.NewGuid().ToString();
-                //bizUser.pwd = string.IsNullOrEmpty($"{pwd}") ? Utils.HashedPassword(bizUser.mobile, salt) : Utils.HashedPassword(bizUser.pwd, salt);
-                //bizUser = await table.SaveOrUpdate<BusinessUser>(bizUser);
-
-                return Ok(new { state = 200, bizUsers });
-            }
-            catch (Exception e)
-            {
-                await _dingDing.SendBotMsg($"open ,{_option.Location} , /business/set-companyschool   \n {e.Message}\n{e.StackTrace} \n ", GroupNames.成都开发測試群組);
-                return BadRequest();
-            }
-        }
-
-        /// <summary>
-        /// 查询用户信息
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("get-infos")]
-        public async Task<IActionResult> GetInfos(JsonElement jsonElement) 
-        {
-            if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
-            jsonElement.TryGetProperty("site", out JsonElement site);
-
-            var tableClient = _azureStorage.GetCloudTableClient();
-            if ($"{site}".Equals(BIConst.Global))
-            {
-                tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
-            }
-            var table = tableClient.GetTableReference("IESOpenApi");
-            List<BusinessUser> bizUsers = await table.QueryWhereString<BusinessUser>($" PartitionKey eq 'BusinessUser' and tmdId eq '{tmdId}'");
-
-            return Ok(new { state = 200 , bizUsers });
-        }
-
-        /// <summary>
-        /// 关联用户和企业
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("set-userrebiz")]
-        public async Task<IActionResult> SetUserReBiz(JsonElement jsonElement) 
-        {
-            if(!jsonElement.TryGetProperty("userRowKey", out JsonElement userRowKey)) return BadRequest();
-            if (!jsonElement.TryGetProperty("bizRowKey", out JsonElement bizRowKey)) return BadRequest();
-            if (!jsonElement.TryGetProperty("bizName", out JsonElement bizName)) return BadRequest();
-            jsonElement.TryGetProperty("roles", out JsonElement roles);
-            jsonElement.TryGetProperty("site", out JsonElement site);
-
-            var tableClient = _azureStorage.GetCloudTableClient();
-            if ($"{site}".Equals(BIConst.Global))
-            {
-                tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
-            }
-            var table = tableClient.GetTableReference("IESOpenApi");
-            BizRelUser findBizRelUser = table.Get<BizRelUser>("BizRelUser", $"{userRowKey}|{bizRowKey}");
-
-            if (findBizRelUser == null)
-            {
-                BizRelUser bizRelUser = new() { PartitionKey = "BizRelUser", RowKey = $"{userRowKey}|{bizRowKey}", userId = $"{userRowKey}", bizId = $"{bizRowKey}", bizName = $"{bizName}", roles = string.IsNullOrEmpty($"{roles}") ? "develo" : $"{roles}" };
-                await table.SaveOrUpdate<BizRelUser>(bizRelUser);
-                return Ok(new { state = RespondCode.Ok, bizRelUser });
-            }
-            else return Ok(new { state = RespondCode.NotFound,msg="该账户已经是该企业的用户" });
-        }
-
-        /// <summary>
-        /// 获取账户关联的企业信息
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("get-userrebizs")]
-        public async Task<IActionResult> GetUserReBizs(JsonElement jsonElement)
-        {
-            jsonElement.TryGetProperty("userId", out JsonElement userId);
-            jsonElement.TryGetProperty("site", out JsonElement site);
-
-            var tableClient = _azureStorage.GetCloudTableClient();
-            if ($"{site}".Equals(BIConst.Global))
-            {
-                tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
-            }
-            var table = tableClient.GetTableReference("IESOpenApi");
-
-            List<BizRelUser> bizRelUsers = new();
-            List<RelBizInfo> relBizInfos = new();
-
-            if (!string.IsNullOrEmpty($"{userId}"))
-                bizRelUsers = await table.QueryWhereString<BizRelUser>($"PartitionKey eq 'BizRelUser' and userId eq '{userId}'");
-            else
-                //bizRelUsers = await table.FindListByDict<BizRelUser>(new Dictionary<string, object>() { { "PartitionKey ", "BizRelUser" } });
-                bizRelUsers = await table.QueryWhereString<BizRelUser>($"PartitionKey eq 'BizRelUser'");
-            if (bizRelUsers.Count > 0) 
-            {
-                if (bizRelUsers.Count > 0)
-                {
-                    foreach (var item in bizRelUsers)
-                    {
-                        BusinessConfig businessConfig = table.Get<BusinessConfig>("BusinessConfig", item.bizId);
-                        RelBizInfo relBizInfo = new()
-                        {
-                            userRowKey = item.userId,
-                            relId = item.RowKey,
-                            bizRowKey = item.bizId,
-                            roles = !string.IsNullOrEmpty($"{item.roles}") ? new List<string>(item.roles.Split(',')) : new List<string>()
-                        };
-                        if (businessConfig != null)
-                        {
-                            relBizInfo.bizName = businessConfig.name;
-                            relBizInfo.bizCredit = businessConfig.credit;
-                            relBizInfo.bizPicture = businessConfig.picture;
-                            relBizInfos.Add(relBizInfo);
-                        }
-                    }
-                }
-            }
-
-            return Ok(new { state = RespondCode.Ok, relBizInfos });
-        }
-
-        /// <summary>
-        /// 获取企业用户信息
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [HttpPost("get-bizusers")]
-        public async Task<IActionResult> GetBizUsers(JsonElement jsonElement) 
-        {
-            if (!jsonElement.TryGetProperty("bizId", out JsonElement bizId)) return BadRequest();
-            jsonElement.TryGetProperty("site", out JsonElement site);
-
-            var tableClient = _azureStorage.GetCloudTableClient();
-            if ($"{site}".Equals(BIConst.Global))
-            {
-                tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
-            }
-
-            var table = tableClient.GetTableReference("IESOpenApi");
-            List<bizUsers> bizUsers = new();
-            string bizSql = $" PartitionKey eq 'BizRelUser' and bizId eq '{bizId}'";
-
-            List<BizRelUser> bizRelUsers = await table.QueryWhereString<BizRelUser>(bizSql);
-            foreach (var item in bizRelUsers)
-            {
-                BusinessUser busUser = table.Get<BusinessUser>("BusinessUser", $"{item.userId}");
-                bizUsers bizUser = new() { RowKey = $"{busUser.RowKey}", name = busUser.name, mail = busUser.mail, mobile = busUser.mobile, roles = !string.IsNullOrEmpty(item.roles) ? new List<string>(item.roles.Split(',')) : new List<string>() };
-                bizUsers.Add(bizUser);
-            }
-
-            return Ok(new { state = 200, bizUsers });
-        }
-
-        public record bizUsers
-        {
-            public string RowKey { get; set; }
-            public string name { get; set; }
-            public string mail { get; set; }
-            public string mobile { get; set; }
-            public List<string> roles { get; set; }
-        }
-
-    }
-}

+ 0 - 191
TEAMModelBI/Controllers/LoginController.cs

@@ -584,166 +584,6 @@ namespace TEAMModelBI.Controllers
             }
         }
 
-        /// <summary>
-        /// 企业登录
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("get-bizuserlogin")]
-        public async Task<IActionResult> GetCommpanyLogin(JsonElement jsonElement)
-        {
-            jsonElement.TryGetProperty("mobile", out JsonElement mobile);
-            jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
-            jsonElement.TryGetProperty("mail", out JsonElement mail);
-            if (!jsonElement.TryGetProperty("pwd", out JsonElement password)) return BadRequest();
-            jsonElement.TryGetProperty("site", out JsonElement site);
-
-            string Website = "China";
-            var cosmosClient = _azureCosmos.GetCosmosClient();
-            var tableClient = _azureStorage.GetCloudTableClient();
-            var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
-            if ($"{site}".Equals(BIConst.Global))
-            {
-                cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
-                tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
-                blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
-                Website = BIConst.Global;
-            }
-            Dictionary<string, object> tableDic = new();
-            string tableSql = null;
-            if (!string.IsNullOrEmpty($"{mail}")) 
-            {
-                tableSql = $" PartitionKey eq 'BusinessUser' and mail eq '{mail}'";
-                tableDic = new Dictionary<string, object>() { { "PartitionKey", "BizRelUser" }, { "mail", $"{mail}" } };
-            }
-            if (!string.IsNullOrEmpty($"{tmdId}"))
-            {
-                tableSql = $" PartitionKey eq 'BusinessUser' and tmdId eq '{tmdId}'";
-                tableDic = new Dictionary<string, object>() { { "PartitionKey", "BizRelUser" }, { "tmdId", $"{tmdId}" } };
-            }
-            if (!string.IsNullOrEmpty($"{mobile}"))
-            {
-                tableSql = $" PartitionKey eq 'BusinessUser' and mobile eq '{mobile}'";
-                tableDic = new Dictionary<string, object>() { { "PartitionKey", "BizRelUser" }, { "mobile", $"{mobile}" } };
-            }
-
-            if (!string.IsNullOrEmpty(tableSql))
-            {
-                var table = tableClient.GetTableReference("IESOpenApi");
-                List<BusinessUser> findBizUsers = await table.QueryWhereString<BusinessUser>(tableSql);
-                //List<BusinessUser> findBizUsers = await table.FindListByDict<BusinessUser>(tableDic);
-                if (findBizUsers.Count > 0)
-                {
-                    BusinessUser bizUser = new();
-                    foreach (var item in findBizUsers)
-                    {
-                        bizUser.PartitionKey = item.PartitionKey;
-                        bizUser.RowKey = item.RowKey;
-                        bizUser.name = item.name;
-                        bizUser.picture = item.picture;
-                        bizUser.tmdId = item.tmdId;
-                        bizUser.mobile = item.mobile;
-                        bizUser.mail = item.mail;
-                        bizUser.salt = item.salt;
-                        bizUser.pwd = item.pwd;
-                    }
-                    List<BizRelUser> bizRelUsers = new();
-
-                    List<RelBizInfo> relBizInfos = new();
-                    if (bizUser != null) 
-                    {
-                        string tableSqlUser = $"PartitionKey eq 'BizRelUser' and userId eq '{bizUser.RowKey}'";
-                        bizRelUsers = await table.QueryWhereString<BizRelUser>(tableSqlUser);
-                        if (bizRelUsers.Count > 0) 
-                        {
-                            foreach (var item in bizRelUsers)
-                            {
-                                BusinessConfig businessConfig = table.Get<BusinessConfig>("BusinessConfig", item.bizId);
-                                RelBizInfo relBizInfo = new()
-                                {
-                                    userRowKey = item.userId,
-                                    relId = item.RowKey,
-                                    bizRowKey = item.bizId,
-                                    roles = !string.IsNullOrEmpty($"{item.roles}") ? new List<string>(item.roles.Split(',')) : new List<string>()
-                                };
-                                if (businessConfig != null) 
-                                {
-                                    relBizInfo.bizName = businessConfig.name;
-                                    relBizInfo.bizCredit = businessConfig.credit;
-                                    relBizInfo.bizPicture = businessConfig.picture;
-                                    relBizInfos.Add(relBizInfo);
-                                }
-                            }
-                        }
-                    }
-                    var hashedPw = Utils.HashedPassword(password.ToString(), bizUser.salt.ToString());
-                    if (hashedPw.Equals(bizUser.pwd))
-                    {
-                        //string id_token = JwtAuth.CreateAuthTokenBI(_option.HostName, bizUser.RowKey?.ToString(), bizUser.name?.ToString(), bizUser.picture?.ToString(), _option.JwtSecretKey, scope: "company", webSite: Website, expire: 3);
-                        string openid_token = JwtAuthExtension.CreateBizLoginAuthToken(_option.HostName, bizUser.RowKey?.ToString(), bizUser.name?.ToString(), bizUser.picture?.ToString(),$"{Website}-Open",_option.JwtSecretKey, expire: 3);
-
-                        await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "tabledd-update", $"{bizUser.name}【{bizUser.RowKey}】登录商务智能开放平台", _dingDing, tid: bizUser.RowKey, tname: bizUser.name, twebsite: Website?.ToString(), httpContext: HttpContext);
-                        return Ok(new { state = RespondCode.Ok, openid_token, bizUser, relBizInfos });
-                    }
-                    else return Ok(new { state = RespondCode.ForbiddenPwd, msg = "密码错误!" });
-                }
-                else return Ok(new { state = RespondCode.NotFound, msg = "该账户不存在" });                
-            }
-            else return Ok(new { state = RespondCode.ParamsError, msg = "参数错误" });
-        }
-
-        /// <summary>
-        /// 用户信息注册
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [HttpPost("set-ropen")]
-        public async Task<IActionResult> SetRegistered(JsonElement jsonElement)
-        {
-            if (!jsonElement.TryGetProperty("name", out JsonElement name)) return BadRequest();
-            if (!jsonElement.TryGetProperty("mobile", out JsonElement mobile)) return BadRequest();
-            jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
-            jsonElement.TryGetProperty("mail", out JsonElement mail);
-            jsonElement.TryGetProperty("pwd", out JsonElement pwd);
-
-            jsonElement.TryGetProperty("site", out JsonElement site);
-
-            string Website = "China";
-            var cosmosClient = _azureCosmos.GetCosmosClient();
-            var tableClient = _azureStorage.GetCloudTableClient();
-            var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
-            if ($"{site}".Equals(BIConst.Global))
-            {
-                cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
-                tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
-                blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
-                Website = BIConst.Global;
-            }
-
-            var table = tableClient.GetTableReference("IESOpenApi");
-
-            string salt = Utils.CreatSaltString(8);
-
-            BusinessUser bizUser = null;
-            List<BusinessUser> findBizUsers = await table.QueryWhereString<BusinessUser>($" PartitionKey eq 'BusinessUser' and mobile eq '{mobile}'");
-            if (findBizUsers.Count <= 0)
-            {
-                var coreUser = await _coreAPIHttpService.GetUserInfo(new Dictionary<string, string> { { "key", $"{mobile}" } }, _option.Location, _configuration);
-
-                if (coreUser != null)
-                    bizUser = new() { RowKey = Guid.NewGuid().ToString(), name = coreUser.name, tmdId = coreUser.id, mobile = coreUser.mobile, mail = coreUser.mail, salt = salt, pwd = string.IsNullOrEmpty($"{pwd}") ? Utils.HashedPassword($"{mobile}", salt) : Utils.HashedPassword($"{pwd}", salt) };
-                else
-                    bizUser = new() { RowKey = Guid.NewGuid().ToString(), name = $"{name}", mobile = $"{mobile}", salt = salt, pwd = string.IsNullOrEmpty($"{pwd}") ? Utils.HashedPassword($"{mobile}", salt) : Utils.HashedPassword($"{pwd}", salt) };
-
-                bizUser = await table.Save<BusinessUser>(bizUser);
-
-                await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "bizUser-update", $"{bizUser.name}【{bizUser.RowKey}】注册开放平台用户", _dingDing, tid: bizUser.RowKey, tname: bizUser.name, twebsite: Website?.ToString(), httpContext: HttpContext);
-                return Ok(new { state = RespondCode.Ok, bizUser });
-            }
-            else return Ok(new { state = RespondCode.Conflict, msg = "该手机号已注册开放平台,请直接登录" });
-        }
-
         /// <summary>
         /// 登录 第三方用户数据在CosmosDB 
         /// </summary>
@@ -868,36 +708,5 @@ namespace TEAMModelBI.Controllers
             }
         }
 
-
-        public record DingDingbinds
-        {
-            public string type { get; set; }
-
-            /// <summary>
-            /// 所属部门id列表
-            /// </summary>
-            public List<long> deptIdList { get; set; }
-
-            /// <summary>
-            /// 职位名称
-            /// </summary>
-            public string title { get; set; }
-
-            /// <summary>
-            /// 钉钉用户名
-            /// </summary>
-            public string name { get; set; }
-
-            /// <summary>
-            /// 钉钉unionid
-            /// </summary>
-            public string unionid { get; set; }
-
-            /// <summary>
-            /// 钉钉ID
-            /// </summary>
-            public string userid { get; set; }
-        }
-
     }
 }

+ 0 - 189
TEAMModelBI/Controllers/OperateRecord/OperateLogController.cs

@@ -1,189 +0,0 @@
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Azure.Cosmos.Table;
-using Microsoft.Extensions.Options;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.Json;
-using System.Threading.Tasks;
-using TEAMModelOS.Models;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.Models.Cosmos.BI;
-using System.Text;
-using TEAMModelOS.SDK.Models.Table;
-using TEAMModelBI.Filter;
-using TEAMModelBI.Tool.Extension;
-using TEAMModelOS.SDK.Extension;
-using TEAMModelBI.DI.BIAzureStorage;
-using TEAMModelOS.SDK.Context.BI;
-
-namespace TEAMModelBI.Controllers.OperateRecord
-{
-    [Route("operatelog")]
-    [ApiController]
-    public class OperateLogController : ControllerBase
-    {
-        private readonly AzureStorageFactory _azureStorage;
-        private readonly DingDing _dingDing;
-        private readonly Option _option;
-
-        public OperateLogController(AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option)
-        {
-            _azureStorage = azureStorage;
-            _dingDing = dingDing;
-            _option = option?.Value;
-        }
-
-        /// <summary>
-        /// 查询BI操作记录
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [HttpPost("get-record")]
-        public async Task<IActionResult> GetOperateLogRecord(JsonElement jsonElement)
-        {
-            try
-            {
-                jsonElement.TryGetProperty("single", out JsonElement single);
-                jsonElement.TryGetProperty("startDate", out JsonElement startDate);
-                jsonElement.TryGetProperty("endDate", out JsonElement endDate);
-                jsonElement.TryGetProperty("platform", out JsonElement platform);
-                if(!jsonElement.TryGetProperty("reorder", out JsonElement orderby)) return BadRequest();
-                jsonElement.TryGetProperty("site", out JsonElement site);
-
-                List<BIOptLog> operateLogs = new();
-                StringBuilder tableSql = new StringBuilder();
-
-                if (!string.IsNullOrEmpty($"{single}"))
-                    tableSql.Append($" time eq {single}L ");
-                if (!string.IsNullOrEmpty($"{startDate}"))
-                    tableSql.Append(!string.IsNullOrEmpty(tableSql.ToString()) ? $" and time ge {startDate}L " : $"time ge {startDate}L ");
-                if (!string.IsNullOrEmpty($"{endDate}"))
-                    tableSql.Append(!string.IsNullOrEmpty(tableSql.ToString()) ? $" and time le {endDate}L " : $" time le {endDate}L ");
-                if (!string.IsNullOrEmpty($"{platform}"))
-                    tableSql.Append(!string.IsNullOrEmpty(tableSql.ToString()) ? $" and platform eq '{platform}' " : $" platform eq '{platform}' ");
-                
-                var table = _azureStorage.GetCloudTableClient().GetTableReference("BIOptLog");
-                if ($"{site}".Equals(BIConst.Global))
-                    table = _azureStorage.GetCloudTableClient(BIConst.Global).GetTableReference("BIOptLog");
-
-                //lambda 表达式排序
-                operateLogs = await table.QueryWhereString<BIOptLog>(tableSql.ToString());
-                switch (orderby.GetString())
-                {
-                    case "asc":
-                        //lambda  排序 升序
-                        operateLogs.Sort((x, y) => x.time.CompareTo(y.time));
-                        return Ok(new { state = 200, operateLogs });
-                    case "desc":
-                        //lambda 排序 降序
-                        operateLogs.Sort((x, y) => y.time.CompareTo(x.time));
-                        return Ok(new { state = 200, operateLogs });
-                    default:
-                        return Ok(new { state = 200, operateLogs });
-                }
-            }
-            catch (Exception ex)
-            {
-                await _dingDing.SendBotMsg($"BI,{_option.Location}  /operatelog/get-record \n  {ex.Message}\n{ex.StackTrace} ",GroupNames.成都开发測試群組);
-                return BadRequest();
-            }
-        }
-
-        /// <summary>
-        /// 删除操作记录
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [AuthToken(Roles = "admin")]
-        [HttpPost("del-record")]
-        public async Task<IActionResult> DelOperateLogRecord(JsonElement jsonElement) 
-        {
-            try
-            {             
-                jsonElement.TryGetProperty("startDate", out JsonElement startDate);
-                jsonElement.TryGetProperty("endDate", out JsonElement endDate);
-                jsonElement.TryGetProperty("rowKey", out JsonElement rowKey);
-                jsonElement.TryGetProperty("site", out JsonElement site);
-
-                var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
-                //var temp = await _azureStorage.Delete<OperateLog>(partitionKey: "OperateLog-BI", rowKey: $"{startDate}");  //删除单个
-                StringBuilder operateStr = new StringBuilder($"{_tmdName}【{_tmdId}】账户删除操作记录,");
-                StringBuilder tableStrWhere = new StringBuilder();
-                if (!string.IsNullOrEmpty($"{rowKey}"))
-                {
-                    tableStrWhere.Append($"RowKey {QueryComparisons.Equal} '{rowKey}'");
-                    operateStr.Append($"删除的时间戳:{rowKey}");
-                }
-                else
-                {
-                    tableStrWhere.Append($"time ge {startDate}L and time le {endDate}L ");
-                    operateStr.Append($"删除的时间戳,开始——结束时间戳:{startDate}-{endDate}");
-                }
-                var tableClient = _azureStorage.GetCloudTableClient();
-                var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
-                if ($"{site}".Equals(BIConst.Global))
-                {
-                    tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
-                    blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
-                }
-
-                var table = tableClient.GetTableReference("BIOptLog");
-                var temp = await table.DeleteStringWhere<BIOptLog>(rowKey: tableStrWhere.ToString());
-
-                //保存操作记录
-                //await _azureStorage.SaveBILog("operatelog-del", operateStr?.ToString(), _dingDing, httpContext: HttpContext);
-                await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "operatelog-del", operateStr?.ToString(), _dingDing, httpContext: HttpContext);
-
-                if (temp.Count > 0)
-                {
-                    return Ok(new { state = 200 });
-                }
-                else return Ok(new { state = 400 });
-            }
-            catch (Exception ex)
-            {
-                await _dingDing.SendBotMsg($"BI, {_option.Location} /operatelog/del-record \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
-                return BadRequest();
-            }
-        }
-
-        /// <summary>
-        /// 依据醍摩豆账户查询日志记录
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("get-logtmdid")]
-        public async Task<IActionResult> GetLogTmdId(JsonElement jsonElement) 
-        {
-            try
-            {
-                if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
-                jsonElement.TryGetProperty("platform", out JsonElement platform);
-                jsonElement.TryGetProperty("site", out JsonElement site);
-
-                string storageSql = null;
-                if (!string.IsNullOrEmpty($"{platform}"))
-                    storageSql = $"tmdId eq '{tmdId}' and platform eq '{platform}'";
-                else storageSql = $"tmdId eq '{tmdId}'";
-
-                var table = _azureStorage.GetCloudTableClient().GetTableReference("BIOptLog");
-                if ($"{site}".Equals(BIConst.Global))
-                    table = _azureStorage.GetCloudTableClient(BIConst.Global).GetTableReference("BIOptLog");
-                var optLogs = await table.QueryWhereString<BIOptLog>(storageSql);
-
-                return Ok(new { state = 200, optLogs });
-            }
-            catch (Exception ex)
-            {
-                await _dingDing.SendBotMsg($"BI, {_option.Location} /operatelog/get-logtmdid  \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
-                return BadRequest();
-            }
-        }
-
-
-    }
-}