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
205fa107
Commit
205fa107
authored
Apr 09, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
ee751c1a
Pipeline
#5775
passed with stage
in 2 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
316 additions
and
0 deletions
+316
-0
collection.js
app/service/house_common/collection.js
+102
-0
order.js
app/service/house_common/order.js
+107
-0
search_history.js
app/service/house_common/search_history.js
+107
-0
No files found.
app/service/house_common/collection.js
0 → 100644
View file @
205fa107
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
class
CollectionService
extends
Service
{
async
one
(
id
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/collection/'
+
id
,
{},
{
method
:
'GET'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
async
edit
(
id
,
data
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/collection/'
+
id
,
data
,
{
method
:
'PUT'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
async
delete
(
id
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/collection/'
+
id
,
{},
{
method
:
'DELETE'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
async
all
(
data
)
{
const
{
ctx
}
=
this
;
const
queryConditions
=
data
.
queryConditions
;
const
sum
=
queryConditions
.
length
;
for
(
let
i
=
0
;
i
<
sum
;
i
++
)
{
if
(
queryConditions
[
i
].
key
===
'userId'
&&
queryConditions
[
i
].
value
.
length
===
0
)
{
queryConditions
[
i
].
value
=
true
;
queryConditions
[
i
].
operator
=
'isnull'
;
}
}
data
.
queryConditions
=
queryConditions
;
if
(
Object
.
keys
(
data
.
orderConditions
).
length
===
0
)
{
data
.
orderConditions
=
[{
key
:
'createdAt'
,
orderSequence
:
'desc'
,
}];
}
ctx
.
logger
.
info
(
'get_newHouse_filter: '
+
JSON
.
stringify
(
data
));
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/collection/list'
,
data
,
{
method
:
'POST'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
async
add
(
data
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/collection/'
,
data
,
{
method
:
'POST'
});
if
(
result
.
status
!==
201
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
}
module
.
exports
=
CollectionService
;
app/service/house_common/order.js
0 → 100644
View file @
205fa107
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
class
OrderService
extends
Service
{
//根据Id,获取新房信息表
async
one
(
id
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/order/'
+
id
,
{},
{
method
:
'GET'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
//修改新房信息表
async
edit
(
id
,
data
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/order/'
+
id
,
data
,
{
method
:
'PUT'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
//根据Id,删除新房信息表
async
delete
(
id
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/order/'
+
id
,
{},
{
method
:
'DELETE'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
//获取新房信息表信息(分页)
async
all
(
data
)
{
const
{
ctx
}
=
this
;
const
queryConditions
=
data
.
queryConditions
;
const
sum
=
queryConditions
.
length
;
for
(
let
i
=
0
;
i
<
sum
;
i
++
)
{
if
(
queryConditions
[
i
].
key
===
'userId'
&&
queryConditions
[
i
].
value
.
length
===
0
)
{
queryConditions
[
i
].
value
=
true
;
queryConditions
[
i
].
operator
=
'isnull'
;
}
}
data
.
queryConditions
=
queryConditions
;
if
(
Object
.
keys
(
data
.
orderConditions
).
length
===
0
)
{
data
.
orderConditions
=
[{
key
:
'createdAt'
,
orderSequence
:
'desc'
,
}];
}
ctx
.
logger
.
info
(
'get_newHouse_filter: '
+
JSON
.
stringify
(
data
));
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/order/list'
,
data
,
{
method
:
'POST'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
//新增新房信息表
async
add
(
data
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/order/'
,
data
,
{
method
:
'POST'
});
if
(
result
.
status
!==
201
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
}
module
.
exports
=
OrderService
;
app/service/house_common/search_history.js
0 → 100644
View file @
205fa107
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
class
OrderService
extends
Service
{
//根据Id,获取新房信息表
async
one
(
id
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/order/'
+
id
,
{},
{
method
:
'GET'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
//修改新房信息表
async
edit
(
id
,
data
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/order/'
+
id
,
data
,
{
method
:
'PUT'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
//根据Id,删除新房信息表
async
delete
(
id
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/order/'
+
id
,
{},
{
method
:
'DELETE'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
//获取新房信息表信息(分页)
async
all
(
data
)
{
const
{
ctx
}
=
this
;
const
queryConditions
=
data
.
queryConditions
;
const
sum
=
queryConditions
.
length
;
for
(
let
i
=
0
;
i
<
sum
;
i
++
)
{
if
(
queryConditions
[
i
].
key
===
'userId'
&&
queryConditions
[
i
].
value
.
length
===
0
)
{
queryConditions
[
i
].
value
=
true
;
queryConditions
[
i
].
operator
=
'isnull'
;
}
}
data
.
queryConditions
=
queryConditions
;
if
(
Object
.
keys
(
data
.
orderConditions
).
length
===
0
)
{
data
.
orderConditions
=
[{
key
:
'createdAt'
,
orderSequence
:
'desc'
,
}];
}
ctx
.
logger
.
info
(
'get_newHouse_filter: '
+
JSON
.
stringify
(
data
));
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/order/list'
,
data
,
{
method
:
'POST'
});
if
(
result
.
status
!==
200
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
//新增新房信息表
async
add
(
data
)
{
const
{
ctx
}
=
this
;
const
result
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
HOUSE_SERVICE_API
+
'/v1/order/'
,
data
,
{
method
:
'POST'
});
if
(
result
.
status
!==
201
)
{
let
err
=
''
;
if
(
typeof
(
result
.
data
)
!==
'string'
)
{
err
=
JSON
.
stringify
(
result
.
data
);
}
else
{
err
=
result
.
data
;
}
ctx
.
failed
(
err
);
}
return
result
.
data
;
}
}
module
.
exports
=
OrderService
;
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