CrazyIter_Bin 2 years ago
parent
commit
0797e7d87e

+ 59 - 0
TEAMModelOS.SDK/DI/CoreAPI/CoreAPIHttpService.cs

@@ -47,6 +47,65 @@ namespace TEAMModelOS.SDK
             _httpClient = httpClient;
             options = optionsMonitor;
         }
+        /// <summary>
+        ///  发送短信验证码
+        /// </summary>
+        /// <param name="clientID"></param>
+        /// <param name="clientSecret"></param>
+        /// <param name="location"></param>
+        /// <param name="url"></param>
+        /// <param name="data"></param>
+        /// <returns></returns>
+        public async Task<(HttpStatusCode  code ,string content)> SendSmsPin(Dictionary<string, object> data, string location, IConfiguration _configuration, DI.DingDing _dingDing)
+
+        {
+            try {
+                var url = _configuration.GetValue<string>("HaBookAuth:CoreAPI");
+                //url = "https://api2-rc.teammodel.cn";
+                url = $"{url}/service/sandsms/pin";
+                var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
+                var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
+                if (location.Contains("China"))
+                {
+                    location = "China";
+                }
+                else if (location.Contains("Global"))
+                {
+                    location = "Global";
+                }
+                var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
+                if (_httpClient.DefaultRequestHeaders.Contains("Authorization"))
+                {
+                    _httpClient.DefaultRequestHeaders.Remove("Authorization");
+
+                }
+                _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+                HttpResponseMessage responseMessage = await _httpClient.PostAsJsonAsync(url, data);
+                if (responseMessage.Content != null)
+                {
+                    string content = await responseMessage.Content.ReadAsStringAsync();
+                    if (!string.IsNullOrWhiteSpace(content))
+                    {
+                        return (responseMessage.StatusCode, content);
+                    }
+                    else {
+                        return (responseMessage.StatusCode, null);
+                    }
+                }
+                else {
+                    return (responseMessage.StatusCode, null);
+                }
+                
+               
+            } catch (Exception ex) {
+                await _dingDing.SendBotMsg($"{location}验证码发送异常:\n{ex.Message}\n{ex.StackTrace}", DI.GroupNames.醍摩豆服務運維群組);
+                return (HttpStatusCode.InternalServerError,null);
+            }
+
+
+        }
+
+
         /// <summary>
         ///  隐式登录
         /// </summary>

+ 3 - 0
TEAMModelOS.SDK/Models/Service/LoginService.cs

@@ -359,6 +359,9 @@ namespace TEAMModelOS.SDK.Models.Service
             }
             string ip = IpPort.Split(":")[0];
             string region = await _searcher.SearchIpAsync(ip);
+            if (!string.IsNullOrWhiteSpace(region)) {
+                region = region.Replace("中国·", "").Replace("中国", "").Replace("台湾省", "台湾");
+            }
             return (ip, region);
         }
 

+ 3 - 1
TEAMModelOS/ClientApp/public/lang/en-US.js

