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
8add2c6c
Commit
8add2c6c
authored
Apr 29, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dapp trade log
parent
aa154486
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
1 deletion
+92
-1
VisitStatisticsController.php
api/controllers/VisitStatisticsController.php
+66
-1
Chain33Service.php
common/service/chain33/Chain33Service.php
+26
-0
No files found.
api/controllers/VisitStatisticsController.php
View file @
8add2c6c
...
...
@@ -12,13 +12,25 @@ use api\base\BaseController;
use
common\models\psources\CoinDailyStatistics
;
use
common\models\psources\CoinDailyNumbers
;
use
common\models\psources\CoinDailyTimes
;
use
common\service\chain33\Chain33Service
;
use
Yii
;
class
VisitStatisticsController
extends
BaseController
{
/**
* 单个DAPP停留时长
*
* @param string $dapp_name
* @param string $identify
* @param string $duration
* @param string $dapp_address
* @param string $coins_address
* @param string $platform_id
* @return array
*/
public
function
actionIndex
()
{
$dapp_name
=
Yii
::
$app
->
request
->
get
(
'dapp_name'
,
''
);
$identify
=
Yii
::
$app
->
request
->
get
(
'identify'
,
''
);
$duration
=
Yii
::
$app
->
request
->
get
(
'duration'
,
''
);
...
...
@@ -50,6 +62,16 @@ class VisitStatisticsController extends BaseController
}
}
/**
* 日打开/进入DAPP的个数/次数
*
* @param string $dapp_name
* @param string $dapp_address
* @param string $coins_address
* @param string $platform_id
* @return array
*/
public
function
actionDailyTimes
()
{
$dapp_name
=
Yii
::
$app
->
request
->
get
(
'dapp_name'
,
''
);
...
...
@@ -82,4 +104,46 @@ class VisitStatisticsController extends BaseController
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
current
(
$model_coinDailyTimes
->
firstErrors
)];
}
}
/**
* 获取coin地址下DAPP交易信息
*
* @param string $coins_address
* @return array
*/
public
function
actionDappResult
()
{
$coins_address
=
Yii
::
$app
->
request
->
get
(
'coins_address'
,
''
);
if
(
empty
(
$coins_address
)){
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
'缺少必要的参数'
];
}
$service
=
new
Chain33Service
();
$result
=
$service
->
getDappTradeResult
(
$coins_address
);
if
(
0
!==
$result
[
'code'
]){
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
$result
[
'msg'
]];
}
$queryResultItems
=
$result
[
'result'
]
??
[];
if
(
empty
(
$queryResultItems
)){
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
'error'
];
}
$resultJSON
=
json_decode
(
$queryResultItems
[
'queryResultItems'
][
0
][
'resultJSON'
],
true
);
$betting_times
=
$resultJSON
[
'betting_times'
]
??
0
;
$betting_amount
=
$resultJSON
[
'betting_amount'
]
??
0
;
$earnings
=
$resultJSON
[
'earnings'
]
??
0
;
$data
=
[
'betting_times'
=>
$betting_times
,
'betting_amount'
=>
$betting_amount
,
'earnings'
=>
$earnings
];
return
[
'code'
=>
0
,
'data'
=>
$data
,
'msg'
=>
'ok'
];
}
}
\ No newline at end of file
common/service/chain33/Chain33Service.php
View file @
8add2c6c
...
...
@@ -63,6 +63,32 @@ class Chain33Service
}
/**
* 获取coin地址下DAPP交易信息
*
* @param string|array $address
* @return array
*/
public
function
getDappTradeResult
(
$address
)
{
$params
=
[
'execer'
=>
'wasm'
,
'funcName'
=>
'WasmGetContractTable'
,
'payload'
=>
[
'contractName'
=>
'user.p.tschain.user.wasm.dice'
,
'items'
=>
[
[
'tableName'
=>
'addrinfo'
,
'key'
=>
'addrinfo-'
.
$address
]
]
]
];
return
$this
->
send
(
$params
);
}
/**
* 获取地址下的所有token资产
*
* @param string|array $address
...
...
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