Пример #1
0
        /// <summary>
        /// 保存角色信息
        /// </summary>
        /// <param name="opInfo"></param>
        /// <returns></returns>
        public JsonResult RoleEditSave(RoleInfo opInfo)
        {
            AjaxMsgResult result      = new AjaxMsgResult();
            RoleService   x_opService = new RoleService();

            if (opInfo.Id > 0)  //更新
            {
                int i = x_opService.Update(() => new RoleInfo()
                {
                    Rolecode = opInfo.Rolecode, Rolename = opInfo.Rolename, Summary = opInfo.Summary
                }, a => a.Id == opInfo.Id);
                if (i > 0)
                {
                    result.Success = true;
                }
                else
                {
                    result.Msg = "更新失败,没有找到该角色!";
                }
            }
            else
            {
                opInfo.Isvalid    = 1;
                opInfo.Createtime = DateTime.Now;
                opInfo.Rolename   = opInfo.Rolename;
                opInfo.Rolecode   = opInfo.Rolecode;
                x_opService.Insert(opInfo);
                result.Success = true;
            }
            return(Json(result));
        }
Пример #2
0
        public JsonResult EditSave(RedPack rp)
        {
            AjaxMsgResult  result      = new AjaxMsgResult();
            RedPackService x_opService = new RedPackService();

            if (rp.ID > 0)  //更新
            {
                int i = x_opService.Update(() => new RedPack()
                {
                    RbCount    = rp.RbCount,
                    RbMoney    = rp.RbMoney,
                    RbTotal    = rp.RbTotal,
                    UpdateTime = DateTime.Now,
                    GetPercent = rp.GetPercent
                }, a => a.ID == rp.ID);
                if (i > 0)
                {
                    result.Success = true;
                }
                else
                {
                    result.Msg = "更新失败,没有找到该用户!";
                }
            }
            else
            {
                rp.IsValid    = 1;
                rp.CreateTime = DateTime.Now;
                rp.UpdateTime = DateTime.Now;
                x_opService.Insert(rp);
                result.Success = true;
            }
            return(Json(result));
        }
Пример #3
0
        /// <summary>
        /// 角色树
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult RoleTree(int id)
        {
            AjaxMsgResult       msg         = new AjaxMsgResult();
            RoleService         x_rService  = new RoleService();
            var                 mlist       = x_rService.Get(a => a.Isvalid == 1);
            OperatorRoleService x_orService = new OperatorRoleService();
            var                 rmlist      = x_orService.Get(a => a.OperatorId == id);
            List <zTreeData>    list        = new List <zTreeData>();

            foreach (var item in mlist)
            {
                zTreeData zd = new zTreeData()
                {
                    id   = item.Rolecode.ToString(),
                    name = item.Rolename,
                    open = true,
                    pId  = "0"
                };
                if (id > 0)
                {
                    foreach (var ritem in rmlist)
                    {
                        if (ritem.RoleCode == item.Rolecode)
                        {
                            zd.@checked = true;
                            break;
                        }
                    }
                }
                list.Add(zd);
            }
            msg.Success = true;
            msg.Source  = list;
            return(Json(msg));
        }
Пример #4
0
        public JsonResult MapData()
        {
            AjaxMsgResult result = new AjaxMsgResult();

            result.Success = true;
            RackDataDto dto = new RackDataDto();

            dto.Points = new List <RackDataDto.RackPoint>();
            dto.Points.Add(new RackDataDto.RackPoint()
            {
                X = 100, Y = 100
            });
            dto.Points.Add(new RackDataDto.RackPoint()
            {
                X = 200, Y = 100
            });
            dto.Points.Add(new RackDataDto.RackPoint()
            {
                X = 300, Y = 100
            });
            dto.Points.Add(new RackDataDto.RackPoint()
            {
                X = 300, Y = 400
            });
            dto.Points.Add(new RackDataDto.RackPoint()
            {
                X = 400, Y = 500
            });

            result.Source = dto;
            return(Json(result));
        }