@@ -3310,7 +3310,9 @@ const LANG_EN_US = {
         saveErr: 'Failed to save',
         formErr: 'Please check if the information is filled out correctly and completely',
         imgTips: 'Note:The image format only supports jpg, jpeg, png; the size of the image cannot exceed 1M; the file name cannot contain special characters.',
-        ptText: 'Resource Platform Link'
+        ptText: 'Resource Platform Link',
+        text1: 'District Resource Sites',
+        text2: 'School Resource Sites',
     },
     // 注册相关
     regist: {

+ 3 - 1
TEAMModelOS/ClientApp/public/lang/zh-CN.js

@@ -3313,7 +3313,9 @@ const LANG_ZH_CN = {
         saveErr: '保存失败',
         formErr: '请检查信息是否正确完整填写',
         imgTips: '温馨提示:图片格式仅支持jpg、jpeg、png;图片大小不超过1M;文件名不能包含特殊字符。',
-        ptText: '资源平台链接'
+        ptText: '资源平台链接',
+        text1:'区级资源平台',
+        text2:'校级资源平台',
     },
     // 注册相关
     regist: {

+ 3 - 1
TEAMModelOS/ClientApp/public/lang/zh-TW.js

@@ -3313,7 +3313,9 @@ const LANG_ZH_TW = {
         saveErr: '儲存失敗',
         formErr: '請檢查資訊是否正確完整填寫',
         imgTips: '溫馨提示:圖片格式僅支援jpg、jpeg、png;圖片大小不超過1M;文件名不能包含特殊字元。 ',
-        ptText: '資源平臺'
+        ptText: '資源平臺',
+        text1: '區級資源平臺',
+        text2: '校級資源平臺',
     },
     // 注册相关
     regist: {

+ 1 - 1
TEAMModelOS/ClientApp/src/api/http.js

@@ -8,7 +8,7 @@ const NO_ACCESS_API = [
         '/core/system-info',
         '/oauth2/login',
         '/oauth2/token',
-        '/service/sandsms/pin',
+        '/core/sendsms/pin',
         '/service/sandmail/pin',
         '/teacher/init/get-school-list',
         '/student/login',

+ 8 - 6
TEAMModelOS/ClientApp/src/api/index.js

@@ -182,6 +182,7 @@ export default {
     },
 
     /**
+     * (仅处理邮箱验证码,手机验证码独立分开处理)
      * 發送驗證簡訊
      * @param {String} applyType - 寄信類型(email, phone)
      * @param {String} to - 寄信位置
@@ -200,12 +201,13 @@ export default {
                 'HasUser': item.hasUser,
             }
 
-            if (item.applyType == 'phone') {
-                data.country = item.country.toString()
-                url += '/service/sandsms/pin'
-            } else {
-                url += '/service/sandmail/pin'
-            }
+            // if (item.applyType == 'phone') {
+            //     data.country = item.country.toString()
+            //     url += '/service/sandsms/pin'
+            // } else {
+            //     url += '/service/sandmail/pin'
+            // }
+            url += '/service/sandmail/pin'
             corePost(url, data).then(res => {
                 resolve(res)
             }, err => {

+ 5 - 2
TEAMModelOS/ClientApp/src/api/service.js

@@ -13,8 +13,11 @@ export default {
         return post(`${host}/oauth2/profile`, data)
     },
     /* 发送短信验证码 */
-    sandMsgCode: function (host,data) {
-        return post(`${host}/service/sandsms/pin`, data)
+    // sendMsgCode: function (host,data) {
+    //     return post(`${host}/service/sandsms/pin`, data)
+    // },
+    sendMsgCode: function (data) {
+        return post(`/core/sendsms/pin`, data)
     },
     /* 发送邮件验证码 */
     sandMailCode: function (host,data) {

+ 4 - 3
TEAMModelOS/ClientApp/src/components/student-web/SettingView/Setting.vue

@@ -349,14 +349,15 @@ export default {
         sendMsgCode() {
             console.log("开始发送短信");
             let srvAdr = this.config.srvAdr
-            let host = srvAdr == 'Global' ? this.config.Global.coreAPIUrl : this.config.China.coreAPIUrl
+            // let host = srvAdr == 'Global' ? this.config.Global.coreAPIUrl : this.config.China.coreAPIUrl
             let params = {
-                country: this.newPhoneNum.area + '',
+                // country: this.newPhoneNum.area + '',
+                area: this.newPhoneNum.area + '',
                 to: this.newPhoneNum.number,
                 lang: localStorage.getItem('local'),
                 HasUser: false
             }
-            this.$api.service.sandMsgCode(host, params).then(
+            this.$api.service.sendMsgCode(params).then(
                 res => {
                     if (!res.error) {
                         this.$Message.success(this.$t('studentWeb.tmManagement.message.msgOk'))

+ 48 - 16
TEAMModelOS/ClientApp/src/view/forgotPw/Index.vue

@@ -225,24 +225,56 @@ export default {
                                 hasUser: true,
                                 country: this.cCode
                             }
-                            this.$api.SendPinCode(data).then(res => {
-                                let errorFlag = false
-                                this.loading = false
-                                if (res) {
-                                    errorFlag = true
-                                    this.$Message.warning({
-                                        content: this.$t('error.coreApi.error1.' + this.applyType),
-                                        duration: 7,
-                                        closable: true
-                                    })
+                            if (data.applyType == 'phone') {
+                                let params = {
+                                    area: data.country,
+                                    to: data.to,
+                                    lang: this.lang,
+                                    HasUser: true
                                 }
+                                this.$api.service.sendMsgCode(params).then(
+                                    res => {
+                                        let errorFlag = false
+                                        this.loading = false
+                                        // if (res) {
+                                        //     errorFlag = true
+                                        //     this.$Message.warning({
+                                        //         content: this.$t('error.coreApi.error1.' + this.applyType),
+                                        //         duration: 7,
+                                        //         closable: true
+                                        //     })
+                                        // }
 
-                                if (!errorFlag) {
-                                    this.restPWStep = 2
-                                    this.countdown = true
-                                    this.reciprocal()
-                                }
-                            })
+                                        if (!errorFlag) {
+                                            this.restPWStep = 2
+                                            this.countdown = true
+                                            this.reciprocal()
+                                        }
+                                    },
+                                    err => {
+                                        this.$Message.error(this.$t('user.msgErr'))
+                                    }
+                                )
+                            } else {
+                                this.$api.SendPinCode(data).then(res => {
+                                    let errorFlag = false
+                                    this.loading = false
+                                    if (res) {
+                                        errorFlag = true
+                                        this.$Message.warning({
+                                            content: this.$t('error.coreApi.error1.' + this.applyType),
+                                            duration: 7,
+                                            closable: true
+                                        })
+                                    }
+
+                                    if (!errorFlag) {
+                                        this.restPWStep = 2
+                                        this.countdown = true
+                                        this.reciprocal()
+                                    }
+                                })
+                            }
                             break;
                         case 'resPwForm':
                             data = {

+ 2 - 2
TEAMModelOS/ClientApp/src/view/mgtPlatform/MgtPlatform.vue

@@ -2,7 +2,7 @@
     <div class="mgt-platform-container">
         <vuescroll>
             <div>
-                <p class="block-title" v-if="!isArea && !areaPlatform.links.length">区级资源平台</p>
+                <p class="block-title" v-if="!isArea && !areaPlatform.links.length">{{$t('platform.text1')}}</p>
                 <Draggable :disabled="!isArea" class="platform-list-wrap" handle=".mover" ghost-class="ghost" group="platform" :list="areaPlatform.links" :animation='200' @end="handleDragEnd">
                     <div class="platform-item mover" v-for="(item,index) in areaPlatform.links" :key="item.name" @click="openAreaPlatform(index)">
                         <div :class="['pf-item-box',isArea ? 'handle-hover' : '']">
@@ -32,7 +32,7 @@
                         <p class="add-platform-text">{{$t('platform.addPlatform')}}</p>
                     </div>
                 </Draggable>
-                <p class="block-title" v-if="!isArea">校级资源平台</p>
+                <p class="block-title" v-if="!isArea">{{$t('platform.text2')}}</p>
                 <Draggable v-if="!isArea" class="platform-list-wrap" handle=".mover" ghost-class="ghost" group="platform" :list="schoolPlatform.links" :animation='200' @end="handleDragEnd">
                     <!-- 校级资源平台 -->
                     <div class="platform-item mover" v-for="(item,index) in schoolPlatform.links" :key="item.name" @click="openSchoolPlatform(index)">

+ 48 - 18
TEAMModelOS/ClientApp/src/view/regist/Index.vue

@@ -64,12 +64,12 @@
                 <FormItem class="formItem" prop="pinCode">
                     <Row>
                         <i-col :span="9">
-                        <Button class="radius-right-0" style="font-size:12px; " long type="primary" @click="sendPinCode()" :disabled="countdown || pinCodeSwitch">
-                            {{ sendBtnText }}
-                        </Button>
+                            <Button class="radius-right-0" style="font-size:12px; " long type="primary" @click="sendPinCode()" :disabled="countdown || pinCodeSwitch">
+                                {{ sendBtnText }}
+                            </Button>
                         </i-col>
                         <i-col :span="15">
-                        <Input class="radius-left-0 input-font-size-12" v-model="registForm.pinCode" :placeholder="$t('regist.form.placeholder.pindCode')"></Input>
+                            <Input class="radius-left-0 input-font-size-12" v-model="registForm.pinCode" :placeholder="$t('regist.form.placeholder.pindCode')"></Input>
                         </i-col>
                     </Row>
                 </FormItem>
@@ -358,22 +358,52 @@ export default {
                 hasUser: false,
                 country: this.cCode
             }
-            this.$api.SendPinCode(data).then(res => {
-                let errorFlag = false
-                if (res) {
-                    errorFlag = true
-                    this.$Message.warning({
-                        content: this.$t('error.coreApi.error2.' + this.applyType),
-                        duration: 7,
-                        closable: true
-                    })
+            if (data.applyType == 'phone') {
+                let params = {
+                    area: data.country,
+                    to: data.to,
+                    lang: data.lang,
+                    HasUser: false
                 }
+                this.$api.service.sendMsgCode(params).then(
+                    res => {
+                        let errorFlag = false
+                        if (res.error) {
+                            errorFlag = true
+                            this.$Message.warning({
+                                content: this.$t('error.coreApi.error2.' + this.applyType),
+                                duration: 7,
+                                closable: true
+                            })
+                        }
 
-                if (!errorFlag) {
-                    this.countdown = true
-                    this.reciprocal()
-                }
-            })
+                        if (!errorFlag) {
+                            this.countdown = true
+                            this.reciprocal()
+                        }
+                    },
+                    err => {
+                        this.$Message.error(this.$t('user.msgErr'))
+                    }
+                )
+            } else {
+                this.$api.SendPinCode(data).then(res => {
+                    let errorFlag = false
+                    if (res) {
+                        errorFlag = true
+                        this.$Message.warning({
+                            content: this.$t('error.coreApi.error2.' + this.applyType),
+                            duration: 7,
+                            closable: true
+                        })
+                    }
+
+                    if (!errorFlag) {
+                        this.countdown = true
+                        this.reciprocal()
+                    }
+                })
+            }
         },
         reciprocal() { // 調整倒數時間至可控
             this.verfTime -= 1;

+ 11 - 6
TEAMModelOS/ClientApp/src/view/user/BandPhone.vue

@@ -197,7 +197,7 @@ export default {
                             phone: this.accFormat
                         }
                         this.bandingID(data)
-                    }else{
+                    } else {
                         this.$Message.error(this.$t('login.phoneerr'))
                     }
                     // 新账号会返回登录信息
@@ -311,12 +311,17 @@ export default {
                         country: this.cCode
                     }
                     try {
-                        let res = await this.$api.SendPinCode(data)
+                        let res = await this.$api.service.sendMsgCode({
+                            area: data.country,
+                            to: data.to,
+                            lang: data.lang,
+                            // HasUser: false
+                        })
                         //账号已存在 需要传hasUser才可能返回2 现在这种方式不会走这个判断
-                        if (res.error === 2) {
-                            data.hasUser = true
-                            res = await this.$api.SendPinCode(data)
-                        }
+                        // if (res.error === 2) {
+                        //     data.hasUser = true
+                        //     res = await this.$api.SendPinCode(data)
+                        // }
                         this.$Message.success(this.$t('login.sendok'))
                         this.loading = false
                         this.hasSendCode = true

+ 12 - 12
TEAMModelOS/ClientApp/src/view/user/UserCenter.vue

@@ -341,28 +341,22 @@ export default {
     methods: {
         //发送短信验证码
         sendMsgCode() {
-            let srvAdr = this.$store.state.config.srvAdr
-            let host = srvAdr == 'Global' ? this.$store.state.config.Global.coreAPIUrl : this.$store.state.config.China.coreAPIUrl
+            // let srvAdr = this.$store.state.config.srvAdr
+            // let host = srvAdr == 'Global' ? this.$store.state.config.Global.coreAPIUrl : this.$store.state.config.China.coreAPIUrl
             let n = this.mobile.number.indexOf('0') === 0 ? this.mobile.number.slice(1) : this.mobile.number
             // if () {
             //     this.mobile.number.slice(1)
             // }
             let params = {
-                country: this.mobile.area + '',
-                // to: this.mobile.number,
+                // country: this.mobile.area + '',
+                area: this.mobile.area + '',
                 to: n,
                 lang: localStorage.getItem('local'),
                 HasUser: false
             }
-            this.$api.service.sandMsgCode(host, params).then(
+            this.$api.service.sendMsgCode(params).then(
                 res => {
-                    if (!res.error) {
-                        this.$Message.success(this.$t('user.msgOk'))
-                        this.hasSend = true
-                        this.timer = setInterval(() => {
-                            this.countdown--
-                        }, 1000)
-                    } else {
+                    if (res.error) {
                         if (res.error == 1) {
                             this.$Message.error(this.$t('user.noMobile'))
                         } else if (res.error == 2) {
@@ -370,6 +364,12 @@ export default {
                         } else {
                             this.$Message.error(this.$t('user.msgErr'))
                         }
+                    } else {
+                        this.$Message.success(this.$t('user.msgOk'))
+                        this.hasSend = true
+                        this.timer = setInterval(() => {
+                            this.countdown--
+                        }, 1000)
                     }
                 },
                 err => {

+ 127 - 2
TEAMModelOS/Controllers/System/CoreController.cs

@@ -2,13 +2,17 @@ using Azure.Storage.Blobs.Models;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Options;
+using StackExchange.Redis;
 using PuppeteerSharp;
 using System;
 using System.Collections.Generic;
 using System.Drawing.Imaging;
+using System.IdentityModel.Tokens.Jwt;
 using System.IO;
 using System.Linq;
+using System.Net;
 using System.Net.Http;
 using System.Reflection;
 using System.Runtime.InteropServices;
@@ -37,7 +41,9 @@ namespace TEAMModelOS.Controllers
         private readonly Option _option;
         private readonly HttpClient _httpClient;
         private readonly IPSearcher _searcher;
-        public CoreController(IPSearcher searcher, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option, HttpClient httpClient)
+        private readonly CoreAPIHttpService _coreAPIHttpService;
+        private readonly IConfiguration _configuration;
+        public CoreController(CoreAPIHttpService coreAPIHttpService,IConfiguration configuration,IPSearcher searcher, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option, HttpClient httpClient)
         {
             _searcher = searcher;
             _azureStorage = azureStorage;
@@ -45,10 +51,129 @@ namespace TEAMModelOS.Controllers
             _option = option?.Value;
             _httpClient = httpClient;
             _azureRedis = azureRedis;
+            _configuration = configuration;
+            _coreAPIHttpService = coreAPIHttpService;
         }
+        [HttpPost("sendsms/pin")]
+        public async Task<IActionResult> SendSmsPinCode(JsonElement request)
+        {
+            (string ip, string region) = await LoginService.LoginIp(HttpContext, _searcher);
+            
+            //获取投票活动的选项及投票数
+            string ipkey = $"Ip:Pin:Count:{ip}";
+          
+            bool ipkeyexist = await _azureRedis.GetRedisClient(8).KeyExistsAsync(ipkey);
+            if (ipkeyexist)
+            {
+                await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync(ipkey, ip, 1);
+            }
+            else {
+                await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync(ipkey, ip, 1);
+                var Expire = DateTime.UtcNow.AddSeconds(600);
+                _azureRedis.GetRedisClient(8).KeyExpire(ipkey, Expire);
+            }
+            var counts = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores(ipkey);
+            long sum = 0;
+            if (counts != null && counts.Length > 0)
+            {
+                foreach (var count in counts)
+                {
+                    sum += (int)count.Score;
+                }
+            }
+            int limit = 1000;
+            if (sum > limit) {
+                await  _dingDing.SendBotMsg($"{_option.Location}\nIp:{ip}\n位置:{region}\n 短信验证码10分钟内访问次数超过:{limit}次!",GroupNames.成都开发測試群組);
+                return Ok(new { send = 2 });
+            }
+            if (!request.TryGetProperty("area", out JsonElement _area)) return BadRequest();
+            if (!request.TryGetProperty("to", out JsonElement _to)) return BadRequest();
+            if (!request.TryGetProperty("lang", out JsonElement _lang)) return BadRequest();
+            request.TryGetProperty("HasUser", out JsonElement _HasUser);
+            string code=$"{_area}{_to}";
+            int exp = 120;
+            string key = $"Random:Code:PinCode-{_area}{_to}";
+            bool exist = await _azureRedis.GetRedisClient(8).KeyExistsAsync(key);
+            if (!exist)
+            {
+                //不存在则发送请求。
+               
+                Dictionary<string, object> dict = null;
+                if (_HasUser.ValueKind.Equals(JsonValueKind.True))
+                {
+                    dict = new Dictionary<string, object> { { "country", $"{_area}" }, { "to", $"{_to}" }, { "lang", $"{_lang}" }, { "HasUser", true } };
+                }
+                else if (_HasUser.ValueKind.Equals(JsonValueKind.False)) {
+                    dict = new Dictionary<string, object> { { "country", $"{_area}" }, { "to", $"{_to}" }, { "lang", $"{_lang}" }, { "HasUser", false } };
+                }
+                else
+                {
+                    dict = new Dictionary<string, object> { { "country", $"{_area}" }, { "to", $"{_to}" }, { "lang", $"{_lang}" } };
+                }
+                var httpresp = await _coreAPIHttpService.SendSmsPin(dict, _option.Location, _configuration, _dingDing);
+                if (httpresp.code.Equals(HttpStatusCode.OK))
+                {
+                    var Expire = DateTime.UtcNow.AddSeconds(exp);
+                    //send=1 表示已发送
+                    await _azureRedis.GetRedisClient(8).StringSetAsync(key, new { code = code, send = 1, Expire = Expire.Ticks }.ToJsonString());
+                    _azureRedis.GetRedisClient(8).KeyExpire(key, Expire);
+                    if (!string.IsNullOrWhiteSpace(httpresp.content))
+                    {
+                        return Ok(httpresp.content.ToObject<JsonElement>());
+                    }
+                    else {
+                        return Ok(new { send = 1 });
+                    }
+                }
+                else
+                {
+                   return Ok(new {  send = 0  });
+                }
+            }
+            else
+            {
+                //检查当前key是否已经发送了.
+                RedisValue value = await _azureRedis.GetRedisClient(8).StringGetAsync(key);
+                JsonElement element = value.ToString().ToObject<JsonElement>();
+                int send = 0;
+                if (element.TryGetProperty("send", out JsonElement _send))
+                {
+                    if (_send.ValueKind.Equals(JsonValueKind.Number))
+                    {
+                        if (int.Parse($"{_send}") == 1)
+                        {
+                            send = 1;
 
-        [HttpPost("apply-school")]
+                        }
+                        else if (int.Parse($"{_send}") == 0)
+                        {
+                            send = 0;
+                        }
+                    }
+                }
+                if (send == 0)
+                {
+                    await _azureRedis.GetRedisClient(8).KeyDeleteAsync(key);
+                    return Ok(new {   send = 0  });
+                }
+                else
+                {
+                    TimeSpan? timeSpan = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync(key);
+                    if (timeSpan != null && timeSpan.HasValue)
+                    {
+                        int seconds = timeSpan.Value.Seconds;
+                        return Ok(new {   send = 1  });
+                    }
+                    else
+                    {
+                        return Ok(new {   send = 0  });
+                    }
+                }
+            }
 
+        }
+ 
+        [HttpPost("apply-school")]
         public async Task<IActionResult> ApplySchool(ApplySchool request)
         {            
             if (_option.Location.Equals("China"))

+ 9 - 1
TEAMModelOS/Controllers/Third/Sc/ScController.cs

@@ -325,8 +325,16 @@ namespace TEAMModelOS.Controllers
                     await _dingDing.SendBotMsg($"OS,{_option.Location}\n绑定失败,出现的原因可能是 参数异常:\n{sso.ToJsonString()},{ex.Message}\n{ex.StackTrace}\n", GroupNames.醍摩豆服務運維群組);
                     return BadRequest();
                 }
-
                 var id = jwt.Payload.Sub;
+                CoreUser coreUserById=  await _coreAPIHttpService.GetUserInfo(new Dictionary<string, string> { { "key", $"{id}" } }, _option.Location, _configuration);
+                if (coreUserById == null|| string.IsNullOrWhiteSpace(coreUserById.mobile)|| coreUserById.mobile.Length!=11)
+                {
+                    return Ok(new
+                    {
+                        location = _option.Location,
+                        status = 2,
+                    });
+                }
                 jwt.Payload.TryGetValue("name", out object name);
                 jwt.Payload.TryGetValue("picture", out object picture);
                 ScSSOData scsso = HttpUtility.UrlDecode(sso.param, Encoding.UTF8).ToObject<ScSSOData>();