Exemple #1
0
        /// <summary>
        /// 获取我通过转发或者扫码浏览过的员工名片
        /// </summary>
        /// <param name="aid"></param>
        /// <param name="userId"></param>
        /// <param name="totalCount"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="actionType"></param>
        /// <param name="dataType"></param>
        /// <returns></returns>
        public List <QiyeEmployee> GetMyListQiyeEmployee(int aid, int userId, out int totalCount, int pageIndex = 1, int pageSize = 10)
        {
            totalCount = 0;
            List <QiyeEmployee>        list = new List <QiyeEmployee>();
            List <int>                 listQiyeEmployeeId      = new List <int>();
            List <QiyeUserFavoriteMsg> listQiyeUserFavoriteMsg = QiyeUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsgList(aid, userId, out totalCount, pageIndex, pageSize, (int)PointsDataType.客户, (int)PointsActionType.扫码, (int)PointsActionType.转发);

            if (listQiyeUserFavoriteMsg != null && listQiyeUserFavoriteMsg.Count > 0)
            {
                foreach (QiyeUserFavoriteMsg item in listQiyeUserFavoriteMsg)
                {
                    listQiyeEmployeeId.Add(item.MsgId);
                }

                list = GetListByIds(string.Join(",", listQiyeEmployeeId));
                list.ForEach(x =>
                {
                    QiyeUserFavoriteMsg qiyeUserFavoriteMsg = listQiyeUserFavoriteMsg.Find(y => y.MsgId == x.Id);
                    if (qiyeUserFavoriteMsg != null)
                    {
                        x.Source = qiyeUserFavoriteMsg.ActionType == 6 ? "来自转发" : "来自扫码";
                    }
                    x.MsgCount = ImMessageBLL.SingleModel.GetCountBySql($"select count(*) from immessage where tuserid={userId} and fuserid={x.UserId} and isread=0");
                });
            }


            return(list);
        }
Exemple #2
0
        public string CommondFavoriteMsg(int aid, int msgId, int userId, int actionType, int dataType, ref int curState)
        {
            int count = 1;

            //记录表
            QiyeUserFavoriteMsg qiyeUserFavoriteMsgModel = QiyeUserFavoriteMsgBLL.SingleModel.GetUserFavoriteMsg(aid, msgId, userId, actionType, dataType);

            if (qiyeUserFavoriteMsgModel == null)
            {
                qiyeUserFavoriteMsgModel            = new QiyeUserFavoriteMsg();
                qiyeUserFavoriteMsgModel.ActionType = actionType;
                qiyeUserFavoriteMsgModel.AddTime    = DateTime.Now;
                qiyeUserFavoriteMsgModel.AId        = aid;
                qiyeUserFavoriteMsgModel.Datatype   = dataType;
                qiyeUserFavoriteMsgModel.MsgId      = msgId;
                qiyeUserFavoriteMsgModel.State      = 0;
                qiyeUserFavoriteMsgModel.UserId     = userId;
            }
            else if (qiyeUserFavoriteMsgModel.State == -1)
            {
                qiyeUserFavoriteMsgModel.State = 0;
            }
            else if (qiyeUserFavoriteMsgModel.State == 0)//取消
            {
                qiyeUserFavoriteMsgModel.State = -1;
                count = -1;
            }
            curState = qiyeUserFavoriteMsgModel.State;
            //统计表
            QiyeMsgviewFavoriteShare qiyemsgviewModel = QiyeMsgviewFavoriteShareBLL.SingleModel.GetModelByMsgId(aid, msgId, dataType);

            if (qiyemsgviewModel == null)
            {
                qiyemsgviewModel               = new QiyeMsgviewFavoriteShare();
                qiyemsgviewModel.AddTime       = DateTime.Now;
                qiyemsgviewModel.AId           = aid;
                qiyemsgviewModel.DataType      = dataType;
                qiyemsgviewModel.DzCount       = 0;
                qiyemsgviewModel.FavoriteCount = 0;
                qiyemsgviewModel.FollowCount   = 0;
                qiyemsgviewModel.MsgId         = msgId;
                qiyemsgviewModel.ShareCount    = 0;
                qiyemsgviewModel.SiXinCount    = 0;
                qiyemsgviewModel.ViewCount     = 0;
                qiyemsgviewModel.Id            = Convert.ToInt32(QiyeMsgviewFavoriteShareBLL.SingleModel.Add(qiyemsgviewModel));
            }

            switch (actionType)
            {
            case (int)PointsActionType.关注: qiyemsgviewModel.FollowCount += count; break;

            case (int)PointsActionType.收藏: qiyemsgviewModel.FavoriteCount += count; break;

            case (int)PointsActionType.点赞: qiyemsgviewModel.DzCount += count; break;

            case (int)PointsActionType.过: qiyemsgviewModel.ViewCount += 1; break;

            case (int)PointsActionType.私信: qiyemsgviewModel.SiXinCount += 1; break;

            case (int)PointsActionType.转发: qiyemsgviewModel.ShareCount += 1; break;
            }

            QiyeMsgviewFavoriteShareBLL.SingleModel.Update(qiyemsgviewModel);
            if (qiyeUserFavoriteMsgModel.Id > 0)
            {
                if (actionType != (int)PointsActionType.扫码 && actionType != (int)PointsActionType.转发 && actionType != (int)PointsActionType.过 && actionType != (int)PointsActionType.私信)
                {
                    qiyeUserFavoriteMsgModel.AddTime = DateTime.Now;
                    QiyeUserFavoriteMsgBLL.SingleModel.Update(qiyeUserFavoriteMsgModel, "State,AddTime");
                }
            }
            else
            {
                qiyeUserFavoriteMsgModel.Id = Convert.ToInt32(QiyeUserFavoriteMsgBLL.SingleModel.Add(qiyeUserFavoriteMsgModel));
                if (qiyeUserFavoriteMsgModel.Id <= 0)
                {
                    return("操作失效");
                }
            }

            return("");
        }