Пример #5
0
        public JsonResult LoginX(string username, string password)
        {
            AjaxMsgResult   result    = new AjaxMsgResult();
            OperatorService omService = new OperatorService();

            password = MD5Helper.Md5(password);
            var op = omService.GetbyPwd(username, password);

            if (op != null)
            {
                if (op.Isvalid == 1)
                {
                    Authentication.Instance.SetAuth(op, false);
                    result.Success = true;
                    result.Msg     = "登录成功!";
                }
                else
                {
                    result.Success = false;
                    result.Msg     = "帐号已被禁用,请联系管理员!";
                }
            }
            else
            {
                result.Success = false;
                result.Msg     = "帐号或密码错误!";
            }
            return(Json(result));
        }
Пример #6
0
        public JsonResult GetList()
        {
            AjaxMsgResult    result      = new AjaxMsgResult();
            UserPhotoService x_upService = new UserPhotoService();


            List <UPInfo> list = new List <UPInfo>();
            var           upl  = x_upService.GetTopList(20);
            int           i    = 1;

            foreach (var item in upl)
            {
                UPInfo info = new UPInfo()
                {
                    I         = i,
                    HeadImage = item.HeadImage,
                    NickName  = item.NickName,
                    PerValue  = item.PerValue
                };
                list.Add(info);
                i++;
            }
            result.Success = true;
            result.Source  = list;
            result.Code    = x_upService.GetMyTop(CurrentUser.ID).ToString();
            return(Json(result));
        }
Пример #7
0
        /// <summary>
        /// 保存管理员信息
        /// </summary>
        /// <param name="opInfo"></param>
        /// <returns></returns>
        public JsonResult EditSave(OperatorInfo opInfo)
        {
            AjaxMsgResult   result      = new AjaxMsgResult();
            OperatorService x_opService = new OperatorService();

            if (opInfo.Id > 0)  //更新
            {
                int i = x_opService.Update(() => new OperatorInfo()
                {
                    Username = opInfo.Username, Loginname = opInfo.Loginname
                }, a => a.Id == opInfo.Id);
                if (i > 0)
                {
                    result.Success = true;
                }
                else
                {
                    result.Msg = "更新失败,没有找到该用户!";
                }
            }
            else
            {
                opInfo.Isvalid       = 1;
                opInfo.Createtime    = DateTime.Now;
                opInfo.Lastlogintime = ConstHelper.SqlServerMinTime;
                opInfo.Userpass      = MD5Helper.Md5small(opInfo.Userpass);
                x_opService.Insert(opInfo);
                result.Success = true;
            }
            return(Json(result));
        }
Пример #8
0
        /// <summary>
        /// 获取权限树
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult RoleMenuTree(string id)
        {
            AjaxMsgResult     msg       = new AjaxMsgResult();
            ModuleMenuService mmService = new ModuleMenuService();
            var mlist = mmService.Get(a => a.Isvalid == 1);
            RoleModuleService rmmService = new RoleModuleService();
            var rmlist            = rmmService.Get(a => a.RoleCode == id);
            List <zTreeData> list = new List <zTreeData>();

            foreach (var item in mlist)
            {
                zTreeData zd = new zTreeData()
                {
                    id   = item.Controlleraction,
                    name = item.Modulename,
                    open = true,
                    pId  = item.ParentControlleraction
                };
                if (!string.IsNullOrEmpty(id))
                {
                    foreach (var ritem in rmlist)
                    {
                        if (ritem.ModuleControlleraction == item.Controlleraction)
                        {
                            zd.@checked = true;
                            break;
                        }
                    }
                }
                list.Add(zd);
            }
            msg.Success = true;
            msg.Source  = list;
            return(Json(msg));
        }
Пример #9
0
        public void Verify()
        {
            UC_User model = new UC_User();

            model.Mobile   = "18600522656";
            model.PassWord = "******";
            result         = con.Verify(model);
        }
