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
b3ec1b80
Commit
b3ec1b80
authored
Jun 22, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app版本更新
parent
9633479d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
0 deletions
+79
-0
AppController.php
api/controllers/AppController.php
+26
-0
AppVersion.php
common/models/pwallet/AppVersion.php
+53
-0
No files found.
api/controllers/AppController.php
0 → 100644
View file @
b3ec1b80
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-22
* Time: 下午2:48
*/
namespace
api\controllers
;
use
api\base\BaseController
;
use
common\models\pwallet\AppVersion
;
class
AppController
extends
BaseController
{
public
function
actionUpdate
()
{
$type
=
\Yii
::
$app
->
request
->
post
(
'type'
);
$data
=
AppVersion
::
getLastStable
(
$type
);
if
(
$data
)
{
$data
[
'log'
]
=
json_decode
(
$data
[
'log'
]);
}
return
$data
;
}
}
\ No newline at end of file
common/models/pwallet/AppVersion.php
0 → 100644
View file @
b3ec1b80
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-22
* Time: 下午1:59
*/
namespace
common\models\pwallet
;
use
Yii
;
use
common\core\BaseActiveRecord
;
class
AppVersion
extends
BaseActiveRecord
{
/**
* @return null|object|\yii\db\Connection
* @throws \yii\base\InvalidConfigException
*/
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'db_pwallet'
);
}
/**
* 获取最新的稳定版app
*
* @param int $type android(1) IOS(3)
* @return array
*/
public
static
function
getLastStable
(
$type
=
1
)
{
$query
=
<<<EOF
select
id,
status,
version,
download_url,
`log`
from app_version
where type = :type AND version = (SELECT MAX(version)
from app_version
where type = :type);
EOF;
try
{
return
self
::
getDb
()
->
createCommand
(
$query
)
->
bindValue
(
':type'
,
$type
)
->
queryOne
();
}
catch
(
\Exception
$exception
)
{
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