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
fe28e0a0
Commit
fe28e0a0
authored
Jun 06, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/sakura' into 'master'
Feature/sakura See merge request
!30
parents
835f3927
4b284e19
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
126 additions
and
11 deletions
+126
-11
BaseController.php
api/base/BaseController.php
+18
-0
CoinController.php
api/controllers/CoinController.php
+16
-1
CoinController.php
backend/controllers/CoinController.php
+36
-0
add.php
backend/views/coin/add.php
+28
-4
edit.php
backend/views/coin/edit.php
+28
-4
index.js
backend/web/js/coin/index.js
+0
-2
No files found.
api/base/BaseController.php
View file @
fe28e0a0
...
...
@@ -15,6 +15,24 @@ class BaseController extends Controller
public
$start
;
public
$end
;
public
$header_list
=
[];
public
$lang
;
private
static
$default_header_list
=
[];
public
function
init
()
{
if
(
'cli'
!==
php_sapi_name
()){
$this
->
header_list
=
self
::
$default_header_list
;
$this
->
fzmCrossHeader
();
}
}
public
function
fzmCrossHeader
()
{
$this
->
lang
=
\Yii
::
$app
->
request
->
headers
->
get
(
'lang'
)
??
'zh-CN'
;
}
public
function
beforeAction
(
$action
)
{
$this
->
start
=
microtime
(
true
);
...
...
api/controllers/CoinController.php
View file @
fe28e0a0
...
...
@@ -39,7 +39,12 @@ class CoinController extends BaseController
if
(
$id
)
{
$ret
=
CoinBusiness
::
getCoinAllById
(
$id
);
if
(
$ret
)
{
return
$ret
[
0
];
$data
=
$ret
[
0
];
$nickname
=
json_decode
(
$data
[
'nickname'
],
true
);
$introduce
=
json_decode
(
$data
[
'introduce'
],
true
);
$data
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
$data
[
'introduce'
]
=
$introduce
[
$this
->
lang
];
return
$data
;
}
}
return
[];
...
...
@@ -134,6 +139,10 @@ class CoinController extends BaseController
$coin_ids
=
array_column
(
$coin_recommends
,
'cid'
);
//获取币种信息
$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
];
}
//获取行情信息
$coin_names
=
array_column
(
$coin_infos
,
'name'
);
$coin_names
=
array_merge
(
$coin_names
,
array_column
(
$coin_infos
,
'chain'
));
...
...
@@ -231,6 +240,8 @@ class CoinController extends BaseController
$chain_quotation
[
$value
]
=
ExchangeBusiness
::
getquatation
(
$value
);
}
foreach
(
$result
[
'data'
]
as
$key
=>
&
$value
)
{
$nickname
=
json_decode
(
$value
[
'nickname'
],
true
);
$value
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
$value
[
'chain_quotation'
]
=
$chain_quotation
[
$value
[
'chain'
]]
?:
null
;
}
return
$result
;
...
...
@@ -279,6 +290,10 @@ class CoinController extends BaseController
foreach
(
$result
as
$key
=>
$value
)
{
$result
[
$key
][
'chain_quotation'
]
=
$chain_quotation
[
$value
[
'chain'
]]
?:
null
;
}
foreach
(
$result
as
$key
=>
&
$value
)
{
$nickname
=
json_decode
(
$value
[
'nickname'
],
true
);
$value
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
}
return
[
'code'
=>
0
,
'count'
=>
$total
,
'data'
=>
$result
];
}
}
...
...
backend/controllers/CoinController.php
View file @
fe28e0a0
...
...
@@ -92,6 +92,24 @@ class CoinController extends BaseController
$data
[
'name'
]
=
strtoupper
(
$data
[
'name'
]);
$data
[
'platform'
]
=
strtolower
(
$data
[
'platform'
]);
$data
[
'chain'
]
=
strtoupper
(
$data
[
'chain'
]);
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
];
$nickname_arr
=
$data
[
'nickname'
];
$introduce_arr
=
$data
[
'introduce'
];
$nickname
=
[];
$introduce
=
[];
foreach
(
$nickname_arr
as
$key
=>
$val
){
$nickname
[
$lang
[
$key
]]
=
$val
;
}
foreach
(
$introduce_arr
as
$key
=>
$val
){
$introduce
[
$lang
[
$key
]]
=
$val
;
}
unset
(
$data
[
'nickname'
]);
$data
[
'nickname'
]
=
$nickname
;
$data
[
'introduce'
]
=
$introduce
;
$result
=
$coin
->
addOne
(
$data
);
if
(
$result
===
true
)
{
$this
->
success
(
'添加成功'
,
'/admin/coin/index'
);
...
...
@@ -142,6 +160,24 @@ class CoinController extends BaseController
$can
=
true
;
}
if
(
$can
)
{
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
];
$nickname_arr
=
$data
[
'nickname'
];
$introduce_arr
=
$data
[
'introduce'
];
$nickname
=
[];
$introduce
=
[];
foreach
(
$nickname_arr
as
$key
=>
$val
){
$nickname
[
$lang
[
$key
]]
=
$val
;
}
foreach
(
$introduce_arr
as
$key
=>
$val
){
$introduce
[
$lang
[
$key
]]
=
$val
;
}
unset
(
$data
[
'nickname'
]);
$data
[
'nickname'
]
=
$nickname
;
$data
[
'introduce'
]
=
$introduce
;
$coin
=
Yii
::
createObject
(
Coin
::
className
());
$result
=
$coin
->
updateOne
(
$data
);
if
(
$result
===
true
)
{
...
...
backend/views/coin/add.php
View file @
fe28e0a0
...
...
@@ -25,8 +25,20 @@
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
中文名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"nickname"
value=
"
<?=
$model
->
nickname
?>
"
>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"nickname[]"
value=
"
<?=
$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'
]
?>
"
>
</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'
]
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
@@ -113,9 +125,21 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
介绍
</label>
<label
class=
"layui-form-label"
>
中文介绍
</label>
<div
class=
"layui-input-block"
>
<textarea
class=
"layui-textarea"
name=
"introduce[]"
>
<?=
$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>
</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
?>
</textarea>
<textarea
class=
"layui-textarea"
name=
"introduce
[]"
>
<?=
$model
->
introduce
[
'ja'
]
?>
</textarea>
</div>
</div>
<div
class=
"layui-inline"
>
...
...
backend/views/coin/edit.php
View file @
fe28e0a0
...
...
@@ -25,8 +25,20 @@
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
中文名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"nickname"
value=
"
<?=
$model
->
nickname
?>
"
>
<div
class=
"layui-input-block"
style=
"width: 250px"
>
<input
class=
"layui-input"
name=
"nickname[]"
value=
"
<?=
$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'
]
?>
"
>
</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'
]
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
@@ -117,9 +129,21 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
介绍
</label>
<label
class=
"layui-form-label"
>
中文介绍
</label>
<div
class=
"layui-input-block"
>
<textarea
class=
"layui-textarea"
name=
"introduce[]"
>
<?=
$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>
</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
?>
</textarea>
<textarea
class=
"layui-textarea"
name=
"introduce
[]"
>
<?=
$model
->
introduce
[
'ja'
]
?>
</textarea>
</div>
</div>
<div
class=
"layui-inline"
>
...
...
backend/web/js/coin/index.js
View file @
fe28e0a0
...
...
@@ -14,9 +14,7 @@ var tableIns = table.render({
cols
:
[[
{
field
:
'id'
,
title
:
'ID'
},
{
field
:
'name'
,
title
:
'名称'
},
{
field
:
'nickname'
,
title
:
'别名'
},
{
field
:
'icon'
,
title
:
'图标'
,
templet
:
"#iconTpl"
},
{
field
:
'introduce'
,
title
:
'介绍'
},
{
field
:
'official'
,
title
:
'官网'
,
templet
:
"#officialTpl"
},
{
field
:
'paper'
,
title
:
'白皮书'
,
templet
:
"#paperTpl"
},
{
field
:
'platform'
,
title
:
'平台'
},
...
...
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