Пример #10
0
        public void Update()
        {
            UC_User model = new UC_User();

            model.Mobile   = "18600522656";
            model.PassWord = "******";
            List <string> ids = new List <string>();

            ids.Add("YH4F2127A3521E42709FD371BF9434C051");
            result = con.Update(ids, model, model);
        }
Пример #11
0
        public void PostgreSQLTest()
        {
            //var list = new PostgreSQL().ExecuteReader<Number>("select * from test");
            //list.ForEach(t => Console.WriteLine(t.ToString()));
            UC_User model = new UC_User();

            model.Mobile   = "18600522656";
            model.PassWord = "******";
            result         = con.Add(model);
            Console.ReadLine();
        }
Пример #12
0
        public JsonResult SetAllPack()
        {
            AjaxMsgResult      result       = new AjaxMsgResult();
            RedPackListService x_rplService = new RedPackListService();
            var list = x_rplService.getAllUser();

            if (list.Count > 0)
            {
                lock (locker)
                {
                    list = x_rplService.getAllUser();
                    int count = 0;
                    for (int i = 0; i < list.Count; i++)
                    {
                        string noncestr = "";
                        string paysing  = "";
                        var    item     = list[i];
                        //Senparc.Weixin.MP.TenPayLibV3.RedPackApi.SendNormalRedPack("appid", "mchid", "tenpaykey", "certpath", "openid", "sendername", "ip", 125, "wishing word", "actionname", "remark", out noncestr, out paysing, "mchBillNo");
                        RequestModel model = new RequestModel()
                        {
                            openid      = item.OpenId,
                            amount      = item.PackMoney.ToString(),
                            clientip    = "127.0.0.1",
                            clientport  = "80",
                            hdclass     = "17",
                            sendtxt     = "解放碑地下环道游戏红包",
                            timecontrol = "1"
                        };
                        string req = SendRedPack.SendTo(model);
                        if (!req.Contains("Error") && req.Contains("{\"State\":\"0\"}"))
                        {
                            x_rplService.Update(() => new RedPackListInfo()
                            {
                                Noncestr = req, PaySign = paysing, PackStatus = 1
                            }, a => a.ID == item.ID);
                            count++;
                        }
                        Thread.Sleep(10);
                        if (i > 0 && i % 300 == 0)
                        {
                            Thread.Sleep(15000);
                        }
                    }
                    result.Success = true;
                    result.Msg     = "该发" + list.Count + "个,实发" + count + "个用户发送了红包!";
                }
            }
            else
            {
                result.Success = false;
                result.Msg     = "所有用户都已发送过红包";
            }
            return(Json(result));
        }
Пример #13
0
        public JsonResult outit()
        {
            AjaxMsgResult result     = new AjaxMsgResult();
            UserService   x_uService = new UserService();
            int           uid        = Convert.ToInt32(Request.Form["d"]);

            x_uService.Update(() => new UserInfo()
            {
                IsValid = 0
            }, a => a.ID == uid);
            result.Success = true;
            return(Json(result));
        }
Пример #14
0
 public JsonResult Login(Login login)
 {
     result.Success = false;
     //判断token是否正确
     if (string.IsNullOrWhiteSpace(login.URL) || string.IsNullOrWhiteSpace(login.Token))
     {
         result.State = AjaxMsgResult.StateEnum.VerifyFailed;
         result.Msg   = "登录来源不明!";
         return(Json(result));
     }
     //appInfoModel.Token = Token;
     //if (appService.Verify(appInfoModel).Success == false)
     //{
     //    result.State = AjaxMsgResult.StateEnum.VerifyFailed;
     //    result.Msg = "登录来源不明!";
     //    return Json(result);
     //}
     if (string.IsNullOrWhiteSpace(login.LoginName) || string.IsNullOrWhiteSpace(login.PassWord))
     {
         result.State = AjaxMsgResult.StateEnum.VerifyFailed;
         result.Msg   = "用户名和密码不能为空!";
         return(Json(result));
     }
     else
     {
         model.PassWord = login.PassWord;
         if (Com.isTelephone(login.LoginName))//如果是手机
         {
             model.Mobile = login.LoginName;
         }
         else if (Com.isMail(login.LoginName))//如果是邮箱
         {
             model.Email = login.LoginName;
         }
         else//如果是登录名
         {
             model.LoginName = login.LoginName;
         }
         result = service.Verify(model);
         if (result.Success == true)
         {
             //缓存
             List <UC_User> list     = (List <UC_User>)result.Source;
             string         key      = list[0].Id;
             string         jsonData = JsonConvert.SerializeObject(list[0]);
             RedisHelper.StringSet(key, jsonData, new TimeSpan(30, 0, 0, 0, 0));
             result.Source = login.URL;//返回此URL
         }
     }
     return(Json(result));
 }
