Esempio n. 1
0
        public JsonResult UserSiteAdd(AddUserSiteReq parames)
        {
            PublicUserModel loginUser = this.GetLoginUser();

            if (parames.webBasicId > 0)
            {
                bool flag = false;
                try
                {
                    flag = UserVerifier.CheckSite(parames.webBasicId, parames.loginName, parames.loginPwd);
                }
                catch (Exception)
                {
                }
                if (!flag)
                {
                    return(Json(new { msg = "帐号或密码错误!" }));
                }
                #region 添加
                UserSiteManageBll   userSiteManageBll   = new UserSiteManageBll();
                UserSiteManageModel userSiteManageModel = new UserSiteManageModel()
                {
                    SiteID       = parames.webBasicId,
                    UserID       = loginUser.UserID,
                    SiteStatus   = 1,
                    SiteUserName = parames.loginName,
                    SiteUserPwd  = parames.loginPwd
                };
                userSiteManageBll.UserSiteManageAdd(userSiteManageModel);
                #endregion
                #region 绑定网站帐号任务

                DoTask(loginUser.UserID, PointsEnum.First_BindSiteAccount);
                #endregion

                if (loginUser.VipType < 1)
                {
                    PublicUser user =
                        ncBase.CurrentEntities.PublicUser.Where(o => o.UserID == loginUser.UserID).FirstOrDefault();
                    if (user.IsNoNull())
                    {
                        VipType vipType = ncBase.CurrentEntities.VipType.Where(o => o.VipTypeID == 2).FirstOrDefault();
                        user.VipType    = vipType.IsNoNull() ? vipType.VipTypeID : 1;
                        user.MaxStock   = vipType.IsNoNull() ? Convert.ToInt32(vipType.MaxStock) : 50;
                        user.PublishNum = vipType.IsNoNull() ? Convert.ToInt32(vipType.PublishNum) : 2;
                        ncBase.CurrentEntities.SaveChanges();
                    }
                }
                return(Json(new { msg = "添加成功" }));
            }
            else
            {
                return(Json(new { msg = "添加失败" }));
            }
        }
Esempio n. 2
0
        public ApiResponse UserSiteManageAdd([FromBody] SiteUserReq model)
        {
            int    gainPoints    = 0;
            string gainPointsMsg = "";

            if (model.SiteID > 0)
            {
                bool flag = false;
                try
                {
                    flag = UserVerifier.CheckSite(model.SiteID, model.UserName, model.Password);
                }
                catch (Exception)
                {
                }

                if (!flag)
                {
                    return(new ApiResponse(Metas.ACCOUNT_OR_PASSWORD_WRONG));
                }
                UserSiteManageBll   userSiteManageBll   = new UserSiteManageBll();
                UserSiteManageModel userSiteManageModel = new UserSiteManageModel()
                {
                    SiteID       = model.SiteID,
                    UserID       = GetCurrentUserId(),
                    SiteStatus   = 1,
                    SiteUserName = model.UserName,
                    SiteUserPwd  = model.Password
                };
                int row = userSiteManageBll.UserSiteManageAdd(userSiteManageModel);

                if (row > 0)
                {
                    DoTask(GetCurrentUserId(), PointsEnum.First_BindSiteAccount, out gainPoints);
                    gainPointsMsg = "完成“绑定网站帐号”任务";
                    var result = new
                    {
                        GainPoints    = gainPoints,
                        GainPointsMsg = gainPointsMsg
                    };
                    return(new ApiResponse(Metas.SUCCESS, result));
                }
                else
                {
                    return(new ApiResponse(Metas.SITE_EXISTS));
                }
            }
            else
            {
                return(new ApiResponse(Metas.SITE_NOT_EXISTS));  // Todo:这边没有判断站点是否存在、关闭
            }
        }
Esempio n. 3
0
        public ActionResult Lottery()
        {
            PublicUserModel            loginUser          = this.GetLoginUser();
            UserSiteManageBll          userSiteManageBll  = new UserSiteManageBll();
            List <UserSiteManageModel> userSiteManageList = userSiteManageBll.GetUserSiteListByUserId(loginUser.UserID);//用户关联的站点
            UserSiteManageModel        userSiteItem       = userSiteManageList.Where(s => s.SiteID == 1).FirstOrDefault();
            bool hasZJB = true;

            if (userSiteItem.IsNull())
            {
                hasZJB = false;
            }
            ViewBag.HasZJB = hasZJB;
            return(View(loginUser));
        }
Esempio n. 4
0
        public ActionResult LotteryHandler()
        {
            PublicUserModel            loginUser          = this.GetLoginUser();
            UserSiteManageBll          userSiteManageBll  = new UserSiteManageBll();
            List <UserSiteManageModel> userSiteManageList = userSiteManageBll.GetUserSiteListByUserId(loginUser.UserID);//用户关联的站点
            UserSiteManageModel        userSiteItem       = userSiteManageList.Where(s => s.SiteID == 1).FirstOrDefault();

            if (userSiteItem.IsNull())
            {
                return(Json(new { Code = -5, Angle = 0 }, JsonRequestBehavior.AllowGet));
            }

            var json = new Lottery_ZJB().Lottery(userSiteItem.SiteUserName, userSiteItem.SiteUserPwd);

            return(Content(json));
        }
