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
79eeab89
Commit
79eeab89
authored
Jul 02, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
搜索币api v2
parent
5e4bd1d5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
121 deletions
+12
-121
CoinController.php
api/controllers/CoinController.php
+11
-18
CoinController.php
api/controllers/v2/CoinController.php
+0
-102
params.php
common/config/params.php
+1
-1
No files found.
api/controllers/CoinController.php
View file @
79eeab89
...
...
@@ -8,12 +8,12 @@
namespace
api\controllers
;
use
common\base\Exception
;
use
common\business\ExchangeBusiness
;
use
common\models\pwallet\Coin
;
use
Yii
;
use
common\base\Exception
;
use
api\base\BaseController
;
use
common\models\pwallet\Coin
;
use
common\business\CoinBusiness
;
use
common\business\ExchangeBusiness
;
/**
* 币种信息管理控制器
...
...
@@ -31,7 +31,10 @@ class CoinController extends BaseController
$request
=
Yii
::
$app
->
request
;
$id
=
$request
->
post
(
'id'
,
0
);
if
(
$id
)
{
return
CoinBusiness
::
getCoinAllById
(
$id
);
$ret
=
CoinBusiness
::
getCoinAllById
(
$id
);
if
(
$ret
)
{
return
$ret
[
0
];
}
}
return
[];
}
...
...
@@ -67,24 +70,13 @@ class CoinController extends BaseController
//如果coin为null,$coin->minerFee会抛出Trying to get property 'minerFee' of non-object",code=>8
throw
new
Exception
(
'8'
,
'币种不存在'
);
}
return
[
$miner_fee
];
}
/**
* app首页接口
*/
public
function
actionCoinIndex
()
{
$names
=
Yii
::
$app
->
request
->
post
(
'names'
);
$condition
=
[[
'in'
,
'name'
,
$names
]];
return
CoinBusiness
::
getApiListForIndex
(
$condition
);
return
(
array
)
$miner_fee
->
getAttributes
();
}
/**
* app首页接口V2
*/
public
function
actionCoinIndex
V2
()
public
function
actionCoinIndex
()
{
$names
=
Yii
::
$app
->
request
->
post
(
'names'
);
$condition
=
[[
'in'
,
'name'
,
$names
]];
...
...
@@ -103,7 +95,7 @@ class CoinController extends BaseController
$limit
=
$request
->
post
(
'limit'
,
10
);
if
(
$name
)
{
$condition
=
[[
'or'
,
[
'like'
,
'name'
,
$name
],
[
'like'
,
'nickname'
,
$name
]]];
return
Coin
Business
::
SearchByName
(
$page
,
$limit
,
$condition
);
return
Exchange
Business
::
SearchByName
(
$page
,
$limit
,
$condition
);
}
}
}
\ No newline at end of file
api/controllers/v2/CoinController.php
deleted
100644 → 0
View file @
5e4bd1d5
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-5-31
* Time: 下午1:02
*/
namespace
api\controllers\v2
;
use
Yii
;
use
common\base\Exception
;
use
api\base\BaseController
;
use
common\models\pwallet\Coin
;
use
common\business\CoinBusiness
;
use
common\business\ExchangeBusiness
;
/**
* 币种信息管理控制器
* Class CoinController
* @package api\controllers
*/
class
CoinController
extends
BaseController
{
/**
* 单币种按照id查询
* @return array|null|\yii\db\ActiveRecord
*/
public
function
actionGetCoinById
()
{
$request
=
Yii
::
$app
->
request
;
$id
=
$request
->
post
(
'id'
,
0
);
if
(
$id
)
{
$ret
=
CoinBusiness
::
getCoinAllById
(
$id
);
if
(
$ret
)
{
return
$ret
[
0
];
}
}
return
[];
}
/**
* 获取推介币种列表
*/
public
function
actionGetRecList
()
{
$request
=
Yii
::
$app
->
request
;
$page
=
$request
->
post
(
'page'
,
1
);
$limit
=
$request
->
post
(
'limit'
,
999
);
$condition
=
[[
'recommend'
=>
'1'
]];
return
CoinBusiness
::
getApiList
(
$page
,
$limit
,
$condition
);
}
/**
* 矿工费获取
*
* 根据name获取
* @throws Exception
*/
public
function
actionGetMinerFeeByName
()
{
$names
=
Yii
::
$app
->
request
->
post
(
'name'
);
$coin
=
Coin
::
findOne
([
'name'
=>
$names
]);
if
(
$coin
)
{
$miner_fee
=
$coin
->
minerFee
;
if
(
empty
(
$miner_fee
))
{
return
[];
}
}
else
{
//如果coin为null,$coin->minerFee会抛出Trying to get property 'minerFee' of non-object",code=>8
throw
new
Exception
(
'8'
,
'币种不存在'
);
}
return
(
array
)
$miner_fee
->
getAttributes
();
}
/**
* app首页接口V2
*/
public
function
actionCoinIndex
()
{
$names
=
Yii
::
$app
->
request
->
post
(
'names'
);
$condition
=
[[
'in'
,
'name'
,
$names
]];
return
ExchangeBusiness
::
getApiListForIndex
(
$condition
);
}
/**
* 按照名称搜索币种
* @return array
*/
public
function
actionSearchCoinByName
()
{
$request
=
Yii
::
$app
->
request
;
$name
=
$request
->
post
(
'name'
,
''
);
$page
=
$request
->
post
(
'page'
,
1
);
$limit
=
$request
->
post
(
'limit'
,
10
);
if
(
$name
)
{
$condition
=
[[
'or'
,
[
'like'
,
'name'
,
$name
],
[
'like'
,
'nickname'
,
$name
]]];
return
ExchangeBusiness
::
SearchByName
(
$page
,
$limit
,
$condition
);
}
}
}
\ No newline at end of file
common/config/params.php
View file @
79eeab89
...
...
@@ -46,7 +46,7 @@ return [
'http_proxy'
=>
[
'host'
=>
'127.0.0.1'
,
'port'
=>
'
1080
'
,
'port'
=>
'
8118
'
,
'use'
=>
true
]
];
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