Пример #15
0
        /// <summary>
        /// 设置角色状态
        /// </summary>
        /// <returns></returns>
        public JsonResult ResetRoleStatus()
        {
            string        ids         = Request.Form["ids"];
            int           type        = Convert.ToInt32(Request.Form["type"]);
            RoleService   x_rlSerivce = new RoleService();
            int           i           = x_rlSerivce.DelOp(ids, type);
            AjaxMsgResult msg         = new AjaxMsgResult()
            {
                Success = true,
                Msg     = "成功处理" + i + "个角色!"
            };

            return(Json(msg));
        }
Пример #16
0
        /// <summary>
        /// 封禁激活帐号
        /// </summary>
        /// <returns></returns>
        public JsonResult ResetStatus()
        {
            string          ids  = Request.Form["ids"];
            int             type = Convert.ToInt32(Request.Form["type"]);
            OperatorService oms  = new OperatorService();
            int             i    = oms.DelOp(ids, type);
            AjaxMsgResult   msg  = new AjaxMsgResult()
            {
                Success = true,
                Msg     = "成功处理" + i + "个用户!"
            };

            return(Json(msg));
        }
Пример #17
0
        /// <summary>
        /// 重设密码
        /// </summary>
        /// <returns></returns>
        public JsonResult ResetPass()
        {
            string          ids         = Request.Form["ids"];
            OperatorService x_opService = new OperatorService();
            string          pwd         = MD5Helper.Md5small("123456A");
            int             i           = x_opService.Resetpwd(ids, pwd);
            AjaxMsgResult   msg         = new AjaxMsgResult()
            {
                Success = true,
                Msg     = "成功重设" + i + "个用户密码!"
            };

            return(Json(msg));
        }
Пример #18
0
 //IDataBase con = new PostgreSQL();
 #region 添加用户
 /// <summary>
 /// 添加用户
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public AjaxMsgResult Add(UC_User model, string CreateUser = null)
 {
     result.Success = false;
     try
     {
         if (IsRepeat(model.LoginName, model.Mobile, model.Email) == true)
         {
             result.State = AjaxMsgResult.StateEnum.IsExist;
             result.Msg   = "添加失败,存在相同的数据!";
             return(result);
         }
         if (string.IsNullOrWhiteSpace(model.LoginName) && string.IsNullOrWhiteSpace(model.Mobile) && string.IsNullOrWhiteSpace(model.Email))
         {
             result.State = AjaxMsgResult.StateEnum.VerifyFailed;
             result.Msg   = "添加失败,注册用户名为空!";
             return(result);
         }
         Dictionary <string, object> dic = new Dictionary <string, object>();
         StringBuilder sql = new StringBuilder();
         sql.Append(@" INSERT INTO UC_User(Id,UserName,LoginName,PassWord,IsValid,Status,Mobile,CreateUser,CreateTime) VALUES (?Id,?UserName,?LoginName,?PassWord,?IsValid,?Status,?Mobile,?CreateUser,?CreateTime)");
         string id = NewData.NewId("YH");
         dic.Add("Id", id);
         dic.Add("UserName", model.UserName);
         dic.Add("LoginName", model.LoginName);
         dic.Add("PassWord", Com.SHA512Encrypt(model.PassWord));
         dic.Add("IsValid", model.IsValid);
         dic.Add("Status", model.Status);
         dic.Add("Mobile", model.Mobile);
         dic.Add("CreateUser", CreateUser == null? id:model.CreateUser);
         dic.Add("CreateTime", DateTime.Now);
         int count = DataBaseFactory.GetDataBase(DataBaseType.main).ExecuteNonQuery(sql.ToString(), dic);
         if (count == 1)
         {
             if (userExtendService.Add(id).Success == true)
             {
                 result = Verify(model);
             }
         }
         else
         {
             result.Msg = "添加失败,请检查数据合法性!";
         }
     }
     catch (Exception e)
     {
         result.Msg = e.ToString();
     }
     return(result);
 }
