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
6ea915a8
Commit
6ea915a8
authored
Apr 25, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dapp logs
parent
270071b7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
135 additions
and
21 deletions
+135
-21
VisitStatisticsController.php
api/controllers/VisitStatisticsController.php
+41
-4
CoinTransferController.php
backend/controllers/CoinTransferController.php
+14
-2
CoinDailyNumbers.php
common/models/psources/CoinDailyNumbers.php
+39
-0
CoinDailyStatistics.php
common/models/psources/CoinDailyStatistics.php
+2
-15
CoinDailyTimes.php
common/models/psources/CoinDailyTimes.php
+39
-0
No files found.
api/controllers/VisitStatisticsController.php
View file @
6ea915a8
...
...
@@ -9,7 +9,9 @@
namespace
api\controllers
;
use
api\base\BaseController
;
use
common\models\psources\CoinAppVisitStatistics
;
use
common\models\psources\CoinDailyStatistics
;
use
common\models\psources\CoinDailyNumbers
;
use
common\models\psources\CoinDailyTimes
;
use
Yii
;
class
VisitStatisticsController
extends
BaseController
...
...
@@ -21,18 +23,20 @@ class VisitStatisticsController extends BaseController
$identify
=
Yii
::
$app
->
request
->
get
(
'identify'
,
''
);
$duration
=
Yii
::
$app
->
request
->
get
(
'duration'
,
''
);
$address
=
Yii
::
$app
->
request
->
get
(
'address'
,
''
);
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
''
);
if
(
empty
(
$dapp
)
||
empty
(
$identify
)
||
empty
(
$duration
)
||
empty
(
$address
)){
if
(
empty
(
$dapp
)
||
empty
(
$identify
)
||
empty
(
$duration
)
||
empty
(
$address
)
||
empty
(
$platform_id
)
){
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
'缺少必要的参数'
];
}
$isExistModel
=
Coin
AppVisitStatistics
::
find
()
->
where
([
'identify'
=>
$identify
])
->
one
();
$isExistModel
=
Coin
DailyStatistics
::
find
()
->
where
([
'identify'
=>
$identify
,
'platform_id'
=>
$platform_id
])
->
one
();
if
(
!
$isExistModel
)
{
$model
=
new
Coin
AppVisit
Statistics
();
$model
=
new
Coin
Daily
Statistics
();
$model
->
dapp
=
$dapp
;
$model
->
duration
=
$duration
;
$model
->
address
=
$address
;
$model
->
identify
=
$identify
;
$model
->
platform_id
=
$platform_id
;
$model
->
save
();
return
[
'code'
=>
0
,
'data'
=>
[],
'msg'
=>
'数据记录插入成功'
];
}
...
...
@@ -43,4 +47,36 @@ class VisitStatisticsController extends BaseController
return
[
'code'
=>
0
,
'data'
=>
[],
'msg'
=>
'数据记录更新成功'
];
}
}
public
function
actionDailyTimes
()
{
$dapp
=
Yii
::
$app
->
request
->
get
(
'dapp'
,
''
);
$address
=
Yii
::
$app
->
request
->
get
(
'address'
,
''
);
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
''
);
if
(
empty
(
$dapp
)
||
empty
(
$address
)
||
empty
(
$platform_id
)){
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
'缺少必要的参数'
];
}
$begin
=
date
(
"Y-m-d"
,
time
())
.
" 00:00:00"
;
$end
=
date
(
"Y-m-d"
,
time
())
.
" 23:59:59"
;
$isExist_coinDailyNumbers
=
CoinDailyNumbers
::
find
()
->
where
([
'dapp'
=>
$dapp
,
'address'
=>
$address
,
'platform_id'
=>
$platform_id
])
->
andWhere
([
'between'
,
'create_time'
,
$begin
,
$end
])
->
one
();
if
(
!
$isExist_coinDailyNumbers
){
$model_coinDailyNumbers
=
new
CoinDailyNumbers
();
$model_coinDailyNumbers
->
setScenario
(
CoinDailyNumbers
::
SCENARIOS_CREATE
);
$model_coinDailyNumbers
->
load
(
Yii
::
$app
->
request
->
get
(),
''
);
$model_coinDailyNumbers
->
save
();
}
$model_coinDailyTimes
=
new
CoinDailyTimes
();
$model_coinDailyTimes
->
setScenario
(
CoinDailyTimes
::
SCENARIOS_CREATE
);
if
(
$model_coinDailyTimes
->
load
(
Yii
::
$app
->
request
->
get
(),
''
)
&&
$model_coinDailyTimes
->
save
())
{
return
[
'code'
=>
0
,
'data'
=>
[],
'msg'
=>
'数据记录插入成功'
];
}
else
{
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
current
(
$model_coinDailyTimes
->
firstErrors
)];
}
}
}
\ No newline at end of file
backend/controllers/CoinTransferController.php
View file @
6ea915a8
...
...
@@ -8,6 +8,7 @@
namespace
backend\controllers
;
use
backend\models\Coin
;
use
common\service\chain33\Chain33Service
;
use
Yii
;
use
common\models\psources\CoinTransfer
;
...
...
@@ -66,17 +67,27 @@ class CoinTransferController extends BaseController
public
function
actionBatchTransfer
()
{
$model
=
CoinTransfer
::
find
()
->
where
([
'
status'
=>
0
])
->
limit
(
30
)
->
all
();
$model
=
CoinTransfer
::
find
()
->
where
([
'
hash'
=>
'-----------------'
])
->
limit
(
30
)
->
all
();
foreach
(
$model
as
$val
){
echo
$val
->
address
.
"<br/>"
;
$id
=
$val
->
id
;
$to
=
$val
->
address
;
$amount
=
str_replace
(
" TSC"
,
""
,
$val
->
amount
)
*
1e8
;
#$amount = str_replace(" TSC", "", $val->amount) * 1e8;
$amount
=
$val
->
amount
*
1e8
;
$fee
=
100000
;
$note
=
''
;
$execer
=
'user.p.tschain.coins'
;
// $isExist = CoinTransfer::find()->where(['address' => $val->address, 'status' => 1])->one();
// if($isExist){
// $updateModel = CoinTransfer::findOne($val->id);
// $updateModel->hash = '-----------------';
// $updateModel->status = 1;
// $updateModel->save();
// continue;
// }
$service
=
new
Chain33Service
();
$createRawTransaction
=
$service
->
createRawTransaction
(
$to
,
$amount
,
$fee
,
$note
,
$execer
);
...
...
@@ -89,6 +100,7 @@ class CoinTransferController extends BaseController
$expire
=
'1m'
;
$signRawTx
=
$service
->
signRawTx
(
$privkey
,
$txHex
,
$expire
);
if
(
0
!=
$signRawTx
[
'code'
]){
continue
;
}
...
...
common/models/psources/CoinDailyNumbers.php
0 → 100644
View file @
6ea915a8
<?php
namespace
common\models\psources
;
use
Yii
;
use
common\core\BaseActiveRecord
;
class
CoinDailyNumbers
extends
BaseActiveRecord
{
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'p_sources'
);
}
public
static
function
tableName
()
{
return
'{{%coin_daily_numbers}}'
;
}
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
public
function
rules
()
{
return
[
[[
'dapp'
,
'address'
,
'platform_id'
],
'required'
],
[[
'platform_id'
],
'match'
,
'pattern'
=>
'/^[0-9]+$/'
,
'message'
=>
'{attribute} 必须为数字'
],
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'dapp'
,
'address'
,
'platform_id'
],
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
}
common/models/psources/Coin
AppVisit
Statistics.php
→
common/models/psources/Coin
Daily
Statistics.php
View file @
6ea915a8
...
...
@@ -3,23 +3,10 @@
namespace
common\models\psources
;
use
common\core\BaseActiveRecord
;
use
yii\behaviors\TimestampBehavior
;
use
yii\db\Expression
;
use
Yii
;
class
Coin
AppVisit
Statistics
extends
BaseActiveRecord
class
Coin
Daily
Statistics
extends
BaseActiveRecord
{
// public function behaviors()
// {
// return [
// [
// 'class' => TimestampBehavior::className(),
// 'createdAtAttribute' => 'created_at', // 自己根据数据库字段修改
// 'updatedAtAttribute' => 'updated_at', // 自己根据数据库字段修改
// 'value' => new Expression('NOW()'), // 自己根据数据库字段修改
// ]
// ];
// }
public
static
function
getDb
()
{
...
...
@@ -28,7 +15,7 @@ class CoinAppVisitStatistics extends BaseActiveRecord
public
static
function
tableName
()
{
return
'{{%coin_
app_visit
_statistics}}'
;
return
'{{%coin_
daily
_statistics}}'
;
}
}
common/models/psources/CoinDailyTimes.php
0 → 100644
View file @
6ea915a8
<?php
namespace
common\models\psources
;
use
Yii
;
use
common\core\BaseActiveRecord
;
class
CoinDailyTimes
extends
BaseActiveRecord
{
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'p_sources'
);
}
public
static
function
tableName
()
{
return
'{{%coin_daily_times}}'
;
}
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
public
function
rules
()
{
return
[
[[
'dapp'
,
'address'
,
'platform_id'
],
'required'
],
[[
'platform_id'
],
'match'
,
'pattern'
=>
'/^[0-9]+$/'
,
'message'
=>
'{attribute} 必须为数字'
],
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'dapp'
,
'address'
,
'platform_id'
],
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
}
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