Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ApiMessage <string> VerifyCode(string strPhone)
        {
            var api = new ApiMessage <string>()
            {
                Msg = "发送成功"
            };
            var gCode = CacheHelper.GetCache("GCode_" + strPhone);

            if (gCode != null)
            {
                api.Success = false;
                api.Msg     = "已经发送过验证码,不能重复获取";
                return(api);
            }
            gCode = CacheHelper.GetCache("VCode_" + strPhone);
            if (gCode == null)
            {
                var random = new Random().Next(100000, 999999);
                CacheHelper.SetCache("VCode_" + strPhone, random.ToString(), new TimeSpan(0, 10, 0));
                SendMsg.Send(strPhone, random.ToString());
            }
            else
            {
                SendMsg.Send(strPhone, gCode.ToString());
            }
            CacheHelper.SetCache("GCode_" + strPhone, strPhone, DateTime.Now.AddMinutes(3));
            return(api);
        }
Esempio n. 2
0
        public async Task <(bool, string)> Send(string ip, string lastIp)
        {
            SendMsg msg        = new SendMsg(ConfigManager.Now.AppSettings.MessageApiConfig.URL, ConfigManager.Now.AppSettings.MessageApiConfig.AppKey);
            string  msgContent = string.Format(ConfigManager.Now.AppSettings.MessageApiConfig.MessageTemplate, ip, lastIp);

            return(await msg.Send(msgContent, ConfigManager.Now.AppSettings.MessageApiConfig.Mobile));
        }
Esempio n. 3
0
        private void Search_Click(object sender, RoutedEventArgs e)
        {
            string           hint   = this.hint.Text;
            string           result = "";
            List <Equipment> equipments;

            //Task t = new Task(() =>
            //{
            SendMsg send = new SendMsg(searchip, 9967);

            result     = send.Send(hint);
            equipments = DoEquipment.getEqus(result);
            foreach (var v in equipments)
            {
                source.Add(v);
            }
            //});
            //t.Start();

            //注意一下,这个地方大概不行,可能无法更新主UI中的listView,但是现在没什么数据尝试,等待调试再说。
        }