dl_mer_uniapp/libs/follow.js

72 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2025-03-04 16:03:38 +08:00
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
getMerCollectAddApi,
getMerCollectCancelApi
} from '@/api/merchant.js';
import {
followAuthorApi,
noteLikeApi
} from '@/api/discover.js';
import util from '@/utils/util'
/**
* 关注取消关注商户
*/
export function followMer(follow, id) {
return new Promise((resolve, reject) => {
if (follow) {
getMerCollectCancelApi(id).then(res => {
resolve(res);
}).catch(err => {
util.Tips({
title: err
});
});
} else {
getMerCollectAddApi(id).then(res => {
resolve(res);
}).catch(err => {
this.$util.Tips({
title: err
});
});
}
});
}
/**
* 逛逛内容点赞取消点赞
*/
export function discoverNoteLike(id) {
return new Promise((resolve, reject) => {
noteLikeApi(id).then(res => {
resolve(res);
}).catch(err => {
util.Tips({
title: err
});
});
});
}
/**
* 逛逛作者关注取消关注
*/
export function discoverFollowAuthor(id) {
return new Promise((resolve, reject) => {
followAuthorApi(id).then(res => {
resolve(res);
}).catch(err => {
util.Tips({
title: err
});
});
});
}