Exemple #1
0
        /// <summary>
        /// 获取地理信息
        /// </summary>
        public void GetLocationInfo(Dictionary <string, object> dicPar)
        {
            var strJson = string.Empty;

            if (Tools.GetCache("locationinfo") == null)
            {
                var sql = "select provinceid,province from provinces";
                var dt  = SQLTool.ExecuteDataTable(sql);
                strJson = "[";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var province = dt.Rows[i]["province"].ToString();
                    province = province.TrimEnd('省');
                    province = province.TrimEnd('市');
                    strJson += "{\"province\":\"" + province + "\",\"city\":[";
                    sql      = "select cityid,city from citys where parentid='" + dt.Rows[i]["provinceid"] + "'";
                    var cityDt = SQLTool.ExecuteDataTable(sql);
                    for (int j = 0; j < cityDt.Rows.Count; j++)
                    {
                        strJson += "{\"city\":\"" + cityDt.Rows[j]["city"] + "\",\"area\":[";
                        sql      = "SELECT areaid,area,letter FROM areas where parentid='" + cityDt.Rows[j]["cityid"] + "'";
                        var areaDt = SQLTool.ExecuteDataTable(sql);
                        for (int x = 0; x < areaDt.Rows.Count; x++)
                        {
                            strJson += "\"" + areaDt.Rows[x]["area"] + "\",";
                        }
                        strJson  = strJson.TrimEnd(',');
                        strJson += "]},";
                    }
                    strJson  = strJson.TrimEnd(',');
                    strJson += "]},";
                }
                strJson  = strJson.TrimEnd(',');
                strJson += "]";
                Tools.AddCacheLasting("locationinfo", strJson);
            }
            else
            {
                strJson = Convert.ToString(Tools.GetCache("locationinfo"));
            }

            HttpContext hc = HttpContext.Current;

            hc.Response.Clear();
            hc.Response.Write(strJson);
            hc.Response.End();
        }
Exemple #2
0
        /// <summary>
        /// 获取用户信息(手机号、身份证号、证件类型)
        /// </summary>
        /// <param name="dicPar"></param>
        public void MpUserInfo(Dictionary <string, object> dicPar)
        {
            List <string> pra = new List <string>()
            {
                "GUID", "USER_ID"
            };

            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            var unionid = dicPar["USER_ID"].ToString();
            var sql     = "select top 1 mobile,IDNO,idtype from members where wxaccount='" + Tools.SafeSql(unionid) + "'";
            var dt      = SQLTool.ExecuteDataTable(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                ToJsonStr(ToJson2(dt));
            }
            else
            {
                ToCustomerJson("-1", "暂无数据");
            }
        }