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
9605ba5e
Commit
9605ba5e
authored
Jun 20, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
a61e611f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
13 deletions
+98
-13
collection.js
app/service/house/v2/collection.js
+4
-2
foot_print.js
app/service/house/v2/foot_print.js
+53
-5
order.js
app/service/house/v2/order.js
+41
-6
No files found.
app/service/house/v2/collection.js
View file @
9605ba5e
...
...
@@ -112,7 +112,7 @@ class CollectionService extends Service {
user_id
:
ctx
.
userId
,
created_at
:
{
$gt
:
endDate
},
},
order
:
[[
'
created_at
'
,
'desc'
]]
order
:
[[
'
id
'
,
'desc'
]]
}
let
list
=
[];
let
collectionList
=
await
ctx
.
realestateModel
.
Collection
.
all
(
filter
);
...
...
@@ -169,13 +169,15 @@ class CollectionService extends Service {
}
let
endDate
=
moment
().
subtract
(
6
,
'months'
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
let
filter
=
{
page
:
1
,
limit
:
50
,
attributes
:
[
'connect_id'
,
'house_style'
],
where
:
{
state
:
1
,
user_id
:
ctx
.
userId
,
created_at
:
{
$gt
:
endDate
},
},
order
:
[[
'
created_at
'
,
'desc'
]]
order
:
[[
'
id
'
,
'desc'
]]
}
let
list
=
await
ctx
.
realestateModel
.
Collection
.
all
(
filter
);
let
count
=
0
;
...
...
app/service/house/v2/foot_print.js
View file @
9605ba5e
...
...
@@ -51,8 +51,19 @@ class FootPrintService extends Service {
count
:
0
};
}
const
foot_prints_rows
=
await
ctx
.
realestateModel
.
FootPrint
.
list
({
page
:
1
,
limit
:
50
,
where
:
{
user_id
:
user_id
,
app_type_id
:
app_type_id
,
state
:
1
},
order
:
[[
'id'
,
'desc'
]]
});
let
endDate
=
moment
().
subtract
(
6
,
'months'
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
const
filter
=
{
page
:
1
,
limit
:
50
,
where
:
{
user_id
:
user_id
,
app_type_id
:
app_type_id
,
state
:
1
,
created_at
:
{
$gt
:
endDate
},
},
order
:
[[
'id'
,
'desc'
]]
};
const
foot_prints_rows
=
await
ctx
.
realestateModel
.
FootPrint
.
list
(
filter
);
const
foot_prints
=
foot_prints_rows
.
rows
;
const
p_houses
=
[];
for
(
let
i
in
foot_prints
)
{
...
...
@@ -109,19 +120,56 @@ class FootPrintService extends Service {
if
(
!
ctx
.
userId
)
{
return
{
count
:
0
};
}
let
endDate
=
moment
().
subtract
(
6
,
'months'
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
const
filter
=
{
page
:
1
,
limit
:
50
,
attributes
:
[
'connect_id'
,
'house_style'
],
where
:
{
state
:
1
,
user_id
:
ctx
.
userId
,
created_at
:
{
$gt
:
endDate
},
},
order
:
[[
'created_at'
,
'desc'
]]
}
const
footPrintsResults
=
await
ctx
.
realestateModel
.
FootPrint
.
all
(
filter
);
const
list
=
await
ctx
.
realestateModel
.
FootPrint
.
all
(
filter
);
let
count
=
0
;
if
(
list
.
length
>
0
)
{
let
newHouseId
=
[];
let
rentalHouseId
=
[];
for
(
let
i
in
list
)
{
if
(
Number
(
list
[
i
].
house_style
)
===
1
)
{
newHouseId
.
push
(
list
[
i
].
connect_id
);
}
if
(
Number
(
list
[
i
].
house_style
)
===
2
)
{
rentalHouseId
.
push
(
list
[
i
].
connect_id
);
}
}
let
newHousefilter
=
{
where
:
{
status
:
'online'
,
valid
:
1
,
id
:
{
$in
:
newHouseId
},
},
}
let
newHouseCountTask
=
ctx
.
realestateModel
.
NewHouse
.
count
(
newHousefilter
);
let
rentalHousefilter
=
{
where
:
{
status
:
'online'
,
valid
:
1
,
id
:
{
$in
:
rentalHouseId
},
},
}
let
rentalHouseCountTask
=
ctx
.
realestateModel
.
RentalHouse
.
count
(
rentalHousefilter
);
const
retList
=
await
Promise
.
all
([
newHouseCountTask
,
rentalHouseCountTask
]).
then
(
result
=>
{
return
result
;
}).
catch
(
error
=>
{
ctx
.
failed
(
error
);
});
count
=
Number
(
retList
[
0
])
+
Number
(
retList
[
1
]);
}
let
ret
=
{
count
:
footPrintsResults
.
length
count
:
count
};
return
ret
;
}
...
...
app/service/house/v2/order.js
View file @
9605ba5e
...
...
@@ -64,7 +64,7 @@ class OrderService extends Service {
user_id
:
ctx
.
userId
,
created_at
:
{
$gt
:
endDate
}
},
order
:
[[
'
created_at
'
,
'desc'
]]
order
:
[[
'
id
'
,
'desc'
]]
}
let
list
=
[];
let
orderList
=
await
ctx
.
realestateModel
.
Order
.
all
(
filter
);
...
...
@@ -123,17 +123,52 @@ class OrderService extends Service {
let
filter
=
{
page
:
1
,
limit
:
50
,
attributes
:
[
'connect_id'
,
'house_style'
],
where
:
{
state
:
1
,
user_id
:
ctx
.
userId
,
created_at
:
{
$gt
:
endDate
}
created_at
:
{
$gt
:
endDate
}
,
},
order
:
[[
'created_at'
,
'desc'
]]
order
:
[[
'id'
,
'desc'
]]
}
let
list
=
await
ctx
.
realestateModel
.
Order
.
all
(
filter
);
let
count
=
0
;
if
(
list
.
length
>
0
)
{
let
newHouseId
=
[];
let
rentalHouseId
=
[];
for
(
let
i
in
list
)
{
if
(
Number
(
list
[
i
].
house_style
)
===
1
)
{
newHouseId
.
push
(
list
[
i
].
connect_id
);
}
if
(
Number
(
list
[
i
].
house_style
)
===
2
)
{
rentalHouseId
.
push
(
list
[
i
].
connect_id
);
}
}
let
newHousefilter
=
{
where
:
{
status
:
'online'
,
valid
:
1
,
id
:
{
$in
:
newHouseId
},
},
}
let
newHouseCountTask
=
ctx
.
realestateModel
.
NewHouse
.
count
(
newHousefilter
);
let
rentalHousefilter
=
{
where
:
{
status
:
'online'
,
valid
:
1
,
id
:
{
$in
:
rentalHouseId
},
},
}
let
rentalHouseCountTask
=
ctx
.
realestateModel
.
RentalHouse
.
count
(
rentalHousefilter
);
const
retList
=
await
Promise
.
all
([
newHouseCountTask
,
rentalHouseCountTask
]).
then
(
result
=>
{
return
result
;
}).
catch
(
error
=>
{
ctx
.
failed
(
error
);
});
count
=
Number
(
retList
[
0
])
+
Number
(
retList
[
1
]);
}
let
orderList
=
await
ctx
.
realestateModel
.
Order
.
all
(
filter
);
let
ret
=
{
count
:
orderList
.
length
count
:
count
};
return
ret
;
}
...
...
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