Ejemplo n.º 1
0
        public string GetUpdatedUsers()
        {
            GetUpdatedUsers actionParams = JavaScriptConvert.DeserializeObject <GetUpdatedUsers>(JsonParams);

            List <UserLogInfo> userLogList = ManyouApplications.GetUserLog(actionParams.Count);

            List <UserInfoWithAction> userInfoWithActionList = new List <UserInfoWithAction>();

            foreach (UserLogInfo userLogInfo in userLogList)
            {
                UserInfoWithAction userInfoWithAction = new UserInfoWithAction();
                userInfoWithAction.Action = userLogInfo.Action.ToString();
                if (userLogInfo.Action != UserLogActionEnum.Delete)
                {
                    Discuz.Entity.UserInfo userInfo = Forum.Users.GetUserInfo(userLogInfo.UId);
                    userInfoWithAction.UserName = userInfo.Username;
                }
                userInfoWithAction.Action = userLogInfo.Action.ToString().ToLower();
                userInfoWithAction.Uid    = userLogInfo.UId;

                userInfoWithActionList.Add(userInfoWithAction);
            }

            GetUpdateUsersResponse guuResponse = new GetUpdateUsersResponse();

            guuResponse.TotalNum = userInfoWithActionList.Count >= actionParams.Count ? actionParams.Count * 2 : userInfoWithActionList.Count;
            guuResponse.UserInfoWithActionList = userInfoWithActionList;
            return(GetResult(guuResponse));
        }
Ejemplo n.º 2
0
        public string Add()
        {
            AddUserApplicationParams actionParam = JavaScriptConvert.DeserializeObject <AddUserApplicationParams>(UnicodeToString(JsonParams));//当传递过来的参数值可能存在unicode编码的字符串时需要使用UnicodeToString方法

            UserApplicationInfo userAppInfo = new UserApplicationInfo();

            userAppInfo.AppId            = actionParam.AppId;
            userAppInfo.AppName          = actionParam.AppName;
            userAppInfo.Uid              = actionParam.Uid;
            userAppInfo.AllowFeed        = actionParam.AllowFeed == null || (bool)actionParam.AllowFeed ? 1 : 0;//可不传递型属性处理实例
            userAppInfo.AllowProfileLink = actionParam.AllowProfileLink == null || (bool)actionParam.AllowProfileLink ? 1 : 0;
            userAppInfo.AllowSideNav     = actionParam.AllowSideNav == null || (bool)actionParam.AllowSideNav ? 1 : 0;
            userAppInfo.DisplayOrder     = actionParam.DisplayOrder == null ? 0 : (int)actionParam.DisplayOrder;
            userAppInfo.Privacy          = Utils.GetEnum <PrivacyEnum>(actionParam.Privacy, PrivacyEnum.Public);

            //不确定代码
            userAppInfo.ProfileLink = actionParam.DefaultProfileLink;
            userAppInfo.MYML        = actionParam.DefaultMYML;

            //当用户添加应用的时候,会在全局应用表中也增加或者更新原有记录,保证数据同步
            ManyouApplicationInfo appInfo = new ManyouApplicationInfo();

            appInfo.AppId         = actionParam.AppId;
            appInfo.AppName       = actionParam.AppName;
            appInfo.DisplayMethod = Utils.GetEnum <DisplayMethod>(actionParam.DisplayMethod, DisplayMethod.IFrame);
            appInfo.DisplayOrder  = actionParam.DisplayOrder ?? 0;
            appInfo.Version       = TypeConverter.StrToInt(actionParam.Version);

            ManyouApplications.UpdateApplicationInfo(appInfo);

            return(GetResult(ManyouApplications.AddUserApplication(userAppInfo) > -1));
        }
Ejemplo n.º 3
0
        public string Remove()
        {
            RemoveApplicationParams actionParams = JavaScriptConvert.DeserializeObject <RemoveApplicationParams>(JsonParams);

            int result = ManyouApplications.RemoveApplication(actionParams.AppIdList);

            return(GetResult(result > 0 ? result : 1));
        }
Ejemplo n.º 4
0
        private string UpdateUserAppFieldsInfo()
        {
            SetUserAppFieldsInfoParams actionParams = JavaScriptConvert.DeserializeObject <SetUserAppFieldsInfoParams>(UnicodeToString(JsonParams));

            UserApplicationInfo userAppInfo = ManyouApplications.GetUserApplicationInfo(actionParams.UId, actionParams.AppId.ToString())[0];

            userAppInfo.MYML        = actionParams.Markup != "" ? actionParams.Markup : userAppInfo.MYML;
            userAppInfo.ProfileLink = actionParams.ActionMarkup != "" ? actionParams.ActionMarkup : userAppInfo.ProfileLink;

            return(GetResult(ManyouApplications.UpdateUserApplication(userAppInfo)));
        }
Ejemplo n.º 5
0
        public string Update()
        {
            UpdateApplicationParams actionParams = JavaScriptConvert.DeserializeObject <UpdateApplicationParams>(UnicodeToString(JsonParams));
            ManyouApplicationInfo   appInfo      = new ManyouApplicationInfo();

            appInfo.AppId         = actionParams.AppId;
            appInfo.AppName       = actionParams.AppName;
            appInfo.DisplayMethod = Utils.GetEnum <DisplayMethod>(actionParams.DisplayMethod, DisplayMethod.IFrame);
            appInfo.DisplayOrder  = actionParams.DisplayOrder;
            appInfo.Version       = actionParams.Version;

            return(GetResult(ManyouApplications.UpdateApplicationInfo(appInfo)));
        }
