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
cf6f30a4
Commit
cf6f30a4
authored
Apr 22, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dapp visit statistics
parent
460bd26a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
0 deletions
+85
-0
VisitStatisticsController.php
api/controllers/VisitStatisticsController.php
+51
-0
CoinAppVisitStatistics.php
common/models/psources/CoinAppVisitStatistics.php
+34
-0
No files found.
api/controllers/VisitStatisticsController.php
0 → 100644
View file @
cf6f30a4
<?php
/**
* Created by PhpStorm.
* User: shaji
* Date: 2019/4/19
* Time: 16:14
*/
namespace
api\controllers
;
use
api\base\BaseController
;
use
common\models\psources\CoinAppVisitStatistics
;
use
Yii
;
class
VisitStatisticsController
extends
BaseController
{
public
function
actionIndex
()
{
$dapp
=
Yii
::
$app
->
request
->
get
(
'dapp'
,
''
);
$identify
=
Yii
::
$app
->
request
->
get
(
'identify'
,
''
);
$duration
=
Yii
::
$app
->
request
->
get
(
'duration'
,
''
);
if
(
empty
(
$dapp
)
&&
!
empty
(
$identify
)){
$isExistModel
=
CoinAppVisitStatistics
::
find
()
->
where
([
'identify'
=>
$identify
])
->
one
();
if
(
$isExistModel
)
{
return
[
'code'
=>
0
,
'data'
=>
[],
'msg'
=>
'数据记录已存在'
];
}
$model
=
new
CoinAppVisitStatistics
();
$model
->
dapp
=
''
;
$model
->
duration
=
''
;
$model
->
identify
=
$identify
;
$model
->
save
();
return
[
'code'
=>
0
,
'data'
=>
[],
'msg'
=>
'数据记录插入成功'
];
}
if
(
!
empty
(
$dapp
)
&&
!
empty
(
$identify
))
{
$isExistModel
=
CoinAppVisitStatistics
::
find
()
->
where
([
'identify'
=>
$identify
])
->
one
();
if
(
!
$isExistModel
){
return
[
'code'
=>
0
,
'data'
=>
[],
'msg'
=>
'数据记录不存在'
];
}
$isExistModel
->
dapp
=
$dapp
;
$isExistModel
->
duration
=
$duration
;
$isExistModel
->
save
();
return
[
'code'
=>
0
,
'data'
=>
[],
'msg'
=>
'数据记录更新成功'
];
}
}
}
\ No newline at end of file
common/models/psources/CoinAppVisitStatistics.php
0 → 100644
View file @
cf6f30a4
<?php
namespace
common\models\psources
;
use
common\core\BaseActiveRecord
;
use
yii\behaviors\TimestampBehavior
;
use
yii\db\Expression
;
use
Yii
;
class
CoinAppVisitStatistics
extends
BaseActiveRecord
{
// public function behaviors()
// {
// return [
// [
// 'class' => TimestampBehavior::className(),
// 'createdAtAttribute' => 'created_at', // 自己根据数据库字段修改
// 'updatedAtAttribute' => 'updated_at', // 自己根据数据库字段修改
// 'value' => new Expression('NOW()'), // 自己根据数据库字段修改
// ]
// ];
// }
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'p_sources'
);
}
public
static
function
tableName
()
{
return
'{{%coin_app_visit_statistics}}'
;
}
}
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