Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
wallet
token
Commits
d90df3f3
Commit
d90df3f3
authored
Oct 18, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页推荐添加icon
parent
39b895f7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
7 deletions
+20
-7
ApplicateRecommendController.php
backend/controllers/ApplicateRecommendController.php
+3
-0
CoinApplicationCategoryForm.php
backend/models/coin/CoinApplicationCategoryForm.php
+1
-1
CoinApplicationForm.php
backend/models/coin/CoinApplicationForm.php
+1
-1
ApplicationBusiness.php
common/business/ApplicationBusiness.php
+12
-3
CoinApplicateRecommend.php
common/models/psources/CoinApplicateRecommend.php
+3
-2
No files found.
backend/controllers/ApplicateRecommendController.php
View file @
d90df3f3
...
...
@@ -35,14 +35,17 @@ class ApplicateRecommendController extends BaseController
if
(
$type
==
1
){
//分类
$applicate_category
=
CoinApplicationCategory
::
getCategoryById
(
$id
);
$name
=
$applicate_category
->
name
;
$icon
=
$applicate_category
->
icon
;
}
else
{
//应用
$applicate
=
CoinApplication
::
getApplicate
(
$id
);
$name
=
$applicate
->
name
;
$icon
=
$applicate
->
icon
;
}
$recommend
=
new
CoinApplicateRecommend
();
$recommend
->
relate_id
=
$id
;
$recommend
->
type
=
$type
;
$recommend
->
name
=
$name
;
$recommend
->
icon
=
$icon
;
$recommend
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'首页推荐添加成功'
];
}
else
{
...
...
backend/models/coin/CoinApplicationCategoryForm.php
View file @
d90df3f3
...
...
@@ -102,7 +102,7 @@ class CoinApplicationCategoryForm extends BaseForm
if
(
$coin_applicate_category
){
$coin_applicate_category
->
setAttributes
(
$this
->
attributes
,
false
);
$coin_applicate_category
->
save
();
CoinApplicateRecommend
::
updateName
(
$this
->
id
,
1
,
$this
->
name
);
CoinApplicateRecommend
::
updateName
AndIcon
(
$this
->
id
,
1
,
$this
->
name
,
$this
->
icon
);
return
[
'code'
=>
0
,
'msg'
=>
'应用分类修改成功!'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'应用分类不存在'
];
...
...
backend/models/coin/CoinApplicationForm.php
View file @
d90df3f3
...
...
@@ -132,7 +132,7 @@ class CoinApplicationForm extends BaseForm
if
(
$coin_applicate
){
$coin_applicate
->
setAttributes
(
$this
->
attributes
,
false
);
$coin_applicate
->
save
();
CoinApplicateRecommend
::
updateName
(
$this
->
id
,
2
,
$this
->
name
);
//更新首页推荐name
CoinApplicateRecommend
::
updateName
AndIcon
(
$this
->
id
,
2
,
$this
->
name
,
$this
->
icon
);
//更新首页推荐name
return
[
'code'
=>
0
,
'msg'
=>
'应用修改成功!'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'应用不存在'
];
...
...
common/business/ApplicationBusiness.php
View file @
d90df3f3
...
...
@@ -24,6 +24,15 @@ class ApplicationBusiness
public
static
function
getRecommendList
()
{
$data
=
CoinApplicateRecommend
::
getRecommendList
();
$icon_Items
=
array_column
(
$data
,
'icon'
);
$icon_Infos
=
CoinImage
::
getItemsByIds
(
$icon_Items
);
foreach
(
$data
as
&
$value
){
if
(
$value
[
'icon'
]){
$value
[
'icon'
]
=
$icon_Infos
[
$value
[
'icon'
]][
'base_url'
]
.
$icon_Infos
[
$value
[
'icon'
]][
'file_url'
];
}
else
{
$value
[
'icon'
]
=
''
;
}
}
return
$data
;
}
...
...
@@ -69,16 +78,16 @@ class ApplicationBusiness
{
$app_cate_Model
=
CoinAppCate
::
find
();
$data
=
$app_cate_Model
->
JoinWith
([
'application'
],
false
)
->
select
(
'cate_id,app_id,name,icon,sort,
redirect_type
'
)
->
select
(
'cate_id,app_id,name,icon,sort,
type,native_url,h5_url,android_url,ios_url,app_store_url,redirect_type,
'
)
->
orderBy
(
'sort asc'
)
->
asArray
()
->
all
();
$icon_Items
=
array_column
(
$data
,
'icon'
);
$icon_Items
=
array_unique
(
$icon_Items
);
$icon_Infos
=
CoinImage
::
getItemsByIds
(
$icon_Items
);
foreach
(
$data
as
&
$value
){
if
(
$value
[
'icon'
]){
$value
[
'icon
_url
'
]
=
$icon_Infos
[
$value
[
'icon'
]][
'base_url'
]
.
$icon_Infos
[
$value
[
'icon'
]][
'file_url'
];
$value
[
'icon'
]
=
$icon_Infos
[
$value
[
'icon'
]][
'base_url'
]
.
$icon_Infos
[
$value
[
'icon'
]][
'file_url'
];
}
else
{
$value
[
'icon
_url
'
]
=
''
;
$value
[
'icon'
]
=
''
;
}
}
foreach
(
$data
as
$item
){
...
...
common/models/psources/CoinApplicateRecommend.php
View file @
d90df3f3
...
...
@@ -43,11 +43,12 @@ class CoinApplicateRecommend extends BaseActiveRecord
return
array_column
(
$data
,
null
,
'relate_id'
);
}
public
static
function
updateName
(
$id
,
$type
,
$name
)
public
static
function
updateName
AndIcon
(
$id
,
$type
,
$name
,
$icon
)
{
$recommend
=
self
::
find
()
->
where
([
'relate_id'
=>
$id
,
'type'
=>
$type
])
->
one
();
if
(
$recommend
){
$recommend
->
name
=
$name
;
$recommend
->
icon
=
$icon
;
$recommend
->
save
();
}
}
...
...
@@ -62,7 +63,7 @@ class CoinApplicateRecommend extends BaseActiveRecord
public
static
function
getRecommendList
()
{
return
self
::
find
()
->
select
(
'relate_id as app_cate_id,name,type'
)
->
asArray
()
->
orderBy
(
'sort asc'
)
->
all
();
return
self
::
find
()
->
select
(
'relate_id as app_cate_id,name,type
,icon
'
)
->
asArray
()
->
orderBy
(
'sort asc'
)
->
all
();
}
...
...
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