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
8eee6802
Commit
8eee6802
authored
Nov 14, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a4e4d594
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
12 deletions
+87
-12
ApplicationBusiness.php
common/business/ApplicationBusiness.php
+38
-1
CoinAppCate.php
common/models/psources/CoinAppCate.php
+6
-0
CoinApplication.php
common/models/psources/CoinApplication.php
+7
-0
CoinApplicationCategory.php
common/models/psources/CoinApplicationCategory.php
+5
-0
ApplicationController.php
h5/controllers/ApplicationController.php
+31
-11
No files found.
common/business/ApplicationBusiness.php
View file @
8eee6802
...
...
@@ -13,6 +13,7 @@ use common\models\psources\CoinApplication;
use
common\models\psources\CoinApplicationCategory
;
use
common\models\psources\CoinBanner
;
use
common\models\psources\CoinImage
;
use
service\risk\constant\CoinCate
;
use
Yii
;
class
ApplicationBusiness
{
...
...
@@ -202,7 +203,7 @@ class ApplicationBusiness
{
$app_cate_Model
=
CoinAppCate
::
find
();
$query
=
$app_cate_Model
->
JoinWith
([
'application'
],
false
)
->
select
(
'cate_id,app_id,name,h5_icon,show_width,show_height,introduce_image,official_url,type,native_url,native_login_url,h5_url,android_url,ios_url,app_store_url,redirect_type,open_type,'
.
CoinAppCate
::
tableName
()
.
'.sort'
)
->
select
(
'cate_id,app_id,name,h5_icon,show_width,show_height,introduce_image,official_url,
advertise,
type,native_url,native_login_url,h5_url,android_url,ios_url,app_store_url,redirect_type,open_type,'
.
CoinAppCate
::
tableName
()
.
'.sort'
)
->
orderBy
(
CoinAppCate
::
tableName
()
.
'.sort asc'
);
foreach
(
$condition
as
$item
)
{
$query
=
$query
->
andWhere
(
$item
);
...
...
@@ -263,4 +264,39 @@ class ApplicationBusiness
}
return
$rank
;
}
public
static
function
h5AppInfo
(
$id
)
{
$app_item
=
CoinApplication
::
getH5ApplicateById
(
$id
);
if
(
$app_item
){
if
(
$app_item
[
'h5_icon'
]){
$icon_item
=
CoinImage
::
getItemById
(
$app_item
[
'h5_icon'
]);
$app_item
[
'h5_icon'
]
=
$icon_item
[
'base_url'
]
.
$icon_item
[
'file_url'
];
}
else
{
$app_item
[
'h5_icon'
]
=
""
;
}
if
(
$app_item
[
'h5_image_ids'
]){
$image_items
=
CoinImage
::
getItemsByImageIds
(
$app_item
[
'h5_image_ids'
]);
$app_item
[
'images'
]
=
array_column
(
$image_items
[
'data'
],
'image_url'
);
}
else
{
$app_item
[
'images'
]
=
[];
}
unset
(
$app_item
[
'h5_image_ids'
]);
$app_user_num
=
self
::
getAppUserNum
(
$id
);
$app_item
[
'app_user_num'
]
=
$app_user_num
;
$category_ids
=
CoinAppCate
::
getCateItemsByAppId
(
$id
);
$category_infos
=
CoinApplicationCategory
::
getCateItemsByIds
(
$category_ids
);
$category_names
=
''
;
foreach
(
$category_infos
as
$item
){
if
(
$category_names
){
$category_names
.=
','
.
$item
[
'name'
];
}
else
{
$category_names
=
$item
[
'name'
];
}
}
$app_item
[
'category'
]
=
$category_names
;
}
return
$app_item
;
}
}
\ No newline at end of file
common/models/psources/CoinAppCate.php
View file @
8eee6802
...
...
@@ -69,5 +69,10 @@ class CoinAppCate extends BaseActiveRecord
}
}
public
static
function
getCateItemsByAppId
(
$app_id
)
{
return
array_column
(
self
::
find
()
->
where
([
'app_id'
=>
$app_id
])
->
asArray
()
->
all
(),
'cate_id'
);
}
}
\ No newline at end of file
common/models/psources/CoinApplication.php
View file @
8eee6802
...
...
@@ -155,6 +155,12 @@ class CoinApplication extends BaseActiveRecord
->
where
([
'like'
,
'name'
,
$name
])
->
asArray
()
->
all
(),
null
,
'app_id'
);
}
public
static
function
getH5ApplicateById
(
$id
)
{
return
self
::
find
()
->
where
([
'id'
=>
$id
])
->
select
(
'id,h5_icon,name,advertise,official_url,h5_image_ids,description,type,native_url,native_login_url,h5_url,android_url,ios_url,app_store_url'
)
->
asArray
()
->
one
();
}
}
\ No newline at end of file
common/models/psources/CoinApplicationCategory.php
View file @
8eee6802
...
...
@@ -102,6 +102,11 @@ class CoinApplicationCategory extends BaseActiveRecord
return
self
::
find
()
->
orderBy
(
'sort asc'
)
->
asArray
()
->
all
();
}
public
static
function
getCateItemsByIds
(
$ids
)
{
return
array_column
(
self
::
find
()
->
where
([
'in'
,
'id'
,
$ids
])
->
asArray
()
->
all
(),
null
,
'id'
);
}
...
...
h5/controllers/ApplicationController.php
View file @
8eee6802
...
...
@@ -37,26 +37,45 @@ class ApplicationController extends BaseController
/**
* 分类下的应用列表
*/
public
function
actionGet
H5
AppsByCate
()
public
function
actionGetAppsByCate
()
{
$response_
=
new
ResponseBuild
();
$request
=
Yii
::
$app
->
request
;
$cate_id
=
$request
->
get
(
'cate_id'
,
''
);
$cate_info_data
=
[];
if
(
$cate_id
){
$cate_info
=
CoinApplicationCategory
::
getCategoryById
(
$cate_id
);
$cate_info_data
[
'id'
]
=
$cate_info
->
id
;
$cate_info_data
[
'name'
]
=
$cate_info
->
name
;
$appItems
=
ApplicationBusiness
::
getCateAppInfo
(
0
,[[
'cate_id'
=>
$cate_id
]]);
if
(
$appItems
){
$appItems
=
array_shift
(
$appItems
);
foreach
(
$appItems
as
&
$value
){
$value
[
'app_user_num'
]
=
ApplicationBusiness
::
getAppUserNum
(
$value
[
'app_id'
]);
if
(
$cate_info
){
$cate_info_data
[
'id'
]
=
$cate_info
->
id
;
$cate_info_data
[
'name'
]
=
$cate_info
->
name
;
$appItems
=
ApplicationBusiness
::
getH5CateAppInfo
(
0
,[[
'cate_id'
=>
$cate_id
]]);
if
(
$appItems
){
$appItems
=
array_shift
(
$appItems
);
foreach
(
$appItems
as
&
$value
){
$value
[
'app_user_num'
]
=
ApplicationBusiness
::
getAppUserNum
(
$value
[
'app_id'
]);
}
$cate_info_data
[
'apps'
]
=
$appItems
;
}
$cate_info_data
[
'apps'
]
=
$appItems
;
return
[
'code'
=>
0
,
'data'
=>
$cate_info_data
];
}
}
return
[
'code'
=>
0
,
'data'
=>
[]];
$response_
->
build
(
ResponseBuild
::
STATUS_SUCCEED
,
''
,
$cate_info_data
);
return
$response_
;
}
/**
* 获取应用详情
*/
public
function
actionAppInfo
()
{
$response_
=
new
ResponseBuild
();
$request
=
Yii
::
$app
->
request
;
$id
=
$request
->
post
(
'id'
,
0
);
$data
=
[];
if
(
$id
){
$data
=
ApplicationBusiness
::
h5AppInfo
(
$id
);
}
$response_
->
build
(
ResponseBuild
::
STATUS_SUCCEED
,
''
,
$data
);
return
$response_
;
}
}
\ 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