Esempio n. 5
0
        public JsonResult CheckSite(int siteId)
        {
            int                        uid                = this.GetLoginUser().UserID;
            UserBll                    userBll            = new UserBll();
            UserSiteManageBll          userSiteManageBll  = new UserSiteManageBll();
            List <UserSiteManageModel> userSiteManageList = userSiteManageBll.GetUserSiteListByUserId(this.GetLoginUser().UserID);//用户关联的站点
            UserSiteManageModel        userSiteItem       = userSiteManageList.Where(s => s.SiteID == siteId).FirstOrDefault();

            if (userSiteItem.IsNull())
            {
                return(Json(new { msg = "您还未绑定帐号!" }));
            }

            bool flag = false;

            try
            {
                flag = UserVerifier.CheckSite(siteId, userSiteItem.SiteUserName, userSiteItem.SiteUserPwd);
            }
            catch (Exception)
            {
            }

            if (flag)
            {
                UserSiteManage siteManage =
                    ncBase.CurrentEntities.UserSiteManage.Where(
                        o => o.SiteID == siteId && o.SiteUserName == userSiteItem.SiteUserName && o.UserID == uid).FirstOrDefault();
                if (siteManage.IsNoNull())
                {
                    siteManage.SiteStatus = BitConverter.GetBytes(1)[0];
                    siteManage.BanTime    = DateTime.Now;
                    ncBase.CurrentEntities.SaveChanges();
                    return(Json(new { msg = "账号验证成功并已经激活使用!" }));
                }

                return(Json(new { msg = "未知错误!" }));
            }
            return(Json(new { msg = "账号密码不正确!" }));
        }
Esempio n. 6
0
        public virtual int UserSiteManageAdd(UserSiteManageModel userSiteManageModel)
        {
            UserSiteManage userSiteManage =
                ncBase.CurrentEntities.UserSiteManage.Where(
                    o => o.SiteID == userSiteManageModel.SiteID && o.UserID == userSiteManageModel.UserID)
                .FirstOrDefault();

            if (userSiteManage.IsNoNull())
            {
                return(0);
            }
            userSiteManage = new UserSiteManage()
            {
                SiteID       = userSiteManageModel.SiteID,
                UserID       = userSiteManageModel.UserID,
                SiteUserName = userSiteManageModel.SiteUserName,
                SiteUserPwd  = CryptoUtility.TripleDESEncrypt(userSiteManageModel.SiteUserPwd),
                SiteStatus   = 1,
                AddTime      = DateTime.Now
            };
            ncBase.CurrentEntities.UserSiteManage.AddObject(userSiteManage);
            return(ncBase.CurrentEntities.SaveChanges());
        }
Esempio n. 7
0
        public JsonResult UserSitePwdShow(int siteId, string userPwd)
        {
            UserBll         userBll   = new UserBll();
            PublicUserModel checkUser = userBll.PublicUserLogin(this.GetLoginUser().Name, userPwd, 0);

            if (checkUser != null && checkUser.UserID > 0)
            {
                UserSiteManageBll          userSiteManageBll  = new UserSiteManageBll();
                List <UserSiteManageModel> userSiteManageList = userSiteManageBll.GetUserSiteListByUserId(checkUser.UserID);//用户关联的站点
                UserSiteManageModel        userSiteItem       = userSiteManageList.Where(s => s.SiteID == siteId).FirstOrDefault();
                if (userSiteItem != null)
                {
                    return(Json(new { msg = "成功", loginName = userSiteItem.SiteUserName, loginPwd = userSiteItem.SiteUserPwd }));
                }
                else
                {
                    return(Json(new { msg = "失败", loginName = userSiteItem.SiteUserName, loginPwd = userSiteItem.SiteUserPwd }));
                }
            }
            else
            {
                return(Json(new { msg = "登陆密码错误" }));
            }
        }
Esempio n. 8
0
        public ApiResponse UserSiteShowPwd([FromBody] SiteUserReq model)
        {
            var    credential = Request.GetCredential();
            string userName   = "";

            if (credential != null)
            {
                userName = credential.Name;
            }
            UserBll         userBll   = new UserBll();
            PublicUserModel checkUser = userBll.PublicUserLogin(userName, model.Password, 0);

            if (checkUser != null && checkUser.UserID > 0)
            {
                UserSiteManageBll          userSiteManageBll  = new UserSiteManageBll();
                List <UserSiteManageModel> userSiteManageList = userSiteManageBll.GetUserSiteListByUserId(checkUser.UserID);//用户关联的站点
                UserSiteManageModel        userSiteItem       = userSiteManageList.Where(s => s.SiteID == model.SiteID).FirstOrDefault();
                if (userSiteItem.IsNoNull())
                {
                    var list = new
                    {
                        userSiteItem.SiteUserName,
                        userSiteItem.SiteUserPwd
                    };
                    return(new ApiResponse(Metas.SUCCESS, list));
                }
                else
                {
                    return(new ApiResponse(Metas.SUCCESS));
                }
            }
            else
            {
                return(new ApiResponse(Metas.PASSWORD_WRONG));
            }
        }
Esempio n. 9
0
 public virtual int UserSiteManageAdd(UserSiteManageModel userSiteManageModel)
 {
     return(userSiteManageDal.UserSiteManageAdd(userSiteManageModel));
 }