Browse Source

解除钉钉和醍摩豆的绑定接口

Li 3 years ago
parent
commit
87c7c09888
1 changed files with 37 additions and 0 deletions
  1. 37 0
      TEAMModelBI/Controllers/DingDingStruc/TableDingDingInfoController.cs

+ 37 - 0
TEAMModelBI/Controllers/DingDingStruc/TableDingDingInfoController.cs

@@ -733,6 +733,43 @@ namespace TEAMModelBI.Controllers.DingDingStruc
             }
         }
 
+        /// <summary>
+        /// 解除钉钉和醍摩豆的绑定
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("set-unbind")]
+        public async Task<IActionResult> SetUnbind(JsonElement jsonElement) 
+        {
+            jsonElement.TryGetProperty("mobile", out JsonElement mobile);
+            string divide = _configuration["CustomParam:SiteScope"];
+            Dictionary<string, object> dic = new Dictionary<string, object> { { "PartitionKey", $"{divide}" } };
+            if (!string.IsNullOrEmpty($"{mobile}"))
+                dic.Add("tmdMobile", $"{mobile}");
+            else
+                dic.Add("tmdMobile", "18281911681");
+
+            var table = _azureStorage.GetCloudTableClient().GetTableReference("BIDDUserInfo");
+            List<DingDingUserInfo> ddUserInfoList = await table.FindListByDict<DingDingUserInfo>(dic);
+
+            List<DingDingUserInfo> tempDDUI = new();
+            if (ddUserInfoList.Count > 0)
+            {
+                foreach (var item in ddUserInfoList)
+                {
+                    item.tmdId = null;
+                    item.tmdName = null;
+                    item.tmdMobile = null;
+                    item.picture = null;
+                    tempDDUI.Add(item);
+                }
+            }
+            else return Ok(new { state = 404, msg = "未找到手机号匹配的绑定号码!,请检查手机号" });
+
+            var userInfos = await table.SaveOrUpdateAll(tempDDUI);  //保存和修改至Table
+            return Ok(new { state = 200, userInfos });
+        }
 
 
         /// <summary>