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
f229d7fd
Commit
f229d7fd
authored
Nov 05, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应用添加
parent
e9f78ac6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
38 deletions
+57
-38
ExploreApp.php
common/models/psources/ExploreApp.php
+0
-12
ExploreAppController.php
wallet/controllers/ExploreAppController.php
+57
-26
No files found.
common/models/psources/ExploreApp.php
View file @
f229d7fd
...
@@ -12,18 +12,6 @@ class ExploreApp extends BaseActiveRecord
...
@@ -12,18 +12,6 @@ class ExploreApp extends BaseActiveRecord
const
STATUS_ON
=
1
;
//激活
const
STATUS_ON
=
1
;
//激活
const
STATUS_OFF
=
0
;
//未激活
const
STATUS_OFF
=
0
;
//未激活
public
function
behaviors
()
{
return
[
[
'class'
=>
TimestampBehavior
::
className
(),
'createdAtAttribute'
=>
'created_at'
,
'updatedAtAttribute'
=>
'updated_at'
,
'value'
=>
new
Expression
(
'NOW()'
)
]
];
}
public
static
function
getDb
()
public
static
function
getDb
()
{
{
return
Yii
::
$app
->
get
(
'p_sources'
);
return
Yii
::
$app
->
get
(
'p_sources'
);
...
...
wallet/controllers/ExploreAppController.php
View file @
f229d7fd
...
@@ -140,35 +140,66 @@ class ExploreAppController extends BaseController
...
@@ -140,35 +140,66 @@ class ExploreAppController extends BaseController
{
{
$msg
=
'ok'
;
$msg
=
'ok'
;
$code
=
0
;
$code
=
0
;
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();;
$data
=
null
;
$category_id
=
Yii
::
$app
->
request
->
get
(
'id'
,
0
);
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
if
(
Yii
::
$app
->
request
->
isGet
)
{
if
(
false
==
$platform_id
||
false
==
$category_id
)
{
$category_id
=
Yii
::
$app
->
request
->
get
(
'id'
,
0
);
$msg
=
'参数错误'
;
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
$code
=
-
1
;
if
(
false
==
$platform_id
||
false
==
$category_id
)
{
$data
=
null
;
$msg
=
'参数错误'
;
$code
=
-
1
;
$data
=
null
;
goto
doEnd
;
}
$query
=
ExploreApp
::
find
()
->
select
(
'id, name, icon, sort, status'
)
->
where
([
'app_category_id'
=>
$category_id
])
->
andWhere
([
'platform_id'
=>
$platform_id
])
->
asArray
();
$app_model
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
10
)
->
asArray
()
->
all
();
foreach
(
$app_model
as
&
$val
)
{
$name
=
json_decode
(
$val
[
'name'
],
true
);
$val
[
'name'
]
=
$name
[
'zh-CN'
];
}
$countQuery
=
clone
$query
;
$pages
=
new
Pagination
([
'totalCount'
=>
$countQuery
->
count
(),
'pageSize'
=>
'10'
]);
$data
=
[
'list'
=>
$app_model
,
'page'
=>
[
'pageCount'
=>
$pages
->
pageCount
,
'pageSize'
=>
10
,
'currentPage'
=>
$page
,
]
];
goto
doEnd
;
goto
doEnd
;
}
}
$query
=
ExploreApp
::
find
()
->
select
(
'id, name, icon, sort, status, created_at'
)
if
(
Yii
::
$app
->
request
->
isPost
){
->
where
([
'app_category_id'
=>
$category_id
])
$model
=
new
ExploreApp
();
->
andWhere
([
'platform_id'
=>
$platform_id
])
$model
->
setScenario
(
ExploreApp
::
SCENARIOS_CREATE
);
->
asArray
();
$params
=
Yii
::
$app
->
request
->
post
();
$app_model
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
10
)
->
asArray
()
->
all
();
$params
[
'platform_id'
]
=
$platform_id
;
foreach
(
$app_model
as
&
$val
)
{
$lang
=
[
$name
=
json_decode
(
$val
[
'name'
],
true
);
'zh-CN'
,
$val
[
'name'
]
=
$name
[
'zh-CN'
];
'en-US'
,
'ja'
];
$name_arr
=
$params
[
'name'
];
$name
=
[];
foreach
(
$name_arr
as
$key
=>
$val
)
{
$name
[
$lang
[
$key
]]
=
$val
;
}
unset
(
$params
[
'name'
]);
$params
[
'name'
]
=
$name
;
if
(
$model
->
load
(
$params
,
''
)
&&
$model
->
save
())
{
goto
doEnd
;
}
$msg
=
$model
->
errors
;
$code
=
-
1
;
goto
doEnd
;
}
}
$countQuery
=
clone
$query
;
$pages
=
new
Pagination
([
'totalCount'
=>
$countQuery
->
count
(),
'pageSize'
=>
'10'
]);
$data
=
[
'list'
=>
$app_model
,
'page'
=>
[
'pageCount'
=>
$pages
->
pageCount
,
'pageSize'
=>
10
,
'currentPage'
=>
$page
,
]
];
doEnd
:
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
...
...
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