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
ad55fa40
Commit
ad55fa40
authored
Nov 26, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
fix
parents
c63555fc
0b5d3b45
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
513 additions
and
102 deletions
+513
-102
BaseController.php
api/base/BaseController.php
+12
-4
CoinController.php
api/controllers/CoinController.php
+74
-5
TickerController.php
api/controllers/TickerController.php
+35
-3
ApplicationCategoryController.php
backend/controllers/ApplicationCategoryController.php
+6
-14
ApplicationController.php
backend/controllers/ApplicationController.php
+8
-18
CoinController.php
backend/controllers/CoinController.php
+10
-20
add.php
backend/views/application-category/add.php
+9
-3
edit.php
backend/views/application-category/edit.php
+9
-3
add.php
backend/views/application/add.php
+9
-3
edit.php
backend/views/application/edit.php
+9
-3
add.php
backend/views/coin/add.php
+18
-6
edit.php
backend/views/coin/edit.php
+18
-6
CoinCurrency.php
common/models/psources/CoinCurrency.php
+51
-0
CoinPlatform.php
common/models/psources/CoinPlatform.php
+9
-0
CoinSupportedCurrency.php
common/models/psources/CoinSupportedCurrency.php
+68
-0
TickerController.php
console/controllers/TickerController.php
+37
-8
WalletController.php
wallet/controllers/WalletController.php
+131
-6
No files found.
api/base/BaseController.php
View file @
ad55fa40
...
...
@@ -19,12 +19,14 @@ class BaseController extends Controller
public
$header_list
=
[];
public
$lang
;
public
$currency_id
;
public
$platform_id
;
private
static
$default_header_list
=
[];
public
function
init
()
{
if
(
'cli'
!==
php_sapi_name
()){
if
(
'cli'
!==
php_sapi_name
())
{
$this
->
header_list
=
self
::
$default_header_list
;
$this
->
fzmCrossHeader
();
}
...
...
@@ -33,9 +35,15 @@ class BaseController extends Controller
public
function
fzmCrossHeader
()
{
$this
->
lang
=
\Yii
::
$app
->
request
->
headers
->
get
(
'lang'
)
??
'zh-CN'
;
if
(
'en'
==
strtolower
(
$this
->
lang
)){
if
(
'en'
==
strtolower
(
$this
->
lang
))
{
$this
->
lang
=
'en-US'
;
}
if
(
\Yii
::
$app
->
request
->
headers
->
get
(
'FZM-PLATFORM-ID'
))
{
$this
->
platform_id
=
\Yii
::
$app
->
request
->
headers
->
get
(
'FZM-PLATFORM-ID'
);
}
if
(
\Yii
::
$app
->
request
->
headers
->
get
(
'FZM-CURRENCY-ID'
))
{
$this
->
currency_id
=
\Yii
::
$app
->
request
->
headers
->
get
(
'FZM-CURRENCY-ID'
);
}
}
public
function
beforeAction
(
$action
)
...
...
@@ -75,7 +83,7 @@ class BaseController extends Controller
'errmsg'
=>
$errmsg
,
];
if
(
$data
!==
null
)
{
if
(
$data
!==
null
)
{
$result
[
'data'
]
=
Yii
::
createObject
(
'yii\rest\Serializer'
)
->
serialize
(
$data
);
}
...
...
@@ -83,7 +91,7 @@ class BaseController extends Controller
$response
->
format
=
Response
::
FORMAT_JSON
;
//jsonp数据格式
if
(
!
is_null
(
$callback
))
{
if
(
!
is_null
(
$callback
))
{
Yii
::
$app
->
getResponse
()
->
format
=
Response
::
FORMAT_JSONP
;
$result
=
[
'data'
=>
$result
,
...
...
api/controllers/CoinController.php
View file @
ad55fa40
...
...
@@ -15,10 +15,12 @@ use common\business\Chain33Business;
use
common\business\CoinBusiness
;
use
common\business\ExchangeBusiness
;
use
common\models\psources\Coin
;
use
common\models\psources\CoinCurrency
;
use
common\models\psources\CoinPlatformWithHold
;
use
common\models\psources\CoinRecommend
;
use
common\models\psources\MinerFee
;
use
Yii
;
use
yii\data\Pagination
;
/**
* 币种信息管理控制器
...
...
@@ -142,9 +144,9 @@ class CoinController extends BaseController
$coin_infos
=
Coin
::
getCoinInfoByIds
(
$coin_ids
,
$select
,
'id'
);
foreach
(
$coin_infos
as
$key
=>
&
$val
)
{
$nickname
=
json_decode
(
$val
[
'nickname'
],
true
);
$val
[
'nickname'
]
=
$nickname
[
$this
->
lang
]
;
$val
[
'nickname'
]
=
isset
(
$nickname
[
$this
->
lang
])
?
$nickname
[
$this
->
lang
]
:
''
;
$introduce
=
json_decode
(
$val
[
'introduce'
],
true
);
$val
[
'introduce'
]
=
$introduce
[
$this
->
lang
]
;
$val
[
'introduce'
]
=
isset
(
$introduce
[
$this
->
lang
])
?
$introduce
[
$this
->
lang
]
:
''
;
}
//获取行情信息
$coin_names
=
array_column
(
$coin_infos
,
'name'
);
...
...
@@ -243,20 +245,87 @@ class CoinController extends BaseController
foreach
(
$chains
as
$key
=>
$value
)
{
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
}
$currency
=
CoinCurrency
::
find
()
->
where
([
'pj_id'
=>
$this
->
currency_id
])
->
one
();
if
(
false
!=
$currency
)
{
$last
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_boc_'
.
'CNY_'
.
$currency
->
symbol
,
'last'
);
}
foreach
(
$result
[
'data'
]
as
$key
=>
&
$value
)
{
if
(
!
isset
(
$value
[
'nickname'
])
||
empty
(
$value
[
'nickname'
]))
continue
;
$nickname
=
json_decode
(
$value
[
'nickname'
],
true
);
$introduce
=
json_decode
(
$value
[
'introduce'
],
true
);
$value
[
'nickname'
]
=
$nickname
[
$this
->
lang
]
;
$value
[
'introduce'
]
=
$introduce
[
$this
->
lang
]
;
$value
[
'nickname'
]
=
isset
(
$nickname
[
$this
->
lang
])
?
$nickname
[
$this
->
lang
]
:
''
;
$value
[
'introduce'
]
=
isset
(
$introduce
[
$this
->
lang
])
?
$introduce
[
$this
->
lang
]
:
''
;
$value
[
'chain_quotation'
]
=
$chain_quotation
[
$value
[
'chain'
]]
?:
null
;
$value
[
'chain_rmb'
]
=
isset
(
$value
[
'chain_quotation'
][
'rmb'
])
?
$value
[
'chain_quotation'
][
'rmb'
]
:
0
;
$value
[
'chain_usd'
]
=
isset
(
$value
[
'chain_quotation'
][
'usd'
])
?
$value
[
'chain_quotation'
][
'usd'
]
:
0
;
$value
[
'country_rate'
]
=
(
false
==
$currency
)
?
''
:
(
float
)
sprintf
(
"%0.4f"
,
$last
[
0
]
*
$value
[
'rmb'
]);
}
return
$result
;
}
}
public
function
actionSearch
()
{
$params
=
Yii
::
$app
->
request
->
post
();
$chain
=
isset
(
$params
[
'chain'
])
?
$params
[
'chain'
]
:
''
;
$keyword
=
isset
(
$params
[
'keyword'
])
?
$params
[
'keyword'
]
:
''
;
$platform
=
isset
(
$params
[
'platform'
])
?
$params
[
'platform'
]
:
''
;
$platform_id
=
isset
(
$params
[
'platform_id'
])
?
$params
[
'platform_id'
]
:
''
;
$page
=
empty
(
$params
[
'page'
])
?
1
:
$params
[
'page'
];
$limit
=
empty
(
$params
[
'limit'
])
?
10
:
$params
[
'limit'
];
if
(
false
==
$platform_id
)
{
$msg
=
'参数错误'
;
$code
=
-
1
;
$data
=
null
;
goto
doEnd
;
}
$query
=
Coin
::
find
()
->
select
(
'id, sid, icon, name, optional_name, nickname, platform, chain, address as contract_address, treaty'
)
->
where
([
'platform_id'
=>
(
int
)
$platform_id
])
->
orderBy
(
'id'
);
if
(
false
!=
$chain
)
{
$query
->
andWhere
([
'chain'
=>
$chain
]);
}
if
(
false
!=
$platform
)
{
$query
->
andWhere
([
'platform'
=>
$platform
]);
}
if
(
false
!=
$keyword
)
{
$query
->
andWhere
([
'or'
,
[
'like'
,
'address'
,
$keyword
],
[
'like'
,
'name'
,
$keyword
],
[
'like'
,
'nickname'
,
$keyword
]]);
}
$data
=
$query
->
offset
((
$page
-
1
)
*
$limit
)
->
limit
(
$limit
)
->
asArray
()
->
all
();
$count
=
$query
->
count
();
if
(
false
!=
$data
)
{
$chains
=
array_unique
(
array_column
(
$data
,
'chain'
));
$chain_quotation
=
[];
foreach
(
$chains
as
$key
=>
$value
)
{
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
}
foreach
(
$data
as
$key
=>
$value
)
{
$data
[
$key
][
'chain_quotation'
]
=
$chain_quotation
[
$value
[
'chain'
]]
?:
null
;
}
foreach
(
$data
as
$key
=>
&
$value
)
{
$nickname
=
json_decode
(
$value
[
'nickname'
],
true
);
$value
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
$value
[
'chain_rmb'
]
=
isset
(
$value
[
'chain_quotation'
][
'rmb'
])
?
$value
[
'chain_quotation'
][
'rmb'
]
:
0
;
$value
[
'chain_usd'
]
=
isset
(
$value
[
'chain_quotation'
][
'usd'
])
?
$value
[
'chain_quotation'
][
'usd'
]
:
0
;
}
}
$code
=
0
;
doEnd
:
return
[
'code'
=>
$code
,
'data'
=>
$data
,
'count'
=>
$count
];
}
/**
* 按照名称搜索币种
*
...
...
@@ -365,7 +434,7 @@ class CoinController extends BaseController
if
(
1
==
$coin_info
[
'treaty'
])
{
$platform_with_hold
[
'exer'
]
=
'user.p.'
.
$platform
.
'.token'
;
if
(
'BTY'
!==
strtoupper
(
$platform
))
{
$platform_with_hold
[
'tokensymbol'
]
=
$platform
.
'.'
.
$coin_name
;
$platform_with_hold
[
'tokensymbol'
]
=
$platform
.
'.'
.
$coin_name
;
}
else
{
$platform_with_hold
[
'tokensymbol'
]
=
$coin_name
;
}
...
...
api/controllers/TickerController.php
View file @
ad55fa40
...
...
@@ -3,6 +3,8 @@
namespace
api\controllers
;
use
common\components\Tools
;
use
common\models\psources\CoinCurrency
;
use
common\models\psources\CoinSupportedCurrency
;
use
Yii
;
use
yii\data\Pagination
;
use
linslin\yii2\curl\Curl
;
...
...
@@ -291,7 +293,7 @@ class TickerController extends BaseController
'btcusdt'
,
'ethusdt'
]
],[
],
[
'exchange'
=>
'zhaobi'
,
'symbol'
=>
[
'btyusdt'
...
...
@@ -306,7 +308,7 @@ class TickerController extends BaseController
'btcusdt'
,
'ethusdt'
],
],[
],
[
'exchange'
=>
'dag'
,
'symbol'
=>
[
'dagusdt'
...
...
@@ -322,7 +324,7 @@ class TickerController extends BaseController
'btcusdt'
,
'ethusdt'
],
],[
],
[
'exchange'
=>
'bitnasdaq'
,
'symbol'
=>
[
'bncusdt'
...
...
@@ -344,4 +346,33 @@ class TickerController extends BaseController
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
public
function
actionCurrency
()
{
$code
=
0
;
$data
=
null
;
$platform_id
=
$this
->
platform_id
;
if
(
false
==
$platform_id
)
{
$code
=
-
1
;
$msg
=
'请求参数错误!'
;
goto
doEnd
;
}
$currency
=
CoinSupportedCurrency
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
all
();
foreach
(
$currency
as
$val
)
{
list
(
$rate
)
=
Yii
::
$app
->
redis_currency
->
hmget
(
'quotation_boc_'
.
'CNY_'
.
$val
->
currency
->
symbol
,
'last'
);
$val
->
pj_id
=
$val
->
currency
->
pj_id
;
$val
->
pj_name
=
$val
->
currency
->
pj_name
;
$val
->
pj_symbol
=
$val
->
currency
->
pj_symbol
;
$val
->
rate
=
$rate
;
unset
(
$val
->
id
);
unset
(
$val
->
platform_id
);
unset
(
$val
->
currency_id
);
}
$data
=
$currency
;
$code
=
0
;
$msg
=
'success'
;
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
\ No newline at end of file
backend/controllers/ApplicationCategoryController.php
View file @
ad55fa40
...
...
@@ -92,15 +92,11 @@ class ApplicationCategoryController extends BaseController
$fields
=
[
'id'
,
'name'
,
'sort'
,
'icon'
,
'banner'
,
'banner_url'
];
$params
=
$this
->
initParams
(
Yii
::
$app
->
request
->
post
(),
$fields
);
$params
[
'platform_id'
]
=
Yii
::
$app
->
user
->
identity
->
platform_id
;
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
];
$name_arr
=
$params
[
'name'
];
$name
=
[];
foreach
(
$name_arr
as
$key
=>
$val
)
{
$name
[
$lang
[
$key
]]
=
$val
;
foreach
(
Yii
::
$app
->
params
[
'lang'
]
as
$key
=>
$val
)
{
$name
[
$val
]
=
isset
(
$name_arr
[
$val
])
?
$name_arr
[
$val
]
:
''
;
}
unset
(
$params
[
'name'
]);
...
...
@@ -124,15 +120,10 @@ class ApplicationCategoryController extends BaseController
$category
=
CoinApplicationCategory
::
getCategoryById
(
$params
[
'id'
]);
$params
[
'platform_id'
]
=
$category
->
platform_id
;
$application_category
->
setScenario
(
CoinApplicationCategoryForm
::
SCENARIO_EDIT
);
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
];
$name_arr
=
$params
[
'name'
];
$name
=
[];
foreach
(
$name_arr
as
$key
=>
$val
)
{
$name
[
$
lang
[
$key
]]
=
$val
;
foreach
(
Yii
::
$app
->
params
[
'lang'
]
as
$key
=>
$val
)
{
$name
[
$
val
]
=
isset
(
$name_arr
[
$val
])
?
$name_arr
[
$val
]
:
''
;
}
unset
(
$params
[
'name'
]);
...
...
@@ -150,6 +141,7 @@ class ApplicationCategoryController extends BaseController
$coin
[
'name_ja'
]
=
isset
(
$name_arr
[
'ja'
])
?
$name_arr
[
'ja'
]
:
''
;
$coin
[
'name_zh'
]
=
isset
(
$name_arr
[
'zh-CN'
])
?
$name_arr
[
'zh-CN'
]
:
''
;
$coin
[
'name_en'
]
=
isset
(
$name_arr
[
'en-US'
])
?
$name_arr
[
'en-US'
]
:
''
;
$coin
[
'name_ko'
]
=
isset
(
$name_arr
[
'ko'
])
?
$name_arr
[
'ko'
]
:
''
;
$this
->
layout
=
false
;
return
$this
->
render
(
'edit'
,
[
'model'
=>
$coin
]);
}
...
...
backend/controllers/ApplicationController.php
View file @
ad55fa40
...
...
@@ -65,15 +65,10 @@ class ApplicationController extends BaseController
$category_id
=
Yii
::
$app
->
request
->
get
(
'category_id'
);
$fields
=
[
'category_id'
,
'h5_icon'
,
'official_url'
,
'introduce_image'
,
'show_width'
,
'show_height'
,
'open_type'
,
'open_type_app'
,
'platform_type'
,
'name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
,
'platform_id'
];
$data
=
Yii
::
$app
->
request
->
post
();
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
];
$name_arr
=
$data
[
'name'
];
$name
=
[];
foreach
(
$name_arr
as
$key
=>
$val
)
{
$name
[
$
lang
[
$key
]]
=
$val
;
foreach
(
Yii
::
$app
->
params
[
'lang'
]
as
$key
=>
$val
)
{
$name
[
$
val
]
=
isset
(
$name_arr
[
$val
])
?
$name_arr
[
$val
]
:
''
;
}
unset
(
$data
[
'name'
]);
$data
[
'name'
]
=
$name
;
...
...
@@ -104,21 +99,15 @@ class ApplicationController extends BaseController
$fields
=
[
'category_id'
,
'id'
,
'h5_icon'
,
'official_url'
,
'introduce_image'
,
'show_width'
,
'show_height'
,
'open_type'
,
'open_type_app'
,
'platform_type'
,
'name'
,
'sort'
,
'icon'
,
'type'
,
'native_url'
,
'native_login_url'
,
'h5_url'
,
'android_url'
,
'ios_url'
,
'app_store_url'
,
'advertise'
,
'description'
,
'redirect_type'
,
'platform_id'
];
$data
=
Yii
::
$app
->
request
->
post
();
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
];
$name_arr
=
$data
[
'name'
];
$name
=
[];
foreach
(
$name_arr
as
$key
=>
$val
)
{
$name
[
$
lang
[
$key
]]
=
$val
;
foreach
(
Yii
::
$app
->
params
[
'lang'
]
as
$key
=>
$val
)
{
$name
[
$
val
]
=
isset
(
$name_arr
[
$val
])
?
$name_arr
[
$val
]
:
''
;
}
unset
(
$data
[
'name'
]);
$data
[
'name'
]
=
$name
;
$data
[
'open_type_app'
]
=
(
0
==
$data
[
'open_type_app'
])
?
1
:
$data
[
'open_type_app'
];
#var_dump($data);exit;
$params
=
array_merge
(
$data
,
[
'platform_id'
=>
Yii
::
$app
->
user
->
identity
->
platform_id
]);
$params
=
$this
->
initParams
(
$params
,
$fields
);
$coin_applicateion_form
=
new
CoinApplicationForm
();
...
...
@@ -165,9 +154,10 @@ class ApplicationController extends BaseController
#echo json_encode($applicate);exit;
$applicate
[
'sort'
]
=
$app_cate
->
sort
;
$name_arr
=
json_decode
(
$applicate
[
'name'
],
true
);
$applicate
[
'name_ja'
]
=
$name_arr
[
'ja'
];
$applicate
[
'name_en'
]
=
$name_arr
[
'en-US'
];
$applicate
[
'name_zh'
]
=
$name_arr
[
'zh-CN'
];
$applicate
[
'name_ja'
]
=
isset
(
$name_arr
[
'ja'
])
?
$name_arr
[
'ja'
]
:
''
;
$applicate
[
'name_en'
]
=
isset
(
$name_arr
[
'en-US'
])
?
$name_arr
[
'en-US'
]
:
''
;
$applicate
[
'name_zh'
]
=
isset
(
$name_arr
[
'zh-CN'
])
?
$name_arr
[
'zh-CN'
]
:
''
;
$applicate
[
'name_ko'
]
=
isset
(
$name_arr
[
'ko'
])
?
$name_arr
[
'ko'
]
:
''
;
$this
->
layout
=
false
;
return
$this
->
render
(
'edit'
,
[
'item'
=>
$applicate
,
'category_id'
=>
$category_id
]);
}
...
...
backend/controllers/CoinController.php
View file @
ad55fa40
...
...
@@ -95,22 +95,18 @@ class CoinController extends BaseController
$data
[
'name'
]
=
strtoupper
(
trim
(
$data
[
'name'
]));
$data
[
'platform'
]
=
$data
[
'platform'
];
$data
[
'chain'
]
=
strtoupper
(
$data
[
'chain'
]);
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
,
'ko'
];
$nickname_arr
=
$data
[
'nickname'
];
$introduce_arr
=
$data
[
'introduce'
];
$nickname
=
[];
$introduce
=
[];
foreach
(
$nickname_arr
as
$key
=>
$val
)
{
$nickname
[
$
lang
[
$key
]]
=
trim
(
$val
)
;
foreach
(
Yii
::
$app
->
params
[
'lang'
]
as
$key
=>
$val
)
{
$nickname
[
$
val
]
=
isset
(
$nickname_arr
[
$val
])
?
$nickname_arr
[
$val
]
:
''
;
}
foreach
(
$introduce_arr
as
$key
=>
$val
)
{
$introduce
[
$
lang
[
$key
]]
=
$val
;
foreach
(
Yii
::
$app
->
params
[
'lang'
]
as
$key
=>
$val
)
{
$introduce
[
$
val
]
=
isset
(
$introduce_arr
[
$val
])
?
$introduce_arr
[
$val
]
:
''
;
}
unset
(
$data
[
'nickname'
]);
unset
(
$data
[
'introduce'
]);
$data
[
'nickname'
]
=
$nickname
;
...
...
@@ -168,21 +164,15 @@ class CoinController extends BaseController
$can
=
true
;
}
if
(
$can
)
{
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
,
'ko'
];
$nickname_arr
=
$data
[
'nickname'
];
$introduce_arr
=
$data
[
'introduce'
];
$nickname
=
[];
$introduce
=
[];
foreach
(
$nickname_arr
as
$key
=>
$val
)
{
$nickname
[
$
lang
[
$key
]]
=
$val
;
foreach
(
Yii
::
$app
->
params
[
'lang'
]
as
$key
=>
$val
)
{
$nickname
[
$
val
]
=
isset
(
$nickname_arr
[
$val
])
?
$nickname_arr
[
$val
]
:
''
;
}
foreach
(
$introduce_arr
as
$key
=>
$val
)
{
$introduce
[
$
lang
[
$key
]]
=
$val
;
foreach
(
Yii
::
$app
->
params
[
'lang'
]
as
$key
=>
$val
)
{
$introduce
[
$
val
]
=
isset
(
$introduce_arr
[
$val
])
?
$introduce_arr
[
$val
]
:
''
;
}
unset
(
$data
[
'nickname'
]);
$data
[
'nickname'
]
=
$nickname
;
...
...
backend/views/application-category/add.php
View file @
ad55fa40
...
...
@@ -21,7 +21,7 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
中文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[]"
required
lay-verify=
"required"
placeholder=
""
<input
class=
"layui-input"
name=
"name[
zh-CN
]"
required
lay-verify=
"required"
placeholder=
""
autocomplete=
"off"
value=
""
class=
"layui-input"
>
</div>
...
...
@@ -29,13 +29,19 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
英文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[]"
value=
""
>
<input
class=
"layui-input"
name=
"name[
en-US
]"
value=
""
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
日文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[]"
value=
""
>
<input
class=
"layui-input"
name=
"name[ja]"
value=
""
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
韩文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[ko]"
value=
""
>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
...
...
backend/views/application-category/edit.php
View file @
ad55fa40
...
...
@@ -21,19 +21,25 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
中文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[]"
value=
"
<?=
$model
[
'name_zh'
]
?>
"
>
<input
class=
"layui-input"
name=
"name[
zh-CN
]"
value=
"
<?=
$model
[
'name_zh'
]
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
英文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[]"
value=
"
<?=
$model
[
'name_en'
]
?>
"
>
<input
class=
"layui-input"
name=
"name[
en-US
]"
value=
"
<?=
$model
[
'name_en'
]
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
日文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[]"
value=
"
<?=
$model
[
'name_ja'
]
?>
"
>
<input
class=
"layui-input"
name=
"name[ja]"
value=
"
<?=
$model
[
'name_ja'
]
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
韩文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"name[ko]"
value=
"
<?=
$model
[
'name_ko'
]
?>
"
>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
...
...
backend/views/application/add.php
View file @
ad55fa40
...
...
@@ -48,19 +48,25 @@
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
中文名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name[]"
value=
""
lay-verify=
"required"
>
<input
class=
"layui-input"
name=
"name[
zh-CN
]"
value=
""
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
英文名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name[]"
value=
""
lay-verify=
"required"
>
<input
class=
"layui-input"
name=
"name[
en-US
]"
value=
""
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
日文名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name[]"
value=
""
lay-verify=
"required"
>
<input
class=
"layui-input"
name=
"name[ja]"
value=
""
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
韩文名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name[ko]"
value=
""
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
backend/views/application/edit.php
View file @
ad55fa40
...
...
@@ -51,19 +51,25 @@
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
中文名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name[]"
value=
"
<?=
$item
[
'name_zh'
]
?>
"
lay-verify=
"required"
>
<input
class=
"layui-input"
name=
"name[
zh-CN
]"
value=
"
<?=
$item
[
'name_zh'
]
?>
"
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
英文名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name[]"
value=
"
<?=
$item
[
'name_en'
]
?>
"
lay-verify=
"required"
>
<input
class=
"layui-input"
name=
"name[
en-US
]"
value=
"
<?=
$item
[
'name_en'
]
?>
"
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
日文名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name[]"
value=
"
<?=
$item
[
'name_ja'
]
?>
"
lay-verify=
"required"
>
<input
class=
"layui-input"
name=
"name[ja]"
value=
"
<?=
$item
[
'name_ja'
]
?>
"
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
韩文名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name[ko]"
value=
"
<?=
$item
[
'name_ko'
]
?>
"
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
backend/views/coin/add.php
View file @
ad55fa40
...
...
@@ -34,19 +34,25 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
中文名
</label>
<div
class=
"layui-input-block"
style=
"width: 190px"
>
<input
class=
"layui-input"
name=
"nickname[]"
value=
"
<?=
$model
->
nickname
[
'zh-CN'
]
?>
"
>
<input
class=
"layui-input"
name=
"nickname[
zh-CN
]"
value=
"
<?=
$model
->
nickname
[
'zh-CN'
]
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
英文名
</label>
<div
class=
"layui-input-block"
style=
"width: 190px"
>
<input
class=
"layui-input"
name=
"nickname[]"
value=
"
<?=
$model
->
nickname
[
'en-US'
]
?>
"
>
<input
class=
"layui-input"
name=
"nickname[
en-US
]"
value=
"
<?=
$model
->
nickname
[
'en-US'
]
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
日文名
</label>
<div
class=
"layui-input-block"
style=
"width: 190px"
>
<input
class=
"layui-input"
name=
"nickname[]"
value=
"
<?=
$model
->
nickname
[
'ja'
]
?>
"
>
<input
class=
"layui-input"
name=
"nickname[ja]"
value=
"
<?=
$model
->
nickname
[
'ja'
]
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
韩文名
</label>
<div
class=
"layui-input-block"
style=
"width: 190px"
>
<input
class=
"layui-input"
name=
"nickname[ko]"
value=
"
<?=
$model
->
nickname
[
'ko'
]
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
@@ -135,19 +141,25 @@
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
中文介绍
</label>
<div
class=
"layui-input-block"
>
<textarea
class=
"layui-textarea"
name=
"introduce[]"
>
<?=
$model
->
introduce
[
'zh-CN'
]
?>
</textarea>
<textarea
class=
"layui-textarea"
name=
"introduce[
zh-CN
]"
>
<?=
$model
->
introduce
[
'zh-CN'
]
?>
</textarea>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
英文介绍
</label>
<div
class=
"layui-input-block"
>
<textarea
class=
"layui-textarea"
name=
"introduce[]"
>
<?=
$model
->
introduce
[
'en-US'
]
?>
</textarea>
<textarea
class=
"layui-textarea"
name=
"introduce[
en-US
]"
>
<?=
$model
->
introduce
[
'en-US'
]
?>
</textarea>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
日文介绍
</label>
<div
class=
"layui-input-block"
>
<textarea
class=
"layui-textarea"
name=
"introduce[]"
>
<?=
$model
->
introduce
[
'ja'
]
?>
</textarea>
<textarea
class=
"layui-textarea"
name=
"introduce[ja]"
>
<?=
$model
->
introduce
[
'ja'
]
?>
</textarea>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
韩文介绍
</label>
<div
class=
"layui-input-block"
>
<textarea
class=
"layui-textarea"
name=
"introduce[ko]"
>
<?=
$model
->
introduce
[
'ko'
]
?>
</textarea>
</div>
</div>
<div
class=
"layui-inline"
>
...
...
backend/views/coin/edit.php
View file @
ad55fa40
...
...
@@ -34,19 +34,25 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
中文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"nickname[
]"
value=
"
<?=
$model
->
nickname
[
'zh-CN'
]
?>
"
>
<input
class=
"layui-input"
name=
"nickname[
zh-CN]"
value=
"
<?=
isset
(
$model
->
nickname
[
'zh-CN'
])
?
$model
->
nickname
[
'zh-CN'
]
:
''
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
英文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"nickname[
]"
value=
"
<?=
$model
->
nickname
[
'en-US'
]
?>
"
>
<input
class=
"layui-input"
name=
"nickname[
en-US]"
value=
"
<?=
isset
(
$model
->
nickname
[
'en-US'
])
?
$model
->
nickname
[
'en-US'
]
:
''
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
日文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"nickname[]"
value=
"
<?=
$model
->
nickname
[
'ja'
]
?>
"
>
<input
class=
"layui-input"
name=
"nickname[ja]"
value=
"
<?=
isset
(
$model
->
nickname
[
'ja'
])
?
$model
->
nickname
[
'ja'
]
:
''
?>
"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
韩文名
</label>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"nickname[ko]"
value=
"
<?=
isset
(
$model
->
nickname
[
'ko'
])
?
$model
->
nickname
[
'ko'
]
:
''
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
@@ -141,19 +147,25 @@
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
中文介绍
</label>
<div
class=
"layui-input-block"
>
<textarea
class=
"layui-textarea"
name=
"introduce[
]"
>
<?=
$model
->
introduce
[
'zh-CN'
]
?>
</textarea>
<textarea
class=
"layui-textarea"
name=
"introduce[
zh-CN]"
>
<?=
isset
(
$model
->
introduce
[
'zh-CN'
])
?
$model
->
introduce
[
'zh-CN'
]
:
''
?>
</textarea>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
英文介绍
</label>
<div
class=
"layui-input-block"
>
<textarea
class=
"layui-textarea"
name=
"introduce[
]"
>
<?=
$model
->
introduce
[
'en-US'
]
?>
</textarea>
<textarea
class=
"layui-textarea"
name=
"introduce[
en-US]"
>
<?=
isset
(
$model
->
introduce
[
'en-US'
])
?
$model
->
introduce
[
'en-US'
]
:
''
?>
</textarea>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
日文介绍
</label>
<div
class=
"layui-input-block"
>
<textarea
class=
"layui-textarea"
name=
"introduce[]"
>
<?=
$model
->
introduce
[
'ja'
]
?>
</textarea>
<textarea
class=
"layui-textarea"
name=
"introduce[ja]"
>
<?=
isset
(
$model
->
introduce
[
'ja'
])
?
$model
->
introduce
[
'ja'
]
:
''
?>
</textarea>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
韩文介绍
</label>
<div
class=
"layui-input-block"
>
<textarea
class=
"layui-textarea"
name=
"introduce[ko]"
>
<?=
isset
(
$model
->
introduce
[
'ko'
])
?
$model
->
introduce
[
'ko'
]
:
''
?>
</textarea>
</div>
</div>
<div
class=
"layui-inline"
>
...
...
common/models/psources/CoinCurrency.php
0 → 100644
View file @
ad55fa40
<?php
namespace
common\models\psources
;
use
Yii
;
use
common\core\BaseActiveRecord
;
class
CoinCurrency
extends
BaseActiveRecord
{
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'p_sources'
);
}
public
static
function
tableName
()
{
return
'{{coin_currency}}'
;
}
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
public
function
rules
()
{
return
[
[[
'pj_id'
,
'pj_name'
],
'required'
],
[[
'pj_symbol'
,
'lang'
],
'safe'
],
[[
'platform_id'
,
'currency_id'
],
'integer'
],
];
}
public
function
attributeLabels
()
{
return
[
'platform_id'
=>
'钱包Id'
,
'currency_id'
=>
'货币Id'
,
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'pj_id'
,
'pj_name'
,
'pj_symbol'
,
'lang'
],
self
::
SCENARIOS_UPDATE
=>
[
'id'
,
'pj_id'
,
'pj_name'
,
'pj_symbol'
,
'lang'
],
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
}
\ No newline at end of file
common/models/psources/CoinPlatform.php
View file @
ad55fa40
...
...
@@ -85,4 +85,13 @@ class CoinPlatform extends BaseActiveRecord
return
$this
->
hasOne
(
CoinPlatformWithHold
::
className
(),
[
'id'
=>
'chain_id'
]);
}
public
function
getGas
()
{
return
$this
->
hasOne
(
CoinSupportedCoin
::
className
(),
[
'id'
=>
'charge_unit_id'
]);
}
public
function
getCurrency
()
{
return
$this
->
hasMany
(
CoinSupportedCurrency
::
className
(),
[
'platform_id'
=>
'id'
]);
}
}
common/models/psources/CoinSupportedCurrency.php
0 → 100644
View file @
ad55fa40
<?php
namespace
common\models\psources
;
use
Yii
;
use
common\core\BaseActiveRecord
;
class
CoinSupportedCurrency
extends
BaseActiveRecord
{
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'p_sources'
);
}
public
static
function
tableName
()
{
return
'{{coin_supported_currency}}'
;
}
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
public
function
rules
()
{
return
[
[[
'platform_id'
,
'currency_id'
],
'required'
],
[[
'platform_id'
,
'currency_id'
,
'sort'
],
'integer'
],
];
}
public
function
attributeLabels
()
{
return
[
'platform_id'
=>
'钱包Id'
,
'currency_id'
=>
'货币Id'
,
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'platform_id'
,
'currency_id'
,
'sort'
],
self
::
SCENARIOS_UPDATE
=>
[
'id'
,
'platform_id'
,
'currency_id'
,
'sort'
],
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
public
function
attributes
()
{
return
array_merge
(
parent
::
attributes
(),
[
'pj_id'
,
'pj_name'
,
'pj_symbol'
,
'rate'
]);
}
public
function
getCurrency
()
{
return
$this
->
hasOne
(
CoinCurrency
::
className
(),
[
'id'
=>
'currency_id'
]);
}
public
static
function
loadArray
(
array
$data
)
{
return
self
::
getDb
()
->
createCommand
()
->
batchInsert
(
self
::
tableName
(),
[
'platform_id'
,
'currency_id'
],
$data
)
->
execute
();
}
}
\ No newline at end of file
console/controllers/TickerController.php
View file @
ad55fa40
...
...
@@ -2,13 +2,12 @@
namespace
console\controllers
;
use
common\business\Chain33Business
;
use
common\models\psources\CoinGameBet
;
use
common\service\chain33\Chain33Service
;
use
common\service\exchange\ExchangeBuilderFactory
;
use
common\service\exchange\ExchangeFactory
;
use
yii\console\Controller
;
use
Yii
;
use
linslin\yii2\curl\Curl
;
use
yii\console\Controller
;
use
voku\helper\HtmlDomParser
;
use
common\models\psources\CoinSupportedCurrency
;
use
common\service\exchange\ExchangeBuilderFactory
;
class
TickerController
extends
Controller
{
...
...
@@ -22,7 +21,7 @@ class TickerController extends Controller
$ticker_builder
->
TickerSort
();
});
}
echo
date
(
'Y-m-d H:i:s'
)
.
'排序更新成功'
.
PHP_EOL
;
echo
date
(
'Y-m-d H:i:s'
)
.
'排序更新成功'
.
PHP_EOL
;
return
0
;
}
...
...
@@ -30,7 +29,36 @@ class TickerController extends Controller
{
$ticker_builder
=
ExchangeBuilderFactory
::
create
(
'Huobi'
);
$ticker_builder
->
hotTickerUpdate
();
echo
date
(
'Y-m-d H:i:s'
)
.
'更新成功'
.
PHP_EOL
;
echo
date
(
'Y-m-d H:i:s'
)
.
'更新成功'
.
PHP_EOL
;
return
0
;
}
public
function
actionCurrency
()
{
$currency_model
=
CoinSupportedCurrency
::
find
()
->
groupBy
(
'currency_id'
)
->
all
();
$curl
=
new
Curl
();
foreach
(
$currency_model
as
$val
)
{
go
(
function
()
use
(
$val
,
$curl
)
{
\Co
::
sleep
(
0.5
);
$response
=
$curl
->
setPostParams
([
'erectDate'
=>
''
,
'nothing'
=>
''
,
'pjname'
=>
$val
->
currency
->
pj_id
])
->
post
(
'http://srh.bankofchina.com/search/whpj/search.jsp'
);
$response
=
iconv
(
'UTF-8'
,
'GBK//TRANSLIT'
,
$response
);
$html
=
HtmlDomParser
::
str_get_html
(
$response
);
$div
=
(
$html
->
find
(
'div.BOC_main'
));
foreach
(
$div
->
find
(
'td'
)
as
$key
=>
$e
)
{
if
(
$key
==
5
)
{
$key
=
'quotation_boc_'
.
'CNY_'
.
$val
->
currency
->
symbol
;
$currency
=
rtrim
(
sprintf
(
'%.6f'
,
1
/
(
$e
->
innertext
/
100
)),
'0'
);
Yii
::
$app
->
redis_currency
->
hmset
(
$key
,
'low'
,
$currency
,
'high'
,
$currency
,
'last'
,
$currency
,
'open'
,
$currency
);
}
}
});
}
echo
date
(
'Y-m-d H:i:s'
)
.
'计价货币更新成功'
.
PHP_EOL
;
return
0
;
}
}
\ No newline at end of file
wallet/controllers/WalletController.php
View file @
ad55fa40
...
...
@@ -2,11 +2,13 @@
namespace
wallet\controllers
;
use
common\service\trusteeship\TrusteeShipService
;
use
Yii
;
use
common\models\Admin
;
use
yii\helpers\ArrayHelper
;
use
wallet\base\BaseController
;
use
common\models\psources\CoinPlatform
;
use
common\models\psources\CoinCurrency
;
use
common\models\psources\CoinSupportedCurrency
;
use
common\service\trusteeship\TrusteeShipService
;
class
WalletController
extends
BaseController
{
...
...
@@ -27,16 +29,16 @@ class WalletController extends BaseController
public
function
actionWalletBallance
()
{
$current_platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
1
===
$current_platform_id
)
{
if
(
1
===
$current_platform_id
)
{
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
1
);
$platform_id
=
empty
(
$platform_id
)
?
1
:
$platform_id
;
}
else
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
}
if
(
!
isset
(
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
]))
{
if
(
!
isset
(
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
]))
{
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
'此钱包节点尚未开通'
];
}
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$type
=
Yii
::
$app
->
request
->
get
(
'type'
,
1
);
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
...
...
@@ -71,7 +73,7 @@ class WalletController extends BaseController
public
function
actionUserAsset
()
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$uid
=
Yii
::
$app
->
request
->
get
(
'uid'
,
''
);
$params
=
[
'uid'
=>
$uid
...
...
@@ -96,4 +98,126 @@ class WalletController extends BaseController
return
[
'code'
=>
1
,
'data'
=>
$result
[
'msg'
],
'msg'
=>
'success'
];
}
public
function
actionCurrency
()
{
$code
=
0
;
$msg
=
'success'
;
$data
=
null
;
if
(
Yii
::
$app
->
request
->
isGet
)
{
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
0
);
if
(
false
==
$platform_id
)
{
$msg
=
'参数错误'
;
$code
=
-
1
;
goto
doEnd
;
}
$coin_currency
=
CoinCurrency
::
find
()
->
select
(
'id, pj_name, pj_symbol'
)
->
asArray
()
->
all
();
$coin_supported_currency
=
CoinSupportedCurrency
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
asArray
()
->
all
();
$coin_supported_currency_id
=
ArrayHelper
::
getColumn
(
$coin_supported_currency
,
'currency_id'
);
foreach
(
$coin_currency
as
&
$val
)
{
$val
[
'checked'
]
=
false
;
if
(
in_array
(
$val
[
"id"
],
$coin_supported_currency_id
))
{
$val
[
'checked'
]
=
true
;
}
}
$data
=
$coin_currency
;
goto
doEnd
;
}
if
(
Yii
::
$app
->
request
->
isPost
)
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
1
!=
$platform_id
)
{
$msg
=
'权限未开通'
;
$code
=
-
1
;
goto
doEnd
;
}
$params
=
Yii
::
$app
->
request
->
post
();
$platform_id
=
isset
(
$params
[
'platform_id'
])
?
$params
[
'platform_id'
]
:
null
;
$currency_id
=
isset
(
$params
[
'currency_id'
])
?
$params
[
'currency_id'
]
:
null
;
$sort
=
isset
(
$params
[
'sort'
])
?
$params
[
'sort'
]
:
1
;
$datas
=
[
'platform_id'
=>
$platform_id
,
'currency_id'
=>
$currency_id
,
'sort'
=>
$sort
];
$isExist
=
CoinSupportedCurrency
::
find
()
->
where
([
'platform_id'
=>
$platform_id
,
'currency_id'
=>
$currency_id
])
->
one
();
if
(
false
!=
$isExist
)
{
$msg
=
'记录已存在'
;
$code
=
-
1
;
goto
doEnd
;
}
$model
=
new
CoinSupportedCurrency
();
$model
->
setScenario
(
CoinSupportedCurrency
::
SCENARIOS_CREATE
);
$model
->
load
(
$datas
,
''
);
if
(
!
$model
->
validate
())
{
$msg
=
$model
->
errors
;
$code
=
-
1
;
goto
doEnd
;
}
$model
->
save
();
goto
doEnd
;
}
if
(
Yii
::
$app
->
request
->
isPut
)
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
1
!=
$platform_id
)
{
$msg
=
'权限未开通'
;
$code
=
-
1
;
goto
doEnd
;
}
$params
=
Yii
::
$app
->
request
->
post
();
$id
=
isset
(
$params
[
'id'
])
?
$params
[
'id'
]
:
null
;
$platform_id
=
isset
(
$params
[
'platform_id'
])
?
$params
[
'platform_id'
]
:
null
;
$currency_id
=
isset
(
$params
[
'currency_id'
])
?
$params
[
'currency_id'
]
:
null
;
$sort
=
isset
(
$params
[
'sort'
])
?
$params
[
'sort'
]
:
1
;
$datas
=
[
'platform_id'
=>
$platform_id
,
'currency_id'
=>
$currency_id
,
'sort'
=>
$sort
,
'id'
=>
$id
];
$model
=
CoinSupportedCurrency
::
find
()
->
where
([
'id'
=>
$id
])
->
one
();
if
(
false
==
$model
)
{
$msg
=
'记录未存在'
;
$code
=
-
1
;
goto
doEnd
;
}
$model
->
setScenario
(
CoinSupportedCurrency
::
SCENARIOS_UPDATE
);
$model
->
load
(
$datas
,
''
);
if
(
!
$model
->
validate
())
{
$msg
=
$model
->
errors
;
$code
=
-
1
;
goto
doEnd
;
}
$model
->
save
();
goto
doEnd
;
}
if
(
Yii
::
$app
->
request
->
isDelete
)
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
1
!=
$platform_id
)
{
$msg
=
'权限未开通'
;
$code
=
-
1
;
goto
doEnd
;
}
$params
=
Yii
::
$app
->
request
->
get
();
$id
=
isset
(
$params
[
'id'
])
?
$params
[
'id'
]
:
null
;
$model
=
CoinSupportedCurrency
::
find
()
->
where
([
'id'
=>
$id
])
->
one
();
if
(
false
==
$model
)
{
$msg
=
'记录未存在'
;
$code
=
-
1
;
goto
doEnd
;
}
$model
->
delete
();
goto
doEnd
;
}
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
\ No newline at end of file
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