Esempio n. 1
0
        //POST api/System?token={token}&pid={pid}&name={name}&b={b}
        /// <summary>获取平台信息</summary>
        /// <param name="token">令牌</param>
        /// <param name="pid">平台id</param>
        /// <param name="name">用户名称</param>
        /// <param name="b">标识</param>
        public Platform PostFindPlatform(String token, Int32 pid, String name, byte b)
        {
            if (!IsToken(token))
            {
                return(new Platform()
                {
                    result = -1, message = "令牌不存在"
                });
            }

            tgm_platform.SetDbConnName(tgm_connection);
            var entity   = tgm_platform.FindByid(pid);
            var platform = ToEntity.ToPlatform(entity);

            platform.result = 1;
            return(platform);
        }
Esempio n. 2
0
        //  POST api/System?token={token}&pname={pname}&name={name}&pwd={pwd}&b={b}
        /// <summary>平台注册</summary>
        /// /// <param name="token">令牌</param>
        /// <param name="pname">平台名称</param>
        /// <param name="name">注册账号名称</param>
        /// <param name="pwd">注册密码</param>
        /// <param name="b">标识</param>
        /// <returns>处理结果信息</returns>
        public Platform PostRegisterPlatform(String token, String pname, String name, String pwd, Boolean b)
        {
            if (!IsToken(token))
            {
                return(new Platform()
                {
                    result = -1, message = "令牌不存在"
                });
            }

            tgm_platform.SetDbConnName(tgm_connection);
            var entity = tgm_platform.GetFindEntity(name);

            if (entity != null)
            {
                return(new Platform()
                {
                    result = -1, message = "平台名称已存在"
                });
            }
            tgm_role.SetDbConnName(tgm_connection);
            var role = tgm_role.GetFindEntity(name);

            if (role != null)
            {
                return(new Platform()
                {
                    result = -1, message = "账户已存在"
                });
            }

            entity = tgm_platform.Register(pname, name, pwd);
            var platform = ToEntity.ToPlatform(entity);

            platform.result = 1;
            return(platform);
        }