123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- var constant = require('const.js');
- const HOST_PRODUCT = constant.productApi;
- const HOST_BASE = constant.baseApi;
- let request = require('WXHttpRequest.js');
- const httputil = require('httpUtil.js');
- function getProductUrl(action) {
- return HOST_PRODUCT + action;
- }
- function getBaseUrl(action) {
- return HOST_BASE + action;
- }
- module.exports = {
- //获取推荐首页信息
- getIndex(uid) {
- let url = getProductUrl('wx/index');
- return request.getInstance().header({
- uid
- }).url(url).send();
- },
- // 获取首页人气推荐
- getHotRecommend(uid, pageNo, pageSize) {
- let url = getBaseUrl('wx/userRead/recommend');
- return request.getInstance().header({
- uid
- }).data({
- pageNo,
- pageSize,
- }).url(url).send();
- },
- // 获取用户朗读详细信息
- getWorksDetail(uid, readId) {
- let url = getBaseUrl(`wx/userRead/info/${readId}`);
- return request.getInstance().header({
- uid
- }).url(url).send();
- },
- // 获取全部课本
- getAllBooks(pageNo, pageSize) {
- let url = getProductUrl('wx/product');
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).data({
- pageNo,
- pageSize
- }).send();
- },
- // 获取课本详情
- getBookDetail(uid, id) {
- let url = getProductUrl(`wx/product/${id}`);
- return request.getInstance().header({
- uid
- }).url(url).send();
- },
- // 获取单课详情
- getClassDetail(uid, id) {
- let url = getProductUrl(`wx/lesson/${id}`);
- return request.getInstance().header({
- uid
- }).url(url).send();
- },
- // 检查是否收藏过课程
- classIsLike(uid, data) {
- let url = getProductUrl(`wx/favorites/isLike`);
- return request.getInstance().header({
- uid
- }).url(url).data(data).send();
- },
- getClassDetail(uid, id) {
- let url = getProductUrl(`wx/lesson/${id}`);
- return request.getInstance().header({
- uid
- }).url(url).send();
- },
- // 获取单课朗读信息
- getClassRead(uid, data) {
- let url = getBaseUrl(`wx/userRead`);
- return request.getInstance().header({
- uid
- }).data(data).url(url).send();
- },
- // 作品播放了+1
- playWorks(uid, readId) {
- let url = getBaseUrl(`wx/userRead/play/${readId}`);
- return request.getInstance().header({
- uid
- }).url(url).send();
- },
- // 发布作品
- postWork(uid, data) {
- console.log(data);
- let url = getBaseUrl(`wx/userRead`);
- return request.getInstance().header({
- uid
- }).url(url).data(data).method('POST').send();
- },
- // 点赞作品
- likeWorks(uid, readId) {
- let url = getBaseUrl(`wx/userRead/like/${readId}`);
- return request.getInstance().header({
- uid
- }).url(url).send();
- },
- // 关注用户
- followUser(uid, followUid) {
- let url = getBaseUrl(`wx/fans`);
- return request.getInstance().header({
- uid
- }).url(url).data({
- "uid": followUid
- }).method('POST').send();
- },
- //获取关注的用户列表
- getFollowUsers(uid, pageNo, pageSize) {
- let url = getBaseUrl(`wx/fans`);
- return request.getInstance().header({
- uid
- }).url(url).data({
- pageNo: pageNo,
- pageSize: pageSize
- }).send();
- },
- // 获取关注用户的作品列表
- getFollowWorks(uid, pageNo, pageSize) {
- let url = getBaseUrl(`wx/fans/interest`);
- return request.getInstance().header({
- uid
- }).url(url).data({
- pageNo: pageNo,
- pageSize: pageSize
- }).send();
- },
- // 搜索
- getSearchResult(uid, key, pageNo, pageSize) {
- let url = getProductUrl(`wx/lesson`);
- return request.getInstance().header({
- uid
- }).url(url).data({
- title: key,
- productId: '',
- pageNo: pageNo,
- pageSize: pageSize
- }).send();
- },
- // 获取回复信息
- getReply(uid, columnId, pageNo, pageSize) {
- let url = getBaseUrl(`wx/posts/reply`);
- return request.getInstance().header({
- uid
- }).url(url).data({
- columnId: columnId,
- pageNo: pageNo,
- pageSize: pageSize
- }).send();
- },
- // 获取回复(楼中楼)
- getReplyComment(uid, postId) {
- let url = getBaseUrl(`wx/posts/one/${postId}`);
- return request.getInstance().header({
- uid
- }).url(url).send();
- },
- // 发布回复(楼中楼)
- postReplyComment(uid, data) {
- let url = getBaseUrl(`wx/reply`);
- return request.getInstance().header({
- uid
- }).url(url).data(data).method('POST').send();
- },
- // 点赞评论
- likeCommend(uid, likeUid) {
- let url = getBaseUrl(`wx/posts/attribute/${likeUid}`);
- return request.getInstance().header({
- uid
- }).url(url).method('GET').send();
- },
- // 发布讨论
- postReply(uid, data) {
- let url = getBaseUrl(`wx/posts`);
- return request.getInstance().header({
- uid
- }).url(url).data(data).method('POST').send();
- },
- // 获取推荐团购信息
- getGroupList() {
- let url = getBaseUrl(`wx/groupPurchaseInfo/recommend`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- // 获取课程团购信息
- getGroupPurchaseInfo(productId) {
- let url = getBaseUrl(`wx/groupPurchaseInfo/info/${productId}`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- // 发起团购
- SendGroupPurchas(data) {
- let url = getBaseUrl(`wx/groupPurchase/create`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).data(data).method('POST').send();
- },
- // 参加团购
- JoinGroupPurchas(orderId) {
- let url = getBaseUrl(`wx/groupPurchase/join`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).data({
- orderId
- }).method('POST').send();
- },
- // 收藏课程
- collectClass(uid, data) {
- let url = getProductUrl(`wx/favorites`);
- return request.getInstance().header({
- uid
- }).url(url).data(data).method('POST').send();
- },
- //我的团
- getMygroup() {
- let url = getBaseUrl(`wx/groupPurchase/my`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).data({
- pageNo: 1,
- pageSize: 100
- }).send();
- },
- //获取团购详情
- getMygroupInfo(orderId) {
- let url = getBaseUrl(`wx/groupPurchase/info/${orderId}`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- //团购是否成功
- groupSuccess(orderId) {
- let url = getBaseUrl(`wx/groupPurchase/joinStatus`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).data({
- orderId
- }).send();
- },
- // 发起奖励
- rewardMoney(uid, data) {
- let url = getBaseUrl(`wx/wallet/award`);
- return request.getInstance().header({
- uid
- }).url(url).data(data).method('POST').send();
- },
- // 修改资料
- settingUserInfo(data) {
- let url = getBaseUrl(`wx/user`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).data(data).url(url).method('PUT').send();
- },
- //获取个人信息
- getUserInfo() {
- let url = getBaseUrl(`wx/user`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- // 获取播放量等数据
- getUserWorksInfo() {
- let url = getBaseUrl(`wx/user/my`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- // 生成二维码
- createQRCode(data) {
- let url = getBaseUrl(`wx/qrCode`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).data(data).url(url).send();
- },
- // 我的奖金
- myWallet() {
- let url = getBaseUrl('wx/wallet/bonus');
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- // 資金明細
- myWalletDetails() {
- let url = getBaseUrl('wx/wallet/record');
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- // 我的課程
- myCourse() {
- let url = getBaseUrl('wx/groupPurchase/myCourse');
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- // 我的朗读
- myRead() {
- let url = getBaseUrl('wx/userRead/my');
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- // 我的收藏
- myFavorites() {
- let url = getProductUrl(`wx/favorites`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- // 我的关注
- myFans() {
- let url = getBaseUrl(`wx/fans`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- },
- // 产品鉴权
- areYouSuper(productArr){
- let url = getBaseUrl(`wx/groupPurchase/auth`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).data(productArr).method('POST').send();
- },
- // 找到课程对应的课本
- checkLesson(lessonId){
- let url = getProductUrl(`wx/lesson/product/${lessonId}`);
- return request.getInstance().header({
- uid: wx.getStorageSync('uid')
- }).url(url).send();
- }
- }
|