Esempio n. 1
0
        public void SendCode()
        {
            string mobilePhone = Context.Request.Form["mobilePhone"];

            if (!mobilePhone.IsPhone())
            {
                Response.Write("{\"result\":\"-2\",\"msg\":\"手机号格式不对\"}");
                Response.End();
            }
            var model = new UserBLL().GetUserBasicInfoModelByTelNo(mobilePhone);

            if (model == null)
            {
                Response.Write("{\"result\":\"-1\",\"msg\":\"手机号未在团贷网注册\"}");
                Response.End();
            }
            string err   = "";
            var    ulist = RedisServerStack.StringGet <List <account_manager.WeiXinUser> >(TdConfig.ApplicationName, "/redis/web",
                                                                                           GlobalUtils.OpenId, ref err);

            if (ulist != null && ulist.Exists(o => o.UserId == model.Id))
            {
                Response.Write("{\"result\":\"-3\",\"msg\":\"账号已在微信绑定列表中\"}");
                Response.End();
            }
            var result = new CodeRecordBLL().IsCanSendNewCodeRecord(mobilePhone, MsCodeType.PhoneCode, MsCodeType2.BindWeiXinOpenId, model.Id);

            if (!result.Success)
            {
                Response.Write("{\"result\":\"" + result.Code.ToString() + "\",\"msg\":\"" + result.Message + "\"}");
                Response.End();
            }
            var code = new CodeRecordBLL().CreateCodeRecordInfo(model.Id, "", MsCodeType.PhoneCode, MsCodeType2.BindWeiXinOpenId, mobilePhone);

            if (code != null)
            {
                var parameters = new Dictionary <string, object>();
                parameters.Add("ValidateCode", code.Code);
                var msgSender = new BusinessDll.MessageSend();
                msgSender.SendMessage2(option: SendOption.Sms, eventCode: MessageTemplates.ValidateCode, parameters: parameters, mobile: mobilePhone);
                Response.Write("{\"result\":\"1\",\"msg\":\"已发送,3分钟后可重新获取。\"}");
                Response.End();
            }
            else
            {
                Response.Write("{\"result\":\"0\",\"msg\":\"验证码发送失败,请重试。\"}");
                Response.End();
            }
        }
Esempio n. 2
0
        //获取亲新团贷网公告
        private void GetNoticelist()
        {
            string newsApi = GlobalUtils.NewsApiUrl + "/wap/tuandai-newest-notice.html";

            try
            {
                string apiResponse = HttpUtils.HttpGet(newsApi);
                if (!string.IsNullOrEmpty(apiResponse))
                {
                    nrr =
                        JsonConvert.DeserializeObject <NewsRequestResult>(apiResponse);
                }
            }
            catch (Exception ex)
            {
                TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "获取公告", "获取公告", "获取首页公告错误" + ex.Message);
            }


            try
            {
                string err    = "";
                var    people = RedisServerStack.StringGet <TotalUser>(TdConfig.ApplicationName, "/redis/web",
                                                                       "WEB_SITE_DATA", ref err);
                if (people != null)
                {
                    totalPeople = people.totalUser;
                }
                else
                {
                    string totalUserApiUrl = ConfigurationManager.AppSettings["TotalUserApiUrl"];
                    //http://allstation-data-service.paiconf.com/  http://10.100.12.51:42003/
                    string apiResponse = HttpUtils.HttpGet(totalUserApiUrl + "allstation-bigdata-service/website_data/adddate", 5);
                    if (!string.IsNullOrEmpty(apiResponse))
                    {
                        var res = JsonConvert.DeserializeObject <ResponseTotalUser>(apiResponse);
                        if (res != null && res.data != null)
                        {
                            totalPeople = res.data.totalUser;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "获取投资人数", "获取投资人数", "获取投资人数错误" + ex.Message);
            }
        }