Ejemplo n.º 6
0
        public string SetFlag()
        {
            SetApplicationFlagParams actionParams = JavaScriptConvert.DeserializeObject <SetApplicationFlagParams>(UnicodeToString(JsonParams));
            string appIdList   = "";
            string appNameList = "";

            foreach (ApplicationInfo appInfo in actionParams.Applications)
            {
                appIdList   += appInfo.AppId + ",";
                appNameList += appInfo.AppName + ",";
            }

            return(GetResult(0 <= ManyouApplications.SetApplicationFlag(appIdList.TrimEnd(','), appNameList.TrimEnd(','), Utils.GetEnum <ApplicationFlag>(actionParams.Flag, ApplicationFlag.Normal))));
        }
Ejemplo n.º 7
0
        public string Get()
        {
            GetUserApplicationMessageParams actionParams = JavaScriptConvert.DeserializeObject <GetUserApplicationMessageParams>(JsonParams);

            List <UserApplicationInfo> userAppList = ManyouApplications.GetUserApplicationInfo(actionParams.Uid, actionParams.AppIdList);

            List <UserApplicationMessage> userAppMsgList = new List <UserApplicationMessage>();

            foreach (UserApplicationInfo appInfo in userAppList)
            {
                userAppMsgList.Add(LoadSingleUserApplicationMessage(appInfo));
            }

            return(GetResult(userAppMsgList));
        }
Ejemplo n.º 8
0
        public string Send()
        {
            SendNoticeParams actionParams = JavaScriptConvert.DeserializeObject <SendNoticeParams>(UnicodeToString(JsonParams));

            if (actionParams.UId <= 0)
            {
                return("");
            }

            Dictionary <int, int> noticeTable = new Dictionary <int, int>();

            foreach (int toUid in actionParams.RecipientIds)
            {
                noticeTable.Add(toUid, ManyouApplications.SendApplicationNotice(actionParams.UId, toUid, actionParams.Notification));
            }

            return(GetResult(noticeTable));
        }
Ejemplo n.º 9
0
        public string Update()
        {
            UpdateUserApplicationParams actionParam = JavaScriptConvert.DeserializeObject <UpdateUserApplicationParams>(UnicodeToString(JsonParams));

            UserApplicationInfo userAppInfo = new UserApplicationInfo();

            userAppInfo.AppId            = actionParam.AppIds[0];
            userAppInfo.AppName          = actionParam.AppName;
            userAppInfo.Uid              = actionParam.Uid;
            userAppInfo.AllowFeed        = actionParam.AllowFeed == null || (bool)actionParam.AllowFeed ? 1 : 0;//可不传递型属性处理实例
            userAppInfo.AllowProfileLink = actionParam.AllowProfileLink == null || (bool)actionParam.AllowProfileLink ? 1 : 0;
            userAppInfo.AllowSideNav     = actionParam.AllowSideNav == null || (bool)actionParam.AllowSideNav ? 1 : 0;
            userAppInfo.DisplayOrder     = actionParam.DisplayOrder == null ? 0 : (int)actionParam.DisplayOrder;
            userAppInfo.Privacy          = Utils.GetEnum <PrivacyEnum>(actionParam.Privacy, PrivacyEnum.Public);
            //不确定代码
            userAppInfo.ProfileLink = actionParam.DefaultProfileLink;
            userAppInfo.MYML        = actionParam.DefaultMYML;

            return(GetResult(ManyouApplications.UpdateUserApplication(userAppInfo) > -1));
        }
Ejemplo n.º 10
0
        public string Send()
        {
            SendApplicationInviteParams actionParams = JavaScriptConvert.DeserializeObject <SendApplicationInviteParams>(UnicodeToString(JsonParams));

            Dictionary <string, int> inviteTable = new Dictionary <string, int>();

            foreach (string toUid in actionParams.RecipientIds)
            {
                UserApplicationInviteInfo userAppInviteInfo = new UserApplicationInviteInfo();
                userAppInviteInfo.AppId    = int.Parse(actionParams.AppId);
                userAppInviteInfo.FromUid  = actionParams.UId;
                userAppInviteInfo.Hash     = 1;
                userAppInviteInfo.MYML     = actionParams.MYML;
                userAppInviteInfo.ToUid    = int.Parse(toUid);
                userAppInviteInfo.Type     = actionParams.Type == "invite" ? 0 : 1;
                userAppInviteInfo.TypeName = actionParams.RequestName;
                inviteTable.Add(toUid, ManyouApplications.SendApplicationInvite(userAppInviteInfo));
            }

            return(GetResult(inviteTable));
        }
Ejemplo n.º 11
0
        public string GetInstalled()
        {
            GetUserInstalledApplicationIdParams actionParams = JavaScriptConvert.DeserializeObject <GetUserInstalledApplicationIdParams>(JsonParams);

            return(GetResult(ManyouApplications.GetUserInstalledApplicationId(actionParams.Uid)));
        }
Ejemplo n.º 12
0
        public string Remove()
        {
            RemoveUserApplicationParams actionParams = JavaScriptConvert.DeserializeObject <RemoveUserApplicationParams>(JsonParams);

            return(GetResult(ManyouApplications.RemoveUserApplication(actionParams.Uid, actionParams.AppIdList) > -1));
        }