示例#1
0
        public void GetUserInfo(string openId, string appId, string appSecret)
        {
            UserService userSvr = new UserService(appId, appSecret);
            string      json    = userSvr.Info(openId);
            JObject     jo      = JObject.Parse(json);
            WX_User     modal   = userBLL.GetByPK(openId);

            if (modal == null)
            {
                if (jo["subscribe"].ToString().Equals("0"))
                {
                    return;
                }
                modal               = new WX_User();
                modal.AppId         = appId;
                modal.OpenID        = openId;
                modal.UserNick      = jo["nickname"].ToString();
                modal.UserSex       = jo["sex"].ToString() == "1" ? "男" : "女";
                modal.City          = jo["city"].ToString();
                modal.Country       = jo["country"].ToString();
                modal.Province      = jo["province"].ToString();
                modal.Language      = jo["language"].ToString();
                modal.HeadImageUrl  = jo["headimgurl"].ToString();
                modal.SubscribeTime = DateTime.Now;
                modal.UserState     = "正常";
                modal.Remark        = jo["remark"].ToString();
                //modal.GroupId = 0;//新用户
                modal.Subscribe_Scene = jo["subscribe_scene"].ToString();
                modal.QR_Scene        = jo["qr_scene"].ToString();
                modal.QR_Scene_String = jo["qr_scene_str"].ToString();
                modal.UserId          = GetUserIdByScene(jo["qr_scene"].ToString());
                userBLL.Add(modal);
            }
            else
            {
                WX_User modal1 = new WX_User();
                EntityUntility.CopyProperty(modal, modal1);
                modal1.AppId           = appId;
                modal1.OpenID          = openId;
                modal1.UserNick        = jo["nickname"].ToString();
                modal1.UserSex         = jo["sex"].ToString() == "1" ? "男" : "女";
                modal1.City            = jo["city"].ToString();
                modal1.Country         = jo["country"].ToString();
                modal1.Province        = jo["province"].ToString();
                modal1.Language        = jo["language"].ToString();
                modal1.HeadImageUrl    = jo["headimgurl"].ToString();
                modal1.UserState       = "正常";
                modal1.SubscribeTime   = DateTime.Now;
                modal1.Remark          = jo["remark"].ToString();
                modal1.Subscribe_Scene = jo["subscribe_scene"].ToString();
                modal1.QR_Scene        = jo["qr_scene"].ToString();
                modal1.QR_Scene_String = jo["qr_scene_str"].ToString();
                modal1.UserId          = GetUserIdByScene(jo["qr_scene"].ToString());
                userBLL.Update(modal1);
            }
        }
示例#2
0
        public ActionResult AllotUser(string OpenId, int UserId)
        {
            WX_UserManager bll   = new WX_UserManager();
            WX_User        user  = bll.GetByPK(OpenId);
            WX_User        user1 = new WX_User();

            EntityUntility.CopyProperty(user, user1);
            user1.UserId = UserId;
            return(Json(new WX_UserManager().Update(user1), JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public void UnSubscribe(WX_EventQueue info)
        {
            WX_User modal = userBLL.GetByPK(info.OpenID);

            if (modal != null)
            {
                WX_User modal1 = new WX_User();
                EntityUntility.CopyProperty(modal, modal1);
                modal1.UnSubscribeTime = DateTime.Now;
                modal1.UserState       = "退订";
                userBLL.Update(modal1);
            }
        }
示例#4
0
        public bool EditRight(SYS_Role info, List <int> funcList)
        {
            SYS_Role role = new SYS_Role();

            EntityUntility.CopyProperty(info, role);
            foreach (var id in funcList)
            {
                SYS_Function func = new SYS_Function();
                func.FunctionID = id;
                role.SYS_Function.Add(func);
            }
            return(new SYS_RoleService().Update(role));
        }
示例#5
0
        public ActionResult DeleteApp(string id)
        {
            WX_AppManager bll  = new WX_AppManager();
            WX_App        app  = bll.GetByPK(id);
            WX_App        app1 = new WX_App();

            EntityUntility.CopyProperty(app, app1);
            app1.AppState = "无效";
            var result = new ReturnResult()
            {
                ErrorMsg = "修改状态失败!", Result = new WX_AppManager().Update(app1)
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#6
0
        public void Scan(WX_EventQueue info)
        {
            string  eventKey = XmlUtility.GetSingleNodeInnerText(info.XmlContent, "/xml/EventKey");
            WX_User modal    = userBLL.GetByPK(info.OpenID);

            if (modal != null)
            {
                WX_User modal1 = new WX_User();
                EntityUntility.CopyProperty(modal, modal1);
                modal1.UserId = GetUserIdByScene(eventKey);
                userBLL.Update(modal1);
            }
            else
            {
                var app = appBLL.GetByPK(info.AppId);
                if (app != null)
                {
                    GetUserInfo(info.OpenID, app.AppId, app.AppSecret);
                }
            }
        }