...
|
...
|
@@ -19,10 +19,15 @@ const { |
|
|
FETCH_CONTENT_LIST_SUCCESS,
|
|
|
FETCH_CONTENT_LIST_FAILURE,
|
|
|
|
|
|
//新增回复或关注
|
|
|
ADD_CONTENT_INBOX_REQUEST,
|
|
|
ADD_CONTENT_INBOX_SUCCESS,
|
|
|
ADD_CONTENT_INBOX_FAILURE,
|
|
|
//回复评论
|
|
|
ADD_ARTICLE_COMMENT_REQUEST,
|
|
|
ADD_ARTICLE_COMMENT_SUCCESS,
|
|
|
ADD_ARTICLE_COMMENT_FAILURE,
|
|
|
|
|
|
//关注用户
|
|
|
UPDATE_ATTENTION_REQUEST,
|
|
|
UPDATE_ATTENTION_SUCCESS,
|
|
|
UPDATE_ATTENTION_FAILURE,
|
|
|
|
|
|
//清除消息内容
|
|
|
MESSAGE_CLEAR_OTHER_LIST,
|
...
|
...
|
@@ -95,22 +100,42 @@ export function getContentListFailure(error, isLatest) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
export function addContentInBoxRequest() {
|
|
|
export function addArticleCommentRequest() {
|
|
|
return {
|
|
|
type: ADD_ARTICLE_COMMENT_REQUEST,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function addArticleCommentSuccess(json) {
|
|
|
return {
|
|
|
type: ADD_ARTICLE_COMMENT_SUCCESS,
|
|
|
payload: json,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function addArticleCommentFailure(error) {
|
|
|
return {
|
|
|
type: ADD_CONTENT_INBOX_REQUEST,
|
|
|
type: ADD_ARTICLE_COMMENT_FAILURE,
|
|
|
payload: error,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function updateAttentionRequest() {
|
|
|
return {
|
|
|
type: UPDATE_ATTENTION_REQUEST,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function addContentInBoxSuccess(json) {
|
|
|
export function updateAttentionSuccess(json) {
|
|
|
return {
|
|
|
type: ADD_CONTENT_INBOX_SUCCESS,
|
|
|
type: UPDATE_ATTENTION_SUCCESS,
|
|
|
payload: json,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export function addContentInBoxFailure(error) {
|
|
|
export function updateAttentionFailure(error) {
|
|
|
return {
|
|
|
type: ADD_CONTENT_INBOX_FAILURE,
|
|
|
type: UPDATE_ATTENTION_FAILURE,
|
|
|
payload: error,
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -252,18 +277,18 @@ function parseContentList(json) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
//新增消息
|
|
|
export function addContentInBox(businessType, attachId, addValue) {
|
|
|
//回复评论
|
|
|
export function addArticleCommentAction(content, destId, commentId, addType, columnType) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app} = getState();
|
|
|
let processor = (uid)=> {
|
|
|
dispatch(addContentInBoxRequest());
|
|
|
return new ContentService().addMessageInBox(businessType, attachId, addValue, uid)
|
|
|
dispatch(addArticleCommentRequest());
|
|
|
return new ContentService().addArticleComment(content, destId, uid, commentId, addType, columnType)
|
|
|
.then(json => {
|
|
|
dispatch(addContentInBoxSuccess(json));
|
|
|
dispatch(addArticleCommentSuccess(json));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
dispatch(addContentInBoxFailure(error));
|
|
|
dispatch(addArticleCommentFailure(error));
|
|
|
});
|
|
|
}
|
|
|
ReactNative.NativeModules.YH_CommonHelper.uid()
|
...
|
...
|
@@ -282,6 +307,37 @@ export function addContentInBox(businessType, attachId, addValue) { |
|
|
};
|
|
|
}
|
|
|
|
|
|
//关注用户
|
|
|
export function updateAttentionAction(attentionStatus) {
|
|
|
return (dispatch, getState) => {
|
|
|
let {app} = getState();
|
|
|
let processor = (uid)=> {
|
|
|
dispatch(updateAttentionRequest());
|
|
|
return new ContentService().updateAttention(uid, attentionStatus)
|
|
|
.then(json => {
|
|
|
dispatch(updateAttentionSuccess(json));
|
|
|
})
|
|
|
.catch(error => {
|
|
|
dispatch(updateAttentionFailure(error));
|
|
|
});
|
|
|
}
|
|
|
ReactNative.NativeModules.YH_CommonHelper.uid()
|
|
|
.then(uid => {
|
|
|
processor(uid)
|
|
|
})
|
|
|
.catch(error => {
|
|
|
ReactNative.NativeModules.YH_CommonHelper.login()
|
|
|
.then(uid => {
|
|
|
processor(uid)
|
|
|
})
|
|
|
.catch(error => {
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function clearCommentMessageList() {
|
|
|
return (dispatch) => {
|
|
|
dispatch(clearCommentMessageListAction());
|
...
|
...
|
|