Пример #19
0
        public JsonResult SaveRole(int id)
        {
            string nodes = Request.Form["nodes"];

            if (!string.IsNullOrEmpty(nodes))
            {
                nodes = nodes.Trim(',');
            }
            OperatorRoleService x_orService = new OperatorRoleService();
            int           i   = x_orService.UpdateRoleModule(id, nodes);
            AjaxMsgResult msg = new AjaxMsgResult();

            msg.Msg = "保存成功";
            return(Json(msg));
        }
Пример #20
0
        public JsonResult Register(Register register)
        {
            result.Success = false;
            var number = RedisHelper.StringGet(register.Mobile + "registerNumber");

            if (!register.VerifyNumber.Equals(number))
            {
                result.State = AjaxMsgResult.StateEnum.VerifyFailed;
                result.Msg   = "验证码错误!";
                return(Json(result));
            }
            if (string.IsNullOrWhiteSpace(register.LoginName) && string.IsNullOrWhiteSpace(register.Mobile) && string.IsNullOrWhiteSpace(register.Email) && string.IsNullOrWhiteSpace(register.PassWord))
            {
                result.State = AjaxMsgResult.StateEnum.VerifyFailed;
                result.Msg   = "用户名和密码不能为空!";
                return(Json(result));
            }
            if (!register.PassWord.Equals(register.PassWord2))
            {
                result.State = AjaxMsgResult.StateEnum.VerifyFailed;
                result.Msg   = "两次密码不一致!";
                return(Json(result));
            }
            else
            {
                model.LoginName = register.LoginName;
                model.Mobile    = register.Mobile;
                model.Email     = register.Email;
                model.PassWord  = register.PassWord;
                model.IsValid   = model.IsValid == null?0:model.IsValid;
                model.Status    = model.Status == null ? 0 : model.Status;
                result          = service.Add(model);
                if (result.Success == true)
                {
                    //记入Redis
                    List <UC_User> list     = (List <UC_User>)result.Source;
                    string         key      = list[0].Id;
                    string         jsonData = JsonConvert.SerializeObject(list[0]);
                    RedisHelper.StringSet(key, jsonData, new TimeSpan(30, 0, 0, 0, 0));
                    result.Source = register.URL;//返回此URL
                }
            }

            return(Json(result));
        }
Пример #21
0
        public JsonResult ResetStatus(string ids, int type)
        {
            AjaxMsgResult  result      = new AjaxMsgResult();
            RedPackService x_rpService = new RedPackService();
            int            i           = x_rpService.ResetStatus(ids, type);

            if (i > 0)
            {
                result.Success = true;
                result.Msg     = "重置状态成功";
            }
            else
            {
                result.Success = false;
                result.Msg     = "重置状态处理失败";
            }
            return(Json(result));
        }
Пример #22
0
        public JsonResult GameRed()
        {
            AjaxMsgResult result = new AjaxMsgResult();

            RedPackListService x_rplService = new RedPackListService();
            var info = x_rplService.CheckInRedPack(this.CurrentUser.ID);

            if (info.PackId > 0)
            {
                result.Success = true;
                result.Source  = info;
            }
            else
            {
                result.Success = false;
                result.Msg     = info.RbName;
            }

            return(Json(result));
        }
