示例#1
0
        /// <summary>
        /// 获取通过手机号登陆
        /// </summary>
        /// <param name="account"手机号></param>
        /// <param name="password">密码</param>
        /// <returns>返回结果</returns>
        public string GetInfoByMobileLogin(string strAccount, string strPassword)
        {
            Dictionary <string, string> info = new Dictionary <string, string>();
            string strJson = string.Empty;

            string strSql =
                string.Format(@"select b.code_user,a.password 
                                from tb_sys_user a, tb_sys_userinfo b 
                                where a.code_user=b.code_user and b.mobile='{0}'",
                              strAccount);
            //判断用户(手机号)是否存在
            var dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathIport).ExecuteTable(strSql);

            if (dt.Rows.Count <= 0)
            {
                strJson = JsonConvert.SerializeObject(new DicPackage(false, null, "用户名或密码错误!").DicInfo());
                log.LogCatalogFailure("用户名或密码错误!");
                return(strJson);
            }

            if (!Identity.VerifyText(Format.Trim(strPassword), dt.Rows[0]["password"] as string))
            {
                strJson = JsonConvert.SerializeObject(new DicPackage(false, null, "用户名或密码错误!").DicInfo());
                log.LogCatalogFailure("用户名或密码错误!");
                return(strJson);
            }

            strJson = JsonConvert.SerializeObject(new DicPackage(true, Convert.ToString(dt.Rows[0]["code_user"]), null).DicInfo());
            log.LogCatalogSuccess();
            return(strJson);
        }