Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mp_estate_server
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
mp_estate_backstage
mp_estate_server
Commits
2141724c
Commit
2141724c
authored
Sep 07, 2020
by
成旭东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
房产项目标签新建关联表
parent
843f086d
Pipeline
#27990
passed with stage
in 5 minutes 1 second
Changes
6
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
109 additions
and
5 deletions
+109
-5
list.ts
app/controller/mpEstate/list.ts
+24
-0
wafangProject.js
app/model/wafang/wafangProject.js
+1
-5
wafangProjectTag.js
app/model/wafang/wafangProjectTag.js
+49
-0
router.ts
app/router.ts
+3
-0
list.ts
app/service/mpEstate/list.ts
+30
-0
index.d.ts
typings/app/model/index.d.ts
+2
-0
No files found.
app/controller/mpEstate/list.ts
View file @
2141724c
...
@@ -6,6 +6,7 @@ export default class EstateListController extends Controller {
...
@@ -6,6 +6,7 @@ export default class EstateListController extends Controller {
serviceName
:
string
;
serviceName
:
string
;
listRule
:
any
;
listRule
:
any
;
updateRule
:
any
;
updateRule
:
any
;
projectTagUpdateRule
:
any
;
officeOpenInfoUpdateRule
:
any
;
officeOpenInfoUpdateRule
:
any
;
businessOpenInfoUpdateRule
:
any
;
businessOpenInfoUpdateRule
:
any
;
houseOpenInfoUpdateRule
:
any
;
houseOpenInfoUpdateRule
:
any
;
...
@@ -38,6 +39,12 @@ export default class EstateListController extends Controller {
...
@@ -38,6 +39,12 @@ export default class EstateListController extends Controller {
is_hot
:
{
type
:
'number'
,
required
:
false
},
is_hot
:
{
type
:
'number'
,
required
:
false
},
show_trade
:
{
type
:
'number'
,
required
:
false
},
show_trade
:
{
type
:
'number'
,
required
:
false
},
tags
:
{
type
:
'string'
,
required
:
false
},
tags
:
{
type
:
'string'
,
required
:
false
},
status
:
{
type
:
'string'
,
required
:
false
},
};
this
.
projectTagUpdateRule
=
{
project_id
:
{
type
:
'number'
,
required
:
false
},
tag_id
:
{
type
:
'number'
,
required
:
false
},
};
};
this
.
officeOpenInfoUpdateRule
=
{
this
.
officeOpenInfoUpdateRule
=
{
...
@@ -257,6 +264,23 @@ export default class EstateListController extends Controller {
...
@@ -257,6 +264,23 @@ export default class EstateListController extends Controller {
ctx
.
success
();
ctx
.
success
();
}
}
async
projectTagUpdate
()
{
const
{
ctx
,
service
,
serviceGroupName
,
serviceName
}
=
this
;
const
paramsData
=
ctx
.
request
.
body
||
[];
for
(
let
i
=
0
;
i
<
paramsData
.
length
;
i
++
)
{
const
item
=
paramsData
[
i
];
if
(
item
.
id
)
{
await
service
[
serviceGroupName
][
serviceName
].
projectTagDelete
(
item
.
id
);
}
else
{
await
service
[
serviceGroupName
][
serviceName
].
projectTagCreated
(
item
);
}
}
ctx
.
success
();
}
async
officeOpenInfoUpdate
()
{
async
officeOpenInfoUpdate
()
{
const
{
ctx
,
service
,
officeOpenInfoUpdateRule
,
serviceGroupName
,
serviceName
}
=
this
;
const
{
ctx
,
service
,
officeOpenInfoUpdateRule
,
serviceGroupName
,
serviceName
}
=
this
;
const
{
id
}
=
ctx
.
params
;
const
{
id
}
=
ctx
.
params
;
...
...
app/model/wafang/wafangProject.js
View file @
2141724c
...
@@ -294,11 +294,6 @@ module.exports = app => {
...
@@ -294,11 +294,6 @@ module.exports = app => {
defaultValue
:
0
,
defaultValue
:
0
,
comment
:
'业态下推荐排序顺序默认0,第1-3位'
,
comment
:
'业态下推荐排序顺序默认0,第1-3位'
,
},
},
tags
:
{
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
true
,
comment
:
'标签数组json:["便宜","南北通透","有趣","后花园"]'
,
},
preview_image
:
{
preview_image
:
{
type
:
DataTypes
.
STRING
(
255
),
type
:
DataTypes
.
STRING
(
255
),
allowNull
:
true
,
allowNull
:
true
,
...
@@ -356,6 +351,7 @@ module.exports = app => {
...
@@ -356,6 +351,7 @@ module.exports = app => {
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangOpeningHouse
,
{
as
:
'houseInfo'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangOpeningHouse
,
{
as
:
'houseInfo'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangOpeningBusiness
,
{
as
:
'businessInfo'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangOpeningBusiness
,
{
as
:
'businessInfo'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangOpeningOffice
,
{
as
:
'officeInfo'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangOpeningOffice
,
{
as
:
'officeInfo'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangProjectTag
,
{
as
:
'projectTag'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangProjectTrends
,
{
as
:
'projectTrends'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangProjectTrends
,
{
as
:
'projectTrends'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangLayout
,
{
as
:
'houseLayout'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangLayout
,
{
as
:
'houseLayout'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangImage
,
{
as
:
'houseImage'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
app
.
wafangModel
.
WafangProject
.
hasMany
(
app
.
wafangModel
.
WafangImage
,
{
as
:
'houseImage'
,
sourceKey
:
'id'
,
foreignKey
:
'project_id'
});
...
...
app/model/wafang/wafangProjectTag.js
0 → 100644
View file @
2141724c
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
const
{
DataTypes
}
=
app
.
Sequelize
;
return
app
.
wafangModel
.
define
(
'model'
,
{
id
:
{
autoIncrement
:
true
,
type
:
DataTypes
.
INTEGER
(
11
),
allowNull
:
false
,
primaryKey
:
true
,
},
project_id
:
{
type
:
DataTypes
.
INTEGER
(
11
),
allowNull
:
false
,
comment
:
'对应楼盘项目id'
,
},
tag_id
:
{
type
:
DataTypes
.
INTEGER
(
11
),
allowNull
:
false
,
comment
:
'标签id'
,
},
valid
:
{
type
:
DataTypes
.
INTEGER
(
1
),
allowNull
:
false
,
defaultValue
:
1
,
},
created_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
,
field
:
'created_at'
,
get
()
{
const
date
=
this
.
getDataValue
(
'created_at'
);
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
},
},
updated_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
,
field
:
'updated_at'
,
get
()
{
const
date
=
this
.
getDataValue
(
'updated_at'
);
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
},
},
},
{
tableName
:
'wafang_project_tag'
,
});
};
app/router.ts
View file @
2141724c
...
@@ -16,6 +16,9 @@ export default (app: Application) => {
...
@@ -16,6 +16,9 @@ export default (app: Application) => {
router
.
get
(
'/api/estate/list/export'
,
controller
.
mpEstate
.
list
.
export
);
// 房源数据导出
router
.
get
(
'/api/estate/list/export'
,
controller
.
mpEstate
.
list
.
export
);
// 房源数据导出
// 房源项目标签更新
router
.
post
(
'/api/estate/list/projectTag'
,
controller
.
mpEstate
.
list
.
projectTagUpdate
);
// 住宅开盘信息更新
// 住宅开盘信息更新
router
.
put
(
'/api/estate/houseOpenInfo/update/:id'
,
controller
.
mpEstate
.
list
.
houseOpenInfoUpdate
);
router
.
put
(
'/api/estate/houseOpenInfo/update/:id'
,
controller
.
mpEstate
.
list
.
houseOpenInfoUpdate
);
...
...
app/service/mpEstate/list.ts
View file @
2141724c
...
@@ -140,6 +140,7 @@ export default class EstateListService extends Service {
...
@@ -140,6 +140,7 @@ export default class EstateListService extends Service {
{
from
:
'houseInfo'
,
to
:
'houseInfo'
},
{
from
:
'houseInfo'
,
to
:
'houseInfo'
},
{
from
:
'businessInfo'
,
to
:
'businessInfo'
},
{
from
:
'businessInfo'
,
to
:
'businessInfo'
},
{
from
:
'officeInfo'
,
to
:
'officeInfo'
},
{
from
:
'officeInfo'
,
to
:
'officeInfo'
},
{
from
:
'projectTag'
,
to
:
'projectTag'
},
{
from
:
'projectTrends'
,
to
:
'projectTrends'
},
{
from
:
'projectTrends'
,
to
:
'projectTrends'
},
{
from
:
'houseLayout'
,
to
:
'houseLayout'
},
{
from
:
'houseLayout'
,
to
:
'houseLayout'
},
{
from
:
'houseImage'
,
to
:
'houseImage'
},
{
from
:
'houseImage'
,
to
:
'houseImage'
},
...
@@ -182,6 +183,11 @@ export default class EstateListService extends Service {
...
@@ -182,6 +183,11 @@ export default class EstateListService extends Service {
required
:
false
,
required
:
false
,
where
:
{
valid
:
1
},
where
:
{
valid
:
1
},
},
{
},
{
model
:
ctx
.
wafangModel
.
WafangProjectTag
,
as
:
'projectTag'
,
required
:
false
,
where
:
{
valid
:
1
},
},
{
model
:
ctx
.
wafangModel
.
WafangProjectTrends
,
model
:
ctx
.
wafangModel
.
WafangProjectTrends
,
as
:
'projectTrends'
,
as
:
'projectTrends'
,
required
:
false
,
required
:
false
,
...
@@ -251,6 +257,30 @@ export default class EstateListService extends Service {
...
@@ -251,6 +257,30 @@ export default class EstateListService extends Service {
return
record
;
return
record
;
}
}
async
projectTagCreated
(
params
:
any
)
{
const
{
ctx
,
modelGroupName
}
=
this
;
const
record
=
await
ctx
[
modelGroupName
].
WafangProjectTag
.
create
({
...
params
,
created_at
:
new
Date
(),
updated_at
:
new
Date
(),
});
return
record
;
}
async
projectTagDelete
(
id
:
number
)
{
const
{
ctx
,
modelGroupName
}
=
this
;
const
record
=
await
ctx
[
modelGroupName
].
WafangProjectTag
.
findOne
({
where
:
{
id
,
},
});
if
(
!
record
)
{
this
.
ctx
.
throw
(
400
,
'记录不存在'
);
}
await
record
.
update
({
valid
:
0
});
return
record
;
}
async
officeOpenInfoUpdate
(
id
:
number
,
params
:
any
)
{
async
officeOpenInfoUpdate
(
id
:
number
,
params
:
any
)
{
const
{
ctx
,
modelGroupName
}
=
this
;
const
{
ctx
,
modelGroupName
}
=
this
;
const
record
=
await
ctx
[
modelGroupName
].
WafangOpeningOffice
.
findOne
({
const
record
=
await
ctx
[
modelGroupName
].
WafangOpeningOffice
.
findOne
({
...
...
typings/app/model/index.d.ts
View file @
2141724c
...
@@ -15,6 +15,7 @@ import ExportWafangWafangOpeningHouse = require('../../../app/model/wafang/wafan
...
@@ -15,6 +15,7 @@ import ExportWafangWafangOpeningHouse = require('../../../app/model/wafang/wafan
import
ExportWafangWafangOpeningHouseStatus
=
require
(
'../../../app/model/wafang/wafangOpeningHouseStatus'
);
import
ExportWafangWafangOpeningHouseStatus
=
require
(
'../../../app/model/wafang/wafangOpeningHouseStatus'
);
import
ExportWafangWafangOpeningOffice
=
require
(
'../../../app/model/wafang/wafangOpeningOffice'
);
import
ExportWafangWafangOpeningOffice
=
require
(
'../../../app/model/wafang/wafangOpeningOffice'
);
import
ExportWafangWafangProject
=
require
(
'../../../app/model/wafang/wafangProject'
);
import
ExportWafangWafangProject
=
require
(
'../../../app/model/wafang/wafangProject'
);
import
ExportWafangWafangProjectTag
=
require
(
'../../../app/model/wafang/wafangProjectTag'
);
import
ExportWafangWafangProjectTrends
=
require
(
'../../../app/model/wafang/wafangProjectTrends'
);
import
ExportWafangWafangProjectTrends
=
require
(
'../../../app/model/wafang/wafangProjectTrends'
);
import
ExportWafangWafangTag
=
require
(
'../../../app/model/wafang/wafangTag'
);
import
ExportWafangWafangTag
=
require
(
'../../../app/model/wafang/wafangTag'
);
import
ExportWafangWafangUser
=
require
(
'../../../app/model/wafang/wafangUser'
);
import
ExportWafangWafangUser
=
require
(
'../../../app/model/wafang/wafangUser'
);
...
@@ -38,6 +39,7 @@ declare module 'egg' {
...
@@ -38,6 +39,7 @@ declare module 'egg' {
WafangOpeningHouseStatus
:
ReturnType
<
typeof
ExportWafangWafangOpeningHouseStatus
>
;
WafangOpeningHouseStatus
:
ReturnType
<
typeof
ExportWafangWafangOpeningHouseStatus
>
;
WafangOpeningOffice
:
ReturnType
<
typeof
ExportWafangWafangOpeningOffice
>
;
WafangOpeningOffice
:
ReturnType
<
typeof
ExportWafangWafangOpeningOffice
>
;
WafangProject
:
ReturnType
<
typeof
ExportWafangWafangProject
>
;
WafangProject
:
ReturnType
<
typeof
ExportWafangWafangProject
>
;
WafangProjectTag
:
ReturnType
<
typeof
ExportWafangWafangProjectTag
>
;
WafangProjectTrends
:
ReturnType
<
typeof
ExportWafangWafangProjectTrends
>
;
WafangProjectTrends
:
ReturnType
<
typeof
ExportWafangWafangProjectTrends
>
;
WafangTag
:
ReturnType
<
typeof
ExportWafangWafangTag
>
;
WafangTag
:
ReturnType
<
typeof
ExportWafangWafangTag
>
;
WafangUser
:
ReturnType
<
typeof
ExportWafangWafangUser
>
;
WafangUser
:
ReturnType
<
typeof
ExportWafangWafangUser
>
;
...
...
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