Exemplo n.º 1
0
        /// <summary>
        /// 微信小程序获取信息
        /// </summary>
        /// <param name="dicPar"></param>
        public void GetMember(Dictionary <string, object> dicPar)
        {
            ///要检测的参数信息
            List <string> pra = new List <string>()
            {
                "openid", "mobile"
            };

            //检测方法需要的参数
            if (!CheckActionParameters(dicPar, pra))
            {
                return;
            }
            var openid = dicPar["openid"].ToString();
            var mobile = dicPar["mobile"].ToString();

            if (string.IsNullOrEmpty(mobile))
            {
                ReturnResultJson("2", "手机号为空,请在微信中绑定手机号");
                return;
            }

            if (openid == "undefined")
            {
                ReturnResultJson("2", "网络繁忙,请稍后再试");
                return;
            }
            bllmembers    bllmembers = new bllmembers();
            membersEntity member     = bllmembers.GetEntitySigInfo(" where wxaccount='" + openid + "'");

            if (!string.IsNullOrWhiteSpace(member.memid))//已注册过会员
            {
                ReturnJsonStr(JsonHelper.ObjectToJSON(member));
            }
            else//未注册过会员
            {
                bllmembers.Add("", "", "", "", openid, mobile, "", "1");
                member = bllmembers.GetEntitySigInfo(" where wxaccount='" + openid + "'");
                ReturnJsonStr(JsonHelper.ObjectToJSON(member));
            }
        }