Ejemplo n.º 1
0
        /// <summary>
        /// 验证手机短信验证码
        /// </summary>
        /// <param name="sendType">发送类型</param>
        /// <param name="phone">手机号</param>
        /// <param name="code">短信验证码</param>
        /// <returns></returns>
        public ReturnModel CheckSmsVcode(short sendType, string phone, string code)
        {
            var rm = new ReturnModel();

            try
            {
                Dictionary <string, object> parms = new Dictionary <string, object>();
                parms.Add("sendType", sendType);
                parms.Add("telephone", phone);
                parms.Add("code", code);
                rm = HttpRequestHelper.PostRequest <ReturnModel>(HttpApiHelper.CreateHttpApiCall(CustomConfig.ApiBaseService, apiSmsController, "validateCode"), parms);
                if (rm.code != "0" || (rm.code == "0" && rm.subCode != "32100"))
                {
                    LogsHelper.WriteCustomLog("sms", string.Format("SmsServiceHelper CheckSmsVcode,【sendType:{0},phone:{1},code:{2}】,【rmCode:{3},rmSubCode:{4}】,{5},{6}", sendType, phone, code, rm.code, rm.subCode, CustomConfig.ApiBaseService.ConvertEmptyString(), rm.message), rm.bodyMessage.ConvertEmptyString());
                }
            }
            catch (Exception ex)
            {
                rm.bodyMessage = ex.Message;
                LogsHelper.WriteCustomLog("sms", string.Format("SmsServiceHelper CheckSmsVcode Exception,【sendType:{0},phone:{1},code:{2}】,{3}", sendType, phone, code, ex.Message), ex.ToString());
            }
            return(rm);
        }