コード例 #1
0
ファイル: SnsController.cs プロジェクト: yu1238080/WeChatDemo
        public IHttpActionResult SnsComment(SnsComment model)
        {
            ApiServerMsg result = new ApiServerMsg();

            try
            {
                if (XzyWebSocket._dicSockets.ContainsKey(model.uuid))
                {
                    var res = XzyWebSocket._dicSockets[model.uuid].weChatThread.Wx_ESnsComment(model.snsid, model.context, model.replyid);
                    result.Success = true;
                    result.Context = res;
                    return(Ok(result));
                }
                else
                {
                    result.Success = false;
                    result.Context = "不存在该websocket连接";
                    return(Ok(result));
                }
            }
            catch (Exception e)
            {
                result.Success    = false;
                result.ErrContext = e.Message;
                return(Ok(result));
            }
        }
コード例 #2
0
        public bool doSendComment(SnsInfo snsObj, string strContent, CommentType type, AddContactScene source, CommentArg replyInfo = null, int refCommentID = -1)
        {
            if (snsObj == null)
            {
                return(false);
            }
            SnsComment item = new SnsComment
            {
                strContent  = strContent,
                strNickName = AccountMgr.getCurAccount().strNickName,
                strUserName = AccountMgr.getCurAccount().strUsrName,
                nType       = (uint)type,
                nCreateTime = (uint)Util.getNowSeconds(),
                nSource     = (uint)source
            };

            if (replyInfo != null)
            {
                item.nReplyCommentId  = replyInfo.commentID;
                item.strReplyUsername = replyInfo.strUserName;
            }

            if ((type == CommentType.MMSNS_COMMENT_LIKE) || (type == CommentType.MMSNS_COMMENT_STRANGER_LIKE))
            {
                snsObj.likeList.list.Add(item);
                snsObj.likeList.list = snsObj.likeList.list;
                snsObj.likeList      = snsObj.likeList;
                snsObj.nLikeFlag     = 1;
                snsObj.nLikeCount++;
            }
            else
            {
                snsObj.commentList.list.Add(item);
                snsObj.commentList.list = snsObj.commentList.list;
                snsObj.commentList      = snsObj.commentList;
                snsObj.nCommentCount++;
            }
            //if (StorageMgr.snsInfo.getByObjectID(snsObj.strObjectID) != null)
            //{
            //    StorageMgr.snsInfo.updateByObjectID(snsObj);
            //}
            SnsCommentNeedSend comment = NetSceneSnsComment.creatSnsCommentNeedSend(snsObj, strContent, type, source, replyInfo, refCommentID);

            new NetSceneSnsComment().doScene(comment);

            return(true);
        }
コード例 #3
0
        public IHttpActionResult SnsComment(SnsComment model)
        {
            ApiServerMsg apiServerMsg = new ApiServerMsg();

            try
            {
                if (XzyWebSocket._dicSockets.ContainsKey(model.uuid))
                {
                    string context = XzyWebSocket._dicSockets[model.uuid].weChatThread.Wx_ESnsComment(model.snsid, model.context, model.replyid);
                    apiServerMsg.Success = true;
                    apiServerMsg.Context = context;
                    return(Ok(apiServerMsg));
                }
                apiServerMsg.Success = false;
                apiServerMsg.Context = "不存在该websocket连接";
                return(Ok(apiServerMsg));
            }
            catch (Exception ex)
            {
                apiServerMsg.Success    = false;
                apiServerMsg.ErrContext = ex.Message;
                return(Ok(apiServerMsg));
            }
        }