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
b71636db
Commit
b71636db
authored
Apr 11, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 根据ID获取标签名
parent
9f602fae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
16 deletions
+23
-16
SquareService.php
application/api_broker/service/SquareService.php
+23
-16
No files found.
application/api_broker/service/SquareService.php
View file @
b71636db
...
@@ -96,8 +96,9 @@ class SquareService
...
@@ -96,8 +96,9 @@ class SquareService
}
}
$field
=
'Square.id,'
;
//
$field
=
'Square.id,'
;
//
$field
.=
'Square.title,'
;
//标题
$field
.=
'Square.title,'
;
$field
.=
'Square.agent_id,'
;
//标题
$field
.=
'Square.agent_id,'
;
$field
.=
'Square.district_lable_id,'
;
//
$field
.=
'Square.cover_img,'
;
//cover_img
$field
.=
'Square.cover_img,'
;
//cover_img
$field
.=
'Site.name as site_name,'
;
//城市
$field
.=
'Site.name as site_name,'
;
//城市
$field
.=
'Square.create_time'
;
//发布时间
$field
.=
'Square.create_time'
;
//发布时间
...
@@ -112,13 +113,7 @@ class SquareService
...
@@ -112,13 +113,7 @@ class SquareService
$res
[
$key
][
'image_path'
]
=
AGENTHEADERIMGURL
.
$agent
[
'img'
];
$res
[
$key
][
'image_path'
]
=
AGENTHEADERIMGURL
.
$agent
[
'img'
];
//部门标签
//部门标签
$res
[
$key
][
'district_lable_name'
]
=
'一部'
;
$res
[
$key
][
'district_lable_name'
]
=
$this
->
getDistrictLableName
(
$val
[
'district_lable_id'
]);
foreach
(
$this
->
getDistrictLable
()
as
$key1
=>
$val1
)
{
if
(
$res
[
$key1
][
'district_lable_id'
]
==
$val1
[
'id'
]){
$res
[
$key1
][
'district_lable_name'
]
=
$val1
[
'name'
];
continue
;
}
}
//评论数
//评论数
$res
[
$key
][
'comment_num'
]
=
$this
->
getCommenNum
(
$val
[
'id'
]);
$res
[
$key
][
'comment_num'
]
=
$this
->
getCommenNum
(
$val
[
'id'
]);
...
@@ -187,14 +182,9 @@ class SquareService
...
@@ -187,14 +182,9 @@ class SquareService
$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
)
{
$res
[
'district_lable_name'
]
=
$this
->
getDistrictLableName
(
$res
[
'district_lable_id'
]);
if
(
$res
[
'district_lable_id'
]
==
$val
[
'id'
]){
$res
[
'district_lable_name'
]
=
$val
[
'name'
];
continue
;
}
}
$agent
=
$this
->
redis
->
getRedisCache
(
2
,
$res
[
'agent_id'
])
;
$agent
=
$this
->
redis
->
getRedisCache
(
2
,
$res
[
'agent_id'
])
;
$res
[
'name'
]
=
$agent
[
'name'
];
$res
[
'name'
]
=
$agent
[
'name'
];
...
@@ -359,4 +349,20 @@ class SquareService
...
@@ -359,4 +349,20 @@ class SquareService
$res
=
$this
->
m_coment
->
getCommenNum
(
$get_params
);
$res
=
$this
->
m_coment
->
getCommenNum
(
$get_params
);
return
$res
;
return
$res
;
}
}
/**
* 根据ID获取标签名
* @param $district_lable_id
* @return string
*/
public
function
getDistrictLableName
(
$district_lable_id
){
foreach
(
$this
->
getDistrictLable
()
as
$k
=>
$v
)
{
if
(
$district_lable_id
==
$v
[
'id'
]){
return
$v
[
'name'
];
continue
;
}
}
return
'其他'
;
}
}
}
\ No newline at end of file
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