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
6 years ago
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 @@
...
@@ -8,12 +8,12 @@
namespace
api\controllers
;
namespace
api\controllers
;
use
common\base\Exception
;
use
common\business\ExchangeBusiness
;
use
common\models\pwallet\Coin
;
use
Yii
;
use
Yii
;
use
common\base\Exception
;
use
api\base\BaseController
;
use
api\base\BaseController
;
use
common\models\pwallet\Coin
;
use
common\business\CoinBusiness
;
use
common\business\CoinBusiness
;
use
common\business\ExchangeBusiness
;
/**
/**
* 币种信息管理控制器
* 币种信息管理控制器
...
@@ -31,7 +31,10 @@ class CoinController extends BaseController
...
@@ -31,7 +31,10 @@ class CoinController extends BaseController
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$id
=
$request
->
post
(
'id'
,
0
);
$id
=
$request
->
post
(
'id'
,
0
);
if
(
$id
)
{
if
(
$id
)
{
return
CoinBusiness
::
getCoinAllById
(
$id
);
$ret
=
CoinBusiness
::
getCoinAllById
(
$id
);
if
(
$ret
)
{
return
$ret
[
0
];
}
}
}
return
[];
return
[];
}
}
...
@@ -67,24 +70,13 @@ class CoinController extends BaseController
...
@@ -67,24 +70,13 @@ class CoinController extends BaseController
//如果coin为null,$coin->minerFee会抛出Trying to get property 'minerFee' of non-object",code=>8
//如果coin为null,$coin->minerFee会抛出Trying to get property 'minerFee' of non-object",code=>8
throw
new
Exception
(
'8'
,
'币种不存在'
);
throw
new
Exception
(
'8'
,
'币种不存在'
);
}
}
return
[
$miner_fee
];
return
(
array
)
$miner_fee
->
getAttributes
();
}
/**
* app首页接口
*/
public
function
actionCoinIndex
()
{
$names
=
Yii
::
$app
->
request
->
post
(
'names'
);
$condition
=
[[
'in'
,
'name'
,
$names
]];
return
CoinBusiness
::
getApiListForIndex
(
$condition
);
}
}
/**
/**
* app首页接口V2
* app首页接口V2
*/
*/
public
function
actionCoinIndex
V2
()
public
function
actionCoinIndex
()
{
{
$names
=
Yii
::
$app
->
request
->
post
(
'names'
);
$names
=
Yii
::
$app
->
request
->
post
(
'names'
);
$condition
=
[[
'in'
,
'name'
,
$names
]];
$condition
=
[[
'in'
,
'name'
,
$names
]];
...
@@ -103,7 +95,7 @@ class CoinController extends BaseController
...
@@ -103,7 +95,7 @@ class CoinController extends BaseController
$limit
=
$request
->
post
(
'limit'
,
10
);
$limit
=
$request
->
post
(
'limit'
,
10
);
if
(
$name
)
{
if
(
$name
)
{
$condition
=
[[
'or'
,
[
'like'
,
'name'
,
$name
],
[
'like'
,
'nickname'
,
$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
This diff is collapsed.
Click to expand it.
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
This diff is collapsed.
Click to expand it.
common/config/params.php
View file @
79eeab89
...
@@ -46,7 +46,7 @@ return [
...
@@ -46,7 +46,7 @@ return [
'http_proxy'
=>
[
'http_proxy'
=>
[
'host'
=>
'127.0.0.1'
,
'host'
=>
'127.0.0.1'
,
'port'
=>
'
1080
'
,
'port'
=>
'
8118
'
,
'use'
=>
true
'use'
=>
true
]
]
];
];
This diff is collapsed.
Click to expand it.
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