Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
方斌
51business
Commits
4c11a9a4
Commit
4c11a9a4
authored
Apr 16, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
ae0458fd
Pipeline
#6047
passed with stage
in 7 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
6 deletions
+68
-6
collection.js
app/controller/house/collection.js
+19
-0
house.js
app/router/house.js
+5
-4
collection.js
app/service/house/collection.js
+44
-2
No files found.
app/controller/house/collection.js
View file @
4c11a9a4
...
@@ -33,6 +33,25 @@ class CollectionController extends Controller {
...
@@ -33,6 +33,25 @@ class CollectionController extends Controller {
ctx
.
success
(
ret
);
ctx
.
success
(
ret
);
}
}
async
unCollection
(){
const
{
ctx
}
=
this
;
let
inputParams
=
ctx
.
request
.
body
;
const
rule
=
{
id
:
{
type
:
'integer'
,
required
:
true
,
},
type
:
{
type
:
'integer'
,
required
:
true
,
}
};
ctx
.
validate
(
rule
,
inputParams
);
let
ret
=
await
ctx
.
service
.
house
.
collection
.
unCollection
(
inputParams
);
ctx
.
success
(
ret
);
}
}
}
module
.
exports
=
CollectionController
;
module
.
exports
=
CollectionController
;
app/router/house.js
View file @
4c11a9a4
...
@@ -28,12 +28,13 @@ module.exports = app => {
...
@@ -28,12 +28,13 @@ module.exports = app => {
router
.
post
(
'/order'
,
loginAuth
,
'house.order.addOrder'
);
//预约
router
.
post
(
'/order'
,
loginAuth
,
'house.order.addOrder'
);
//预约
router
.
get
(
'/order/list'
,
loginAuth
,
'house.order.getOrderList'
);
//预约列表
router
.
get
(
'/order/list'
,
loginAuth
,
'house.order.getOrderList'
);
//预约列表
//收藏
//关注
router
.
post
(
'/collection'
,
loginAuth
,
'house.collection.addCollection'
);
//收藏
router
.
post
(
'/collection'
,
loginAuth
,
'house.collection.addCollection'
);
//关注
router
.
get
(
'/collection/list'
,
loginAuth
,
'house.collection.getCollectionList'
);
//收藏列表
router
.
get
(
'/collection/list'
,
loginAuth
,
'house.collection.getCollectionList'
);
//关注列表
router
.
put
(
'/collection'
,
loginAuth
,
'house.collection.unCollection'
);
//取消关注
//搜索历史
//搜索历史
router
.
get
(
'/search_history'
,
'house.searchHistory.getsearchHistory'
);
//
收藏列表
router
.
get
(
'/search_history'
,
'house.searchHistory.getsearchHistory'
);
//
搜索历史
router
.
put
(
'/search_history/:type'
,
'house.searchHistory.cleanSearchHistory'
);
//用户点击清除搜索记录
router
.
put
(
'/search_history/:type'
,
'house.searchHistory.cleanSearchHistory'
);
//用户点击清除搜索记录
//足迹
//足迹
...
...
app/service/house/collection.js
View file @
4c11a9a4
...
@@ -7,7 +7,7 @@ const moment = require('moment');
...
@@ -7,7 +7,7 @@ const moment = require('moment');
class
CollectionService
extends
Service
{
class
CollectionService
extends
Service
{
/**
/**
* 添加
收藏
* 添加
关注
* @param {object} inputParams
* @param {object} inputParams
*/
*/
async
addCollection
(
inputParams
)
{
async
addCollection
(
inputParams
)
{
...
@@ -53,6 +53,48 @@ class CollectionService extends Service {
...
@@ -53,6 +53,48 @@ class CollectionService extends Service {
}
}
/**
/**
* 取消关注
* @param {object} inputParams
*/
async
unCollection
(
inputParams
)
{
const
{
ctx
,
service
}
=
this
;
let
ret
=
{
status
:
true
};
if
(
!
ctx
.
appUserId
||
!
ctx
.
deviceId
||
!
ctx
.
deviceLoginId
||
!
ctx
.
userId
)
{
//如果没有登录就不做处理
return
ret
;
}
let
filter
=
{
pageIndex
:
1
,
pageSize
:
999
,
queryConditions
:
[{
key
:
"state"
,
value
:
1
,
operator
:
"equal"
},
{
key
:
"userId"
,
value
:
ctx
.
userId
,
operator
:
"equal"
},
{
key
:
"connectId"
,
value
:
inputParams
.
id
,
operator
:
"equal"
},
{
key
:
"houseStyle"
,
value
:
inputParams
.
type
,
operator
:
"equal"
},
],
orderConditions
:
[],
}
let
collectionHistory
=
await
service
.
houseCommon
.
collection
.
all
(
filter
);
if
(
collectionHistory
.
rowCount
>
0
)
{
await
service
.
houseCommon
.
collection
.
delete
(
collectionHistory
.
results
[
0
].
id
);
}
return
ret
;
}
/**
* 获取用户关注信息
* 获取用户关注信息
* @param {object} inputParams
* @param {object} inputParams
*/
*/
...
@@ -99,7 +141,7 @@ class CollectionService extends Service {
...
@@ -99,7 +141,7 @@ class CollectionService extends Service {
/**
/**
* 获取
收藏
列表 保留最近6个月的记录,条数不超过50条
* 获取
关注
列表 保留最近6个月的记录,条数不超过50条
* @param {object} condition
* @param {object} condition
*/
*/
async
getCollectionList
()
{
async
getCollectionList
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment