Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
hujun
tl_estate
Commits
32226a42
Commit
32226a42
authored
Apr 03, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
41a19163
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
115 additions
and
38 deletions
+115
-38
Square.php
application/api_broker/controller/Square.php
+10
-4
SquareService.php
application/api_broker/service/SquareService.php
+63
-16
Square.php
application/index/controller/Square.php
+8
-2
BComment.php
application/model/BComment.php
+16
-0
BCommentExt.php
application/model/BCommentExt.php
+3
-2
BSquare.php
application/model/BSquare.php
+9
-9
route.php
application/route.php
+6
-5
No files found.
application/api_broker/controller/Square.php
View file @
32226a42
...
@@ -17,14 +17,20 @@ class Square extends Basic
...
@@ -17,14 +17,20 @@ class Square extends Basic
}
}
public
function
getDistrictLable
()
{
$res
=
$this
->
s_square
->
getDistrictLable
();
return
$this
->
response
(
"200"
,
"成功"
,
$res
);
}
public
function
addSquare
()
{
public
function
addSquare
()
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
if
(
!
isset
(
$params
[
'title'
])
or
!
isset
(
$params
[
'content'
])
or
!
isset
(
$params
[
'site_id'
])
or
!
isset
(
$params
[
'cover_img'
])
or
!
isset
(
$params
[
'district_id'
]))
{
if
(
!
isset
(
$params
[
'title'
])
or
!
isset
(
$params
[
'content'
])
or
!
isset
(
$params
[
'site_id'
])
or
!
isset
(
$params
[
'cover_img'
])
or
!
isset
(
$params
[
'district_
lable_
id'
]))
{
return
$this
->
response
(
"101"
,
"参数不全"
);
return
$this
->
response
(
"101"
,
"参数不全"
);
}
}
$result
=
$this
->
s_square
->
saveSquare
(
$this
->
agentId
,
$params
[
'title'
],
$params
[
'content'
],
$params
[
'cover_img'
],
$params
[
'site_id'
],
$params
[
'district_id'
]);
$result
=
$this
->
s_square
->
saveSquare
(
$this
->
agentId
,
$params
[
'title'
],
$params
[
'content'
],
$params
[
'cover_img'
],
$params
[
'site_id'
],
$params
[
'district_
lable_
id'
]);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
}
...
@@ -83,10 +89,10 @@ class Square extends Basic
...
@@ -83,10 +89,10 @@ class Square extends Basic
}
}
if
(
isset
(
$params
[
'level'
]))
{
if
(
isset
(
$params
[
'level'
]))
{
if
(
!
isset
(
$params
[
'comment_id'
])
or
!
isset
(
$params
[
'agent_id_a'
])
or
!
isset
(
$params
[
'agent_id_b'
])
or
!
isset
(
$params
[
'comment'
]))
{
if
(
!
isset
(
$params
[
'comment_id'
])
or
!
isset
(
$params
[
'agent_id_b'
])
or
!
isset
(
$params
[
'comment'
]))
{
return
$this
->
response
(
"101"
,
"参数不全"
);
return
$this
->
response
(
"101"
,
"参数不全"
);
}
}
$result
=
$this
->
s_square
->
addBCommentExt
(
$params
[
'comment_id'
],
$
params
[
'agent_id_a'
]
,
$params
[
'agent_id_b'
],
$params
[
'comment'
],
$params
[
'level'
]);
$result
=
$this
->
s_square
->
addBCommentExt
(
$params
[
'comment_id'
],
$
this
->
agentId
,
$params
[
'agent_id_b'
],
$params
[
'comment'
],
$params
[
'level'
]);
}
else
{
}
else
{
if
(
!
isset
(
$params
[
'square_id'
])
or
!
isset
(
$params
[
'square_id'
])
or
!
isset
(
$params
[
'comment'
]))
{
if
(
!
isset
(
$params
[
'square_id'
])
or
!
isset
(
$params
[
'square_id'
])
or
!
isset
(
$params
[
'comment'
]))
{
return
$this
->
response
(
"101"
,
"参数不全"
);
return
$this
->
response
(
"101"
,
"参数不全"
);
...
...
application/api_broker/service/SquareService.php
View file @
32226a42
...
@@ -19,6 +19,22 @@ class SquareService
...
@@ -19,6 +19,22 @@ class SquareService
$this
->
m_coment_ext
=
new
BCommentExt
();
$this
->
m_coment_ext
=
new
BCommentExt
();
}
}
public
function
getDistrictLable
(){
$res
[]
=
[
'id'
=>
1
,
'name'
=>
'一部'
];
$res
[]
=
[
'id'
=>
2
,
'name'
=>
'二部'
];
$res
[]
=
[
'id'
=>
3
,
'name'
=>
'三部'
];
$res
[]
=
[
'id'
=>
4
,
'name'
=>
'四部'
];
$res
[]
=
[
'id'
=>
5
,
'name'
=>
'五部'
];
$res
[]
=
[
'id'
=>
6
,
'name'
=>
'六部'
];
$res
[]
=
[
'id'
=>
7
,
'name'
=>
'七部'
];
$res
[]
=
[
'id'
=>
8
,
'name'
=>
'八部'
];
$res
[]
=
[
'id'
=>
9
,
'name'
=>
'九部'
];
$res
[]
=
[
'id'
=>
10
,
'name'
=>
'十部'
];
return
$res
;
}
public
function
saveSquare
(
$agent_id
,
$title
,
$content
,
$cover_img
,
$site_id
,
$district_id
)
public
function
saveSquare
(
$agent_id
,
$title
,
$content
,
$cover_img
,
$site_id
,
$district_id
)
{
{
$insert
[
"agent_id"
]
=
$agent_id
;
//经纪人id
$insert
[
"agent_id"
]
=
$agent_id
;
//经纪人id
...
@@ -26,7 +42,7 @@ class SquareService
...
@@ -26,7 +42,7 @@ class SquareService
$insert
[
"content"
]
=
$content
;
//text
$insert
[
"content"
]
=
$content
;
//text
$insert
[
"cover_img"
]
=
$cover_img
;
//封面图
$insert
[
"cover_img"
]
=
$cover_img
;
//封面图
$insert
[
"site_id"
]
=
$site_id
;
//站点id
$insert
[
"site_id"
]
=
$site_id
;
//站点id
$insert
[
"district_id"
]
=
$district_id
;
//部门id
$insert
[
"district_
lable_
id"
]
=
$district_id
;
//部门id
$insert
[
"status"
]
=
0
;
//状态: 0正常 1删除
$insert
[
"status"
]
=
0
;
//状态: 0正常 1删除
$res
=
$this
->
m_square
->
saveSquare
(
$insert
);
//int(1)
$res
=
$this
->
m_square
->
saveSquare
(
$insert
);
//int(1)
...
@@ -51,8 +67,8 @@ class SquareService
...
@@ -51,8 +67,8 @@ class SquareService
$get_params
[
'Square.site_id'
]
=
$params
[
'site_id'
];
$get_params
[
'Square.site_id'
]
=
$params
[
'site_id'
];
}
}
//部门
//部门
if
(
!
empty
(
$params
[
'district_id'
]))
{
if
(
!
empty
(
$params
[
'district_
lable_
id'
]))
{
$get_params
[
'Square.district_
id'
]
=
$params
[
'district
_id'
];
$get_params
[
'Square.district_
lable_id'
]
=
$params
[
'district_lable
_id'
];
}
}
//文章标题
//文章标题
if
(
!
empty
(
$params
[
'title'
]))
{
if
(
!
empty
(
$params
[
'title'
]))
{
...
@@ -85,6 +101,7 @@ class SquareService
...
@@ -85,6 +101,7 @@ class SquareService
$field
=
'Comment.id,'
;
//
$field
=
'Comment.id,'
;
//
$field
.=
'Comment.comment,'
;
//
$field
.=
'Comment.comment,'
;
//
$field
.=
'Comment.agent_id,'
;
//
$field
.=
'Comment.sort,'
;
//
$field
.=
'Comment.sort,'
;
//
$field
.=
'Comment.create_time,'
;
//
$field
.=
'Comment.create_time,'
;
//
$field
.=
'Agent.name,'
;
//
$field
.=
'Agent.name,'
;
//
...
@@ -97,14 +114,15 @@ class SquareService
...
@@ -97,14 +114,15 @@ class SquareService
foreach
(
$res
as
$key
=>
$val
)
{
foreach
(
$res
as
$key
=>
$val
)
{
$res
[
$key
][
'img'
]
=
'http://n.sinaimg.cn/ent/transform/20170921/FVGl-fymesmp0851702.jpg'
;
$res
[
$key
][
'img'
]
=
'http://n.sinaimg.cn/ent/transform/20170921/FVGl-fymesmp0851702.jpg'
;
$field
=
'CommentExt.id,'
;
//
$get_params
=
[];
$field
.=
'CommentExt.comment,'
;
//
$field
.=
'Agent.name,'
;
//
$field
=
'CommentExt.id,CommentExt.comment,AgentA.name as agent_id_a,AgentB.name as agent_id_b'
;
//
$field
.=
'Agent.img'
;
//
$get_params
[
'CommentExt.comment_id'
]
=
$val
[
'id'
];
$get_params
[
'CommentExt.comment_id'
]
=
$val
[
'id'
];
$res
=
$this
->
m_coment_ext
->
getSquareCommentExtList
(
1
,
2
,
$field
,
$get_params
);
// dump($val);
$res
[
$key
][
'comment_ext'
]
=
'http://n.sinaimg.cn/ent/transform/20170921/FVGl-fymesmp0851702.jpg'
;
// dump($field);
// dump($get_params);
$res
[
$key
][
'comment_ext'
]
=
$this
->
m_coment_ext
->
getSquareCommentExtList
(
1
,
2
,
$field
,
$get_params
);
}
}
return
[
'data'
=>
$res
,
'total'
=>
$res_total
];
return
[
'data'
=>
$res
,
'total'
=>
$res_total
];
...
@@ -118,17 +136,22 @@ class SquareService
...
@@ -118,17 +136,22 @@ class SquareService
$field
.=
'Square.cover_img,'
;
//cover_img
$field
.=
'Square.cover_img,'
;
//cover_img
$field
.=
'Agent.name,'
;
//发布人
$field
.=
'Agent.name,'
;
//发布人
$field
.=
'Square.site_id,'
;
//城市
$field
.=
'Square.site_id,'
;
//城市
$field
.=
'Square.district_id,'
;
//部门
$field
.=
'Site.name as site_name,'
;
//城市
$field
.=
'Square.district_lable_id,'
;
//部门
$field
.=
'Square.create_time'
;
//发布时间
$field
.=
'Square.create_time'
;
//发布时间
$get_params
[
'Square.id'
]
=
$params
[
'id'
];
$get_params
[
'Square.id'
]
=
$params
[
'id'
];
// $get_params['Square.status'] = 0;
// $get_params['Square.status'] = 0;
$res
=
$this
->
m_square
->
getSquareInfo
(
$field
,
$get_params
);
$res
=
$this
->
m_square
->
getSquareInfo
(
$field
,
$get_params
);
$res
[
'district_lable_name'
]
=
'一部'
;
foreach
(
$this
->
getDistrictLable
()
as
$key
=>
$val
)
{
if
(
$res
[
'district_lable_id'
]
==
$val
[
'id'
]){
$res
[
'district_lable_name'
]
=
$val
[
'name'
];
continue
;
}
}
// foreach ($res as $key => $val) {
//
// }
return
[
'data'
=>
$res
];
return
[
'data'
=>
$res
];
}
}
...
@@ -149,8 +172,8 @@ class SquareService
...
@@ -149,8 +172,8 @@ class SquareService
$update_params
[
'site_id'
]
=
$params
[
'site_id'
];
$update_params
[
'site_id'
]
=
$params
[
'site_id'
];
}
}
//部门
//部门
if
(
!
empty
(
$params
[
'district_id'
]))
{
if
(
!
empty
(
$params
[
'district_
lable_
id'
]))
{
$update_params
[
'district_
id'
]
=
$params
[
'district
_id'
];
$update_params
[
'district_
lable_id'
]
=
$params
[
'district_lable
_id'
];
}
}
if
(
!
empty
(
$params
[
'title'
]))
{
if
(
!
empty
(
$params
[
'title'
]))
{
$update_params
[
'title'
]
=
$params
[
'title'
];
$update_params
[
'title'
]
=
$params
[
'title'
];
...
@@ -207,4 +230,27 @@ class SquareService
...
@@ -207,4 +230,27 @@ class SquareService
}
}
}
}
public
function
getCommenInfo
(
$params
){
$field
=
'Square.id,'
;
//
$field
.=
'Square.title,'
;
//标题
$field
.=
'Square.content,'
;
//标题
$field
.=
'Square.cover_img,'
;
//cover_img
$field
.=
'Agent.name,'
;
//发布人
$field
.=
'Square.site_id,'
;
//城市
$field
.=
'Square.district_lable_id,'
;
//部门
$field
.=
'Square.create_time'
;
//发布时间
$get_params
[
'Square.id'
]
=
$params
[
'id'
];
// $get_params['Square.status'] = 0;
$res
=
$this
->
m_square
->
getSquareInfo
(
$field
,
$get_params
);
// foreach ($res as $key => $val) {
//
// }
return
[
'data'
=>
$res
];
}
}
}
\ No newline at end of file
application/index/controller/Square.php
View file @
32226a42
...
@@ -19,16 +19,22 @@ class Square extends Basic
...
@@ -19,16 +19,22 @@ class Square extends Basic
$this
->
s_square
=
new
SquareService
();
$this
->
s_square
=
new
SquareService
();
}
}
public
function
getDistrictLable
()
{
$res
=
$this
->
s_square
->
getDistrictLable
();
return
$this
->
response
(
"200"
,
"成功"
,
$res
);
}
public
function
addSquare
()
{
public
function
addSquare
()
{
header
(
'Access-Control-Allow-Origin:*'
);
header
(
'Access-Control-Allow-Origin:*'
);
$params
=
$this
->
params
;
$params
=
$this
->
params
;
if
(
!
isset
(
$params
[
'title'
])
or
!
isset
(
$params
[
'content'
])
or
!
isset
(
$params
[
'site_id'
])
or
!
isset
(
$params
[
'cover_img'
])
or
!
isset
(
$params
[
'district_id'
]))
{
if
(
!
isset
(
$params
[
'title'
])
or
!
isset
(
$params
[
'content'
])
or
!
isset
(
$params
[
'site_id'
])
or
!
isset
(
$params
[
'cover_img'
])
or
!
isset
(
$params
[
'district_
lable_
id'
]))
{
return
$this
->
response
(
"101"
,
"参数不全"
);
return
$this
->
response
(
"101"
,
"参数不全"
);
}
}
$res
=
$this
->
s_square
->
saveSquare
(
$this
->
userId
,
$params
[
'title'
],
$params
[
'content'
],
$params
[
'cover_img'
],
$params
[
'site_id'
],
$params
[
'district_id'
]);
$res
=
$this
->
s_square
->
saveSquare
(
$this
->
userId
,
$params
[
'title'
],
$params
[
'content'
],
$params
[
'cover_img'
],
$params
[
'site_id'
],
$params
[
'district_
lable_
id'
]);
if
(
$res
)
{
if
(
$res
)
{
return
$this
->
response
(
"200"
,
"成功"
);
return
$this
->
response
(
"200"
,
"成功"
);
}
else
{
}
else
{
...
...
application/model/BComment.php
View file @
32226a42
...
@@ -49,4 +49,20 @@ class BComment extends Model
...
@@ -49,4 +49,20 @@ class BComment extends Model
}
}
public
function
getCommenInfo
(
$field
,
$params
)
{
$order
=
"Comment.create_time desc"
;
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
'Comment'
)
->
join
(
'a_agents Agent'
,
'Agent.id = Square.agent_id'
,
'left'
)
->
join
(
'a_site Site'
,
'Site.id = Square.site_id'
,
'left'
)
->
join
(
'a_district District'
,
'District.id = Square.district_id'
,
'left'
)
->
where
(
$params
)
->
order
(
$order
)
->
find
();
// dump($this->getLastSql());
return
$result
;
}
}
}
application/model/BCommentExt.php
View file @
32226a42
...
@@ -25,7 +25,8 @@ class BCommentExt extends Model
...
@@ -25,7 +25,8 @@ class BCommentExt extends Model
$result
=
Db
::
table
(
$this
->
table
)
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
'CommentExt'
)
->
alias
(
'CommentExt'
)
->
join
(
'a_agents Agent'
,
'Agent.id = Comment.agent_id'
,
'right'
)
->
join
(
'a_agents AgentA'
,
'AgentA.id = CommentExt.agent_id_a'
,
'left'
)
->
join
(
'a_agents AgentB'
,
'AgentB.id = CommentExt.agent_id_b'
,
'left'
)
->
where
(
$params
)
->
where
(
$params
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
page
(
$pageNo
)
...
@@ -41,7 +42,7 @@ class BCommentExt extends Model
...
@@ -41,7 +42,7 @@ class BCommentExt extends Model
$result
=
Db
::
table
(
$this
->
table
)
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
'CommentExt'
)
->
alias
(
'CommentExt'
)
->
join
(
'a_agents Agent'
,
'Agent.id = Comment.agent_id'
,
'
righ
t'
)
->
join
(
'a_agents Agent'
,
'Agent.id = Comment.agent_id'
,
'
lef
t'
)
->
where
(
$params
)
->
where
(
$params
)
->
count
();
->
count
();
//dump($this->getLastSql());
//dump($this->getLastSql());
...
...
application/model/BSquare.php
View file @
32226a42
...
@@ -50,9 +50,9 @@ class BSquare extends Model
...
@@ -50,9 +50,9 @@ class BSquare extends Model
$result
=
Db
::
table
(
$this
->
table
)
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
'Square'
)
->
alias
(
'Square'
)
->
join
(
'a_agents Agent'
,
'Agent.id = Square.agent_id'
,
'
righ
t'
)
->
join
(
'a_agents Agent'
,
'Agent.id = Square.agent_id'
,
'
lef
t'
)
->
join
(
'a_site Site'
,
'Site.id = Square.site_id'
,
'
righ
t'
)
->
join
(
'a_site Site'
,
'Site.id = Square.site_id'
,
'
lef
t'
)
->
join
(
'a_district District'
,
'District.id = Square.district_id'
,
'
righ
t'
)
->
join
(
'a_district District'
,
'District.id = Square.district_id'
,
'
lef
t'
)
// ->join('b_comment Comment', 'Square.id = Comment.square_id', 'right')
// ->join('b_comment Comment', 'Square.id = Comment.square_id', 'right')
->
where
(
$params
)
->
where
(
$params
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
...
@@ -69,9 +69,9 @@ class BSquare extends Model
...
@@ -69,9 +69,9 @@ class BSquare extends Model
$result
=
Db
::
table
(
$this
->
table
)
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
'Square'
)
->
alias
(
'Square'
)
->
join
(
'a_agents Agent'
,
'Agent.id = Square.agent_id'
,
'
righ
t'
)
->
join
(
'a_agents Agent'
,
'Agent.id = Square.agent_id'
,
'
lef
t'
)
->
join
(
'a_site Site'
,
'Site.id = Square.site_id'
,
'
righ
t'
)
->
join
(
'a_site Site'
,
'Site.id = Square.site_id'
,
'
lef
t'
)
->
join
(
'a_district District'
,
'District.id = Square.district_id'
,
'
righ
t'
)
->
join
(
'a_district District'
,
'District.id = Square.district_id'
,
'
lef
t'
)
// ->join('b_comment Comment', 'Square.id = Comment.square_id', 'right')
// ->join('b_comment Comment', 'Square.id = Comment.square_id', 'right')
->
where
(
$params
)
->
where
(
$params
)
->
count
();
->
count
();
...
@@ -85,9 +85,9 @@ class BSquare extends Model
...
@@ -85,9 +85,9 @@ class BSquare extends Model
$result
=
Db
::
table
(
$this
->
table
)
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
'Square'
)
->
alias
(
'Square'
)
->
join
(
'a_agents Agent'
,
'Agent.id = Square.agent_id'
,
'
righ
t'
)
->
join
(
'a_agents Agent'
,
'Agent.id = Square.agent_id'
,
'
lef
t'
)
->
join
(
'a_site Site'
,
'Site.id = Square.site_id'
,
'
righ
t'
)
->
join
(
'a_site Site'
,
'Site.id = Square.site_id'
,
'
lef
t'
)
->
join
(
'a_district District'
,
'District.id = Square.district_id'
,
'righ
t'
)
// ->join('a_district District', 'District.id = Square.district_id', 'lef
t')
->
where
(
$params
)
->
where
(
$params
)
->
order
(
$order
)
->
order
(
$order
)
->
find
();
->
find
();
...
...
application/route.php
View file @
32226a42
...
@@ -442,11 +442,12 @@ Route::group('index', [
...
@@ -442,11 +442,12 @@ Route::group('index', [
'videoCheckList'
=>
[
'index/VideoCheck/videoCheckList'
,
[
'method'
=>
'get|post'
]],
'videoCheckList'
=>
[
'index/VideoCheck/videoCheckList'
,
[
'method'
=>
'get|post'
]],
//开盘广场
//开盘广场
'addSquare'
=>
[
'index/Square/addSquare'
,
[
'method'
=>
'GET|POST'
]],
'getDistrictLable'
=>
[
'index/Square/getDistrictLable'
,
[
'method'
=>
'GET|POST'
]
],
'getSquareList'
=>
[
'index/Square/getSquareList'
,
[
'method'
=>
'GET|POST'
]],
'addSquare'
=>
[
'index/Square/addSquare'
,
[
'method'
=>
'GET|POST'
]
],
'getSquareInfo'
=>
[
'index/Square/getSquareInfo'
,
[
'method'
=>
'GET|POST'
]],
'getSquareList'
=>
[
'index/Square/getSquareList'
,
[
'method'
=>
'GET|POST'
]
],
'delSquare'
=>
[
'index/Square/delSquare'
,
[
'method'
=>
'GET|POST'
]],
'getSquareInfo'
=>
[
'index/Square/getSquareInfo'
,
[
'method'
=>
'GET|POST'
]
],
'editSquare'
=>
[
'index/Square/editSquare'
,
[
'method'
=>
'GET|POST'
]],
'delSquare'
=>
[
'index/Square/delSquare'
,
[
'method'
=>
'GET|POST'
]
],
'editSquare'
=>
[
'index/Square/editSquare'
,
[
'method'
=>
'GET|POST'
]
],
]);
]);
...
...
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