Example #1
0
        /// <summary>
        /// 根据Id获取模块
        /// </summary>
        /// <param name="moduleId"></param>
        /// <returns></returns>
        public JArray GetModuleById(string moduleId, UserInfo UserInfo)
        {
            var     requests = new List <Object>();
            JObject param    = new JObject {
                {
                    "where", new JObject
                    {
                        { "id", moduleId }
                    }
                },
                {
                    "fields", new JArray {
                        "id", "name", "type", "parent", "pageEnNo", "pageNo", "enabled"
                    }
                }
            };

            requests.Add(new
            {
                method = "GET",
                path   = "/mcm/api/module?filter=" + JsonConvert.SerializeObject(param),
            });
            JArray ret = ComCloud.ajaxRequest(requests, UserInfo.Token);

            return(ret);
        }
Example #2
0
        /// <summary>
        /// 获取所有父模块
        /// </summary>
        /// <param name="UserInfo"></param>
        /// <returns></returns>
        public JArray GetModuleType(UserInfo UserInfo)
        {
            var requests = new List <Object>();
            //获取所有父模块
            JObject paramParent = new JObject
            {
                {
                    "where", new JObject
                    {
                        { "parent", null }
                    }
                },
                {
                    "pageNo", new JArray {
                        "id DESC"
                    }
                },
                {
                    "fields", new JArray {
                        "id", "name", "type", "pageEnNo", "pageNo"
                    }
                }
            };

            requests.Add(new
            {
                method = "GET",
                path   = "/mcm/api/module?filter=" + JsonConvert.SerializeObject(paramParent)
            });
            JArray ret = ComCloud.ajaxRequest(requests, UserInfo.Token);

            return(ret);
        }
Example #3
0
        /// <summary>
        /// 获取用户对应的模块
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="company"></param>
        /// <param name="Token"></param>
        /// <returns></returns>
        public JArray GetUserModule(UserInfo UserInfo)
        {
            var     userId   = UserInfo.UserName;
            var     Token    = UserInfo.Token;
            var     company  = UserInfo.Company;
            var     requests = new List <Object>();
            JObject param    = new JObject
            {
                {
                    "where", new JObject {
                        {
                            "type", "PC"
                        },
                        {
                            "enabled", "Y"
                        }
                    }
                }, {
                    "fields", new JArray {
                        "id", "enabled", "name", "parent", "pagePath", "pageNo"
                    }
                }
            };

            requests.Add(new
            {
                method = "GET",
                path   = "/mcm/api/module?filter=" + JsonConvert.SerializeObject(param)
            });
            JArray ret = ComCloud.ajaxRequest(requests, Token);

            return(ret);
        }
Example #4
0
        /// <summary>
        /// 根据用户Id
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public JArray GetUserCompany(UserInfo UserInfo)
        {
            var     userId   = UserInfo.UserName;
            var     Token    = UserInfo.Token;
            var     requests = new List <Object>();
            JObject param    = new JObject
            {
                { "include", "companyPointer" },
                { "where", new JObject {
                      { "status", "1" }, { "user", userId }
                  } },
                { "fields", new JArray {
                      "id", "company"
                  } },
                { "includeFilter", new JObject {
                      { "company", new JObject {
                            { "fields", new JArray {
                                                         "id", "name"
                                                     } }
                        } }
                  } }
            };

            requests.Add(new
            {
                method = "GET",
                path   = "/mcm/api/comStaff?filter=" + JsonConvert.SerializeObject(param)
            });
            JArray ret = ComCloud.ajaxRequest(requests, Token);

            return(JArray.Parse(ret.First().ToString()));
        }
Example #5
0
        /// <summary>
        /// 根据Id删除模块
        /// </summary>
        /// <param name="ModuleId"></param>
        /// <param name="Token"></param>
        /// <returns></returns>
        public JObject DelModuleById(string ModuleId, UserInfo UserInfo)
        {
            var requests = new List <Object>();

            requests.Add(new
            {
                method = "DELETE",
                path   = "/mcm/api/module/" + ModuleId
            });
            JArray ret = ComCloud.ajaxRequest(requests, UserInfo.Token);

            return(ComCloud.callBackData(ret));
        }
Example #6
0
        /// <summary>
        /// 新增模块
        /// </summary>
        /// <param name="Module"></param>
        /// <param name="Token"></param>
        /// <returns></returns>
        public JObject AddModule(JObject Module, UserInfo UserInfo)
        {
            var requests = new List <Object>();

            requests.Add(new
            {
                method = "POST",
                path   = "/mcm/api/module",
                body   = Module
            });
            JArray ret = ComCloud.ajaxRequest(requests, UserInfo.Token);

            return(ComCloud.callBackData(ret));
        }
Example #7
0
        /// <summary>
        /// 修改模块
        /// </summary>
        /// <param name="Module"></param>
        /// <param name="Token"></param>
        /// <returns></returns>
        public JObject EditModuleById(JObject Module, UserInfo UserInfo)
        {
            var    requests = new List <Object>();
            string Spath    = "/mcm/api/module/" + Module["id"];

            Module.Remove("id");
            requests.Add(new
            {
                method = "PUT",
                path   = Spath,
                body   = Module
            });
            JArray ret = ComCloud.ajaxRequest(requests, UserInfo.Token);

            return(ComCloud.callBackData(ret));;
        }
Example #8
0
        /// <summary>
        /// 登录验证
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        public JObject LoginCheck(string username, string password)
        {
            var requests = new List <Object>();

            requests.Add(new
            {
                method = "POST",
                path   = "/mcm/api/user/login",
                body   = new
                {
                    username = username,
                    password = password
                }
            });
            var    Token = "";
            JArray ret   = ComCloud.ajaxRequest(requests, Token);

            return(JObject.Parse(ret.First().ToString()));
        }