|
|
@@ -8,17 +8,17 @@ module.exports = app => {
|
|
|
try {
|
|
|
const { tenderIds } = ctx.request.body;
|
|
|
if (!tenderIds || !Array.isArray(tenderIds) || tenderIds.length === 0) {
|
|
|
- ctx.body = { err: 1, msg: '参数错误:请提供标段ID数组', data: null };
|
|
|
+ ctx.body = { code: 0, msg: '参数错误:请提供标段ID数组', data: null };
|
|
|
return;
|
|
|
}
|
|
|
const result = await ctx.service.weappAttention.followSections(tenderIds, ctx.projectAccount.id);
|
|
|
if (result) {
|
|
|
- ctx.body = { err: 0, msg: '关注成功', data: null };
|
|
|
+ ctx.body = { code: 0, msg: '关注成功', data: null };
|
|
|
} else {
|
|
|
- ctx.body = { err: 1, msg: '关注失败', data: null };
|
|
|
+ ctx.body = { code: 0, msg: '关注失败', data: null };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- ctx.body = this.ajaxErrorBody(error, '关注操作失败');
|
|
|
+ ctx.body = { code: -1, msg: error.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -26,19 +26,19 @@ module.exports = app => {
|
|
|
async unfollow() {
|
|
|
const { ctx } = this;
|
|
|
try {
|
|
|
- const { tenderIds } = ctx.request.body;
|
|
|
- if (!tenderIds || !Array.isArray(tenderIds) || tenderIds.length === 0) {
|
|
|
- ctx.body = { err: 1, msg: '参数错误:请提供标段ID数组', data: null };
|
|
|
+ const { attentionIds } = ctx.request.body;
|
|
|
+ if (!attentionIds || !Array.isArray(attentionIds) || attentionIds.length === 0) {
|
|
|
+ ctx.body = { code: 0, msg: '参数错误:请提供关注ID', data: null };
|
|
|
return;
|
|
|
}
|
|
|
- const result = await ctx.service.weappAttention.unfollowSections(tenderIds, ctx.projectAccount.id);
|
|
|
+ const result = await ctx.service.weappAttention.unfollowSections(attentionIds, ctx.projectAccount.id);
|
|
|
if (result) {
|
|
|
- ctx.body = { err: 0, msg: '取消关注成功', data: null };
|
|
|
+ ctx.body = { code: 0, msg: '取消关注成功', data: null };
|
|
|
} else {
|
|
|
- ctx.body = { err: 1, msg: '取消关注失败', data: null };
|
|
|
+ ctx.body = { code: -1, msg: '取消关注失败', data: null };
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- ctx.body = this.ajaxErrorBody(error, '取消关注操作失败');
|
|
|
+ ctx.body = { code: -1, msg: error.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -47,9 +47,9 @@ module.exports = app => {
|
|
|
const { ctx } = this;
|
|
|
try {
|
|
|
const result = await ctx.service.weappAttention.getFollowedSections(ctx.projectAccount.id);
|
|
|
- ctx.body = { err: 0, msg: '', data: result };
|
|
|
+ ctx.body = { code: 0, msg: '', data: result };
|
|
|
} catch (error) {
|
|
|
- ctx.body = this.ajaxErrorBody(error, '获取关注列表失败');
|
|
|
+ ctx.body = { code: -1, msg: error.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -59,13 +59,13 @@ module.exports = app => {
|
|
|
try {
|
|
|
const { tenderId } = ctx.query;
|
|
|
if (!tenderId) {
|
|
|
- ctx.body = { err: 1, msg: '参数错误:请提供标段ID', data: null };
|
|
|
+ ctx.body = { code: 0, msg: '参数错误:请提供标段ID', data: null };
|
|
|
return;
|
|
|
}
|
|
|
const isFollowing = await ctx.service.weappAttention.isFollowingSection(ctx.projectAccount.id, tenderId);
|
|
|
- ctx.body = { err: 0, msg: '', data: { following: isFollowing } };
|
|
|
+ ctx.body = { code: 0, msg: '', data: { following: isFollowing } };
|
|
|
} catch (error) {
|
|
|
- ctx.body = this.ajaxErrorBody(error, '检查关注状态失败');
|
|
|
+ ctx.body = { code: -1, msg: error.toString(), data: null };
|
|
|
}
|
|
|
}
|
|
|
|