Пример #23
0
        public JsonResult SetLink()
        {
            AjaxMsgResult result = new AjaxMsgResult();

            if (!isInTime())
            {
                result.Msg = "活动已过期";
                return(Json(result));
            }
            string realname = Request.Form["x_realname"];
            string phone    = Request.Form["x_phone"];
            int    ages     = Convert.ToInt32(Request.Form["x_ages"]);
            string jobon    = Request.Form["x_jobon"];

            UserService x_uService = new UserService();
            int         i          = x_uService.Update(() => new UserInfo()
            {
                RealName = realname, Phone = phone, Ages = ages, JobOn = jobon, SubTime = DateTime.Now
            }, a => a.ID == CurrentUser.ID);

            result.Success = true;
            return(Json(result));
        }
Пример #24
0
        public JsonResult getLast()
        {
            AjaxMsgResult result = new AjaxMsgResult();

            if (!isInTime())
            {
                result.Msg = "活动已过期";
                return(Json(result));
            }
            int userid = 0;

            if (!string.IsNullOrEmpty(Request.Form["uid"]))
            {
                userid = Convert.ToInt32(Request.Form["uid"]);
            }
            if (userid == 0)
            {
                userid = CurrentUser.ID;
            }
            UserPhotoService x_upService = new UserPhotoService();
            var item = x_upService.GetMyLast(userid);

            item.FatherPhoto += "_1.jpg";
            item.ChildPhoto  += "_1.jpg";
            if (item != null)
            {
                result.Success = true;
                result.Source  = item;
            }
            else
            {
                result.Success = false;
                result.Msg     = "请先上传照片";
            }
            return(Json(result));
        }
Пример #25
0
 public void addUserExtendService()
 {
     result = userExtendService.Add("YH04eb525ecb64426ea23e209fb7a5982c");
 }
Пример #26
0
        public JsonResult upFile()
        {
            AjaxMsgResult reuslt = new AjaxMsgResult();

            if (!isInTime())
            {
                reuslt.Msg = "活动已过期";
                return(Json(reuslt));
            }
            HttpPostedFileBase file   = Request.Files[0];
            string             skey   = "x_photo_up";
            UpFileTypeInfo     uftype = new UpFileTypeInfo();

            if (Session[skey] != null)
            {
                uftype = Session[skey] as UpFileTypeInfo;
            }
            else
            {
                Session[skey] = uftype;
            }
            if (file != null)
            {
                string oripath = "/uploads/" + CurrentUser.ID + "/";
                string path    = Server.MapPath(oripath);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string filename = DateTime.Now.ToString("yyMMddhhmmssfff") + file.FileName;
                file.SaveAs(path + filename);
                ThumbnailHelper.MakeThumbnailImage(path + filename, path + filename + "_1.jpg", 400, 400);
                string dbpath = oripath + filename;
                if (string.IsNullOrEmpty(uftype.fatherp))
                {
                    uftype.fatherp = dbpath;
                }
                else if (string.IsNullOrEmpty(uftype.childp))
                {
                    uftype.childp = dbpath;
                }
                if (!string.IsNullOrEmpty(uftype.fatherp) && !string.IsNullOrEmpty(uftype.childp))
                {
                    UserPhotoService x_upService = new UserPhotoService();
                    UserPhotoInfo    uinfo       = new UserPhotoInfo()
                    {
                        UserId       = CurrentUser.ID,
                        FatherPhoto  = uftype.fatherp,
                        ChildPhoto   = uftype.childp,
                        CreateTime   = DateTime.Now,
                        IsValid      = 1,
                        PerValueTime = DateTime.Now.AddYears(-100)
                    };
                    x_upService.Insert(uinfo);
                    uftype.fatherp = null;
                    uftype.childp  = null;
                }
                reuslt.Success = true;
                reuslt.Source  = dbpath + "_1.jpg";
            }
            return(Json(reuslt));
        }