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
3132db87
Commit
3132db87
authored
Aug 16, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into 'master'
货币对管理 See merge request
!88
parents
ccc3f167
e5a57ee8
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
836 additions
and
1 deletion
+836
-1
SupportedSymbolController.php
api/controllers/SupportedSymbolController.php
+33
-0
IndexAsset.php
backend/assets/coinPlatformWithhold/IndexAsset.php
+18
-0
IndexAsset.php
backend/assets/coinSupportedSymbol/IndexAsset.php
+25
-0
CoinPlatformWithholdController.php
backend/controllers/CoinPlatformWithholdController.php
+92
-0
CoinSupportedSymbolController.php
backend/controllers/CoinSupportedSymbolController.php
+84
-0
CoinPlatformWithholdForm.php
backend/models/coin/CoinPlatformWithholdForm.php
+39
-0
CoinSupportedSymbolForm.php
backend/models/coin/CoinSupportedSymbolForm.php
+52
-0
add.php
backend/views/coin-platform-withhold/add.php
+95
-0
edit.php
backend/views/coin-platform-withhold/edit.php
+44
-0
index.php
backend/views/coin-platform-withhold/index.php
+27
-0
add.php
backend/views/coin-supported-symbol/add.php
+24
-0
edit.php
backend/views/coin-supported-symbol/edit.php
+65
-0
index.php
backend/views/coin-supported-symbol/index.php
+36
-0
index.js
backend/web/js/coin-platform-withhold/index.js
+67
-0
index.js
backend/web/js/coin-supported-symbol/index.js
+45
-0
CoinPlatformWithHold.php
common/models/psources/CoinPlatformWithHold.php
+51
-1
CoinSupportedSymbol.php
common/models/psources/CoinSupportedSymbol.php
+39
-0
No files found.
api/controllers/SupportedSymbolController.php
0 → 100644
View file @
3132db87
<?php
namespace
api\controllers
;
use
api\base\BaseController
;
use
common\models\psources\CoinAirDropTrade
;
use
common\models\psources\CoinSupportedSymbol
;
use
common\service\chain33\Chain33Service
;
use
Yii
;
class
SupportedSymbolController
extends
BaseController
{
public
function
actionSearch
()
{
$platform_withhold_id
=
Yii
::
$app
->
request
->
get
(
'id'
,
''
);
if
(
empty
(
$platform_withhold_id
))
{
$msg
=
'参数不能为空'
;
$code
=
-
1
;
$data
=
null
;
goto
doEnd
;
}
$coinSupportedSymbol
=
CoinSupportedSymbol
::
find
()
->
select
(
'symbol'
)
->
where
([
'platform_withhold_id'
=>
$platform_withhold_id
])
->
asArray
()
->
all
();
$data
=
array_column
(
$coinSupportedSymbol
,
'symbol'
);
$code
=
0
;
$msg
=
'success'
;
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
\ No newline at end of file
backend/assets/coinPlatformWithhold/IndexAsset.php
0 → 100644
View file @
3132db87
<?php
namespace
backend\assets\coinPlatformWithhold
;
use
yii\web\AssetBundle
;
use
yii\web\View
;
class
IndexAsset
extends
AssetBundle
{
public
$sourcePath
=
'@backend/web/js/coin-platform-withhold'
;
public
$js
=
[
'index.js'
,
];
public
$jsOptions
=
[
'position'
=>
View
::
POS_END
,
];
}
\ No newline at end of file
backend/assets/coinSupportedSymbol/IndexAsset.php
0 → 100644
View file @
3132db87
<?php
/**
* Created By Sublime Text 3
*
* @authors rlgy <rlgyzhcn@qq.com>
* @date 2018-09-07 17:41:04
*/
namespace
backend\assets\coinSupportedSymbol
;
use
yii\web\AssetBundle
;
use
yii\web\View
;
class
IndexAsset
extends
AssetBundle
{
public
$sourcePath
=
'@backend/web/js/coin-supported-symbol'
;
public
$js
=
[
'index.js'
,
];
public
$jsOptions
=
[
'position'
=>
View
::
POS_END
,
];
}
\ No newline at end of file
backend/controllers/CoinPlatformWithholdController.php
0 → 100644
View file @
3132db87
<?php
namespace
backend\controllers
;
use
backend\models\coin\CoinPlatformWithholdForm
;
use
common\models\psources\CoinPlatformWithHold
;
use
Yii
;
class
CoinPlatformWithholdController
extends
BaseController
{
public
function
actionIndex
()
{
if
(
Yii
::
$app
->
request
->
isAjax
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$page
=
$request
->
get
(
'page'
,
1
);
$limit
=
$request
->
get
(
'limit'
,
10
);
$platform
=
$request
->
get
(
'platform'
,
''
);
$where
=
[];
if
(
$platform
)
{
$where
[]
=
[
'platform'
=>
$platform
];
}
$data
=
CoinPlatformWithHold
::
getList
(
$page
,
$limit
,
$where
);
return
$data
;
}
return
$this
->
render
(
'index'
);
}
public
function
actionAdd
()
{
$model
=
new
CoinPlatformWithholdForm
();
$model
->
scenario
=
'add'
;
if
(
Yii
::
$app
->
request
->
isPost
)
{
$data
=
Yii
::
$app
->
request
->
post
();
if
(
$model
->
load
(
$data
,
''
)
&&
$model
->
validate
())
{
$coin
=
Yii
::
createObject
(
CoinPlatformWithHold
::
className
());
$result
=
$coin
->
addOne
(
$data
);
if
(
$result
===
true
)
{
$this
->
success
(
'添加成功'
,
'/admin/coin-platform-withhold/index'
);
}
}
//表单验证失败
$errors
=
$model
->
errors
;
if
(
$errors
)
{
foreach
(
$errors
as
$key
=>
$item
)
{
$errors
=
$item
[
0
];
break
;
}
}
elseif
(
isset
(
$result
)
&&
$result
[
'code'
]
!=
0
)
{
$errors
=
$result
[
'message'
];
}
$this
->
error
(
$errors
,
Yii
::
$app
->
request
->
getReferrer
());
}
return
$this
->
render
(
'add'
,
[
'model'
=>
$model
]);
}
public
function
actionEdit
()
{
if
(
Yii
::
$app
->
request
->
isPost
)
{
$model
=
new
CoinPlatformWithholdForm
();
$model
->
scenario
=
'update'
;
$data
=
Yii
::
$app
->
request
->
post
();
Yii
::
$app
->
response
->
format
=
'json'
;
if
(
$model
->
load
(
$data
,
''
)
&&
$model
->
validate
())
{
$coin
=
Yii
::
createObject
(
CoinPlatformWithHold
::
className
());
$result
=
$coin
->
updateOne
(
$data
);
if
(
$result
===
true
)
{
return
[
'code'
=>
0
,
'msg'
=>
'succeed'
];
}
}
$errors
=
$model
->
errors
;
if
(
$errors
)
{
foreach
(
$errors
as
$key
=>
$item
)
{
$errors
=
$item
[
0
];
break
;
}
}
elseif
(
isset
(
$result
)
&&
$result
[
'code'
]
!=
0
)
{
$errors
=
$result
[
'message'
];
}
return
[
'code'
=>
1
,
'msg'
=>
$errors
];
}
elseif
(
Yii
::
$app
->
request
->
isGet
)
{
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
null
);
if
(
$id
)
{
$coin
=
CoinPlatformWithHold
::
findOne
([
'id'
=>
$id
]);
$this
->
layout
=
false
;
return
$this
->
render
(
'edit'
,
[
'model'
=>
$coin
]);
}
}
}
}
\ No newline at end of file
backend/controllers/CoinSupportedSymbolController.php
0 → 100644
View file @
3132db87
<?php
namespace
backend\controllers
;
use
backend\models\coin\CoinSupportedSymbolForm
;
use
common\models\psources\CoinSupportedSymbol
;
use
Yii
;
class
CoinSupportedSymbolController
extends
BaseController
{
public
function
actionList
()
{
$platform_withhold_id
=
Yii
::
$app
->
request
->
get
(
'id'
);
if
(
Yii
::
$app
->
request
->
isAjax
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$page
=
$request
->
get
(
'page'
,
1
);
$limit
=
$request
->
get
(
'limit'
,
10
);
$id
=
$request
->
get
(
'id'
,
''
);
$where
=
[];
if
(
$id
)
{
$where
[]
=
[
'platform_withhold_id'
=>
$id
];
}
$data
=
CoinSupportedSymbol
::
getList
(
$page
,
$limit
,
$where
);
$data
[
'code'
]
=
0
;
Yii
::
$app
->
response
->
format
=
'json'
;
return
$data
;
}
return
$this
->
render
(
'index'
,
[
'platform_withhold_id'
=>
$platform_withhold_id
]);
}
public
function
actionAdd
()
{
$model
=
new
CoinSupportedSymbolForm
();
$model
->
scenario
=
'add'
;
if
(
Yii
::
$app
->
request
->
isPost
)
{
$data
=
Yii
::
$app
->
request
->
post
();
if
(
$model
->
load
(
$data
,
''
)
&&
$model
->
validate
())
{
$coinSupportedSymbol
=
new
CoinSupportedSymbol
();
$coinSupportedSymbol
->
platform_withhold_id
=
$data
[
'platform_withhold_id'
];
$coinSupportedSymbol
->
symbol
=
$data
[
'symbol'
];
$result
=
$coinSupportedSymbol
->
save
();
if
(
$result
===
true
)
{
$this
->
success
(
'添加成功'
,
'/admin/coin-supported-symbol/list?id='
.
$data
[
'platform_withhold_id'
]);
}
}
//表单验证失败
$errors
=
$model
->
errors
;
if
(
$errors
)
{
foreach
(
$errors
as
$key
=>
$item
)
{
$errors
=
$item
[
0
];
break
;
}
}
elseif
(
isset
(
$result
)
&&
$result
[
'code'
]
!=
0
)
{
$errors
=
$result
[
'message'
];
}
$this
->
error
(
$errors
,
Yii
::
$app
->
request
->
getReferrer
());
}
$platform_withhold_id
=
Yii
::
$app
->
request
->
get
(
'platform_withhold_id'
);
return
$this
->
render
(
'add'
,
[
'model'
=>
$model
,
'platform_withhold_id'
=>
$platform_withhold_id
]);
}
public
function
actionDelete
()
{
Yii
::
$app
->
response
->
format
=
'json'
;
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
0
);
if
(
$id
)
{
$model
=
CoinSupportedSymbol
::
findOne
([
'id'
=>
$id
]);
if
(
$model
)
{
try
{
$model
->
delete
();
return
[
'code'
=>
0
,
'msg'
=>
'succeed'
];
}
catch
(
\Throwable
$t
)
{
return
[
'code'
=>
$t
->
getCode
(),
'msg'
=>
$t
->
getMessage
()];
}
}
}
return
[
'code'
=>
-
1
,
'msg'
=>
'删除失败'
];
}
}
\ No newline at end of file
backend/models/coin/CoinPlatformWithholdForm.php
0 → 100644
View file @
3132db87
<?php
namespace
backend\models\coin
;
use
yii\base\Model
;
class
CoinPlatformWithholdForm
extends
Model
{
public
$id
;
public
$platform
;
public
$address
;
public
$private_key
;
public
$exer
;
public
$fee
;
public
function
formName
()
{
return
''
;
}
public
function
rules
()
{
return
[
[[
'platform'
,
'address'
,
'private_key'
,
'exer'
,
'fee'
],
'required'
,
'on'
=>
'add'
],
[[
'id'
,
'platform'
,
'address'
,
'private_key'
,
'exer'
,
'fee'
],
'required'
,
'on'
=>
'update'
],
];
}
public
function
scenarios
()
{
return
[
'add'
=>
[
'platform'
,
'address'
,
'private_key'
,
'exer'
,
'fee'
],
'update'
=>
[
'id'
,
'platform'
,
'address'
,
'private_key'
,
'exer'
,
'fee'
],
];
}
}
\ No newline at end of file
backend/models/coin/CoinSupportedSymbolForm.php
0 → 100644
View file @
3132db87
<?php
namespace
backend\models\coin
;
use
yii\base\Model
;
class
CoinSupportedSymbolForm
extends
Model
{
public
$id
;
public
$platform_withhold_id
;
public
$symbol
;
public
function
formName
()
{
return
''
;
}
public
function
rules
()
{
return
[
[[
'platform_withhold_id'
,
'symbol'
],
'required'
,
'on'
=>
'add'
],
[[
'id'
,
'platform_withhold_id'
,
'symbol'
],
'required'
,
'on'
=>
'update'
],
];
}
public
function
attributeLabels
()
{
return
[
'id'
=>
'ID'
,
'platform_withhold_id'
=>
'对应链'
,
'symbol'
=>
'货币对'
,
];
}
public
function
scenarios
()
{
return
[
'add'
=>
[
'platform_withhold_id'
,
'symbol'
],
'update'
=>
[
'id'
,
'platform_withhold_id'
,
'symbol'
],
];
}
}
\ No newline at end of file
backend/views/coin-platform-withhold/add.php
0 → 100644
View file @
3132db87
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-5-31
* Time: 下午6:23
*/
?>
<h4>
添加应用分类
</h4>
<style>
.layui-form-label
{
width
:
100px
;
}
</style>
<div
class=
"layui-row"
style=
"padding: 5px;"
>
<div
class=
"layui-col-md12"
>
<form
class=
"layui-form"
method=
"post"
action=
""
id=
"application-category-edit"
>
<input
name=
"_csrf"
type=
"hidden"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
名称
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"platform"
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=
"address"
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
私钥
</label>
<div
class=
"layui-input-block"
style=
"width: auto"
>
<input
class=
"layui-input"
name=
"private_key"
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
执行器
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"exer"
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
手续费
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"fee"
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<button
class=
"layui-btn"
>
提交
</button>
</div>
</form>
</div>
</div>
<script>
var
laydate
=
layui
.
laydate
;
laydate
.
render
({
elem
:
"#time1"
});
//图片上传
var
uploader
=
layui
.
upload
;
$_csrf
=
$
(
"input[name='_csrf']"
).
val
();
uploader
.
render
({
elem
:
"#upload1"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
)
{
$
(
"input[name='icon']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon1"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
uploader
.
render
({
elem
:
"#upload2"
,
url
:
'/admin/image/upload'
,
data
:
{
_csrf
:
$_csrf
,
image_type
:
2
},
done
:
function
(
res
)
{
if
(
res
.
code
==
0
)
{
$
(
"input[name='banner']"
).
val
(
res
.
data
.
image_id
);
$
(
"#icon2"
).
attr
(
'src'
,
res
.
data
.
image_src
);
}
},
error
:
function
(
res
)
{
}
});
//form render
var
form
=
layui
.
form
;
form
.
render
();
</script>
backend/views/coin-platform-withhold/edit.php
0 → 100644
View file @
3132db87
<style>
.layui-form-label
{
width
:
100px
;
}
</style>
<div
class=
"layui-row"
style=
"padding: 5px;"
>
<div
class=
"layui-col-md12"
>
<form
class=
"layui-form"
method=
"post"
action=
""
id=
"platformEdit"
>
<input
name=
"_csrf"
type=
"hidden"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
<input
name=
"id"
type=
"hidden"
value=
"
<?=
$model
->
id
?>
"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
名称
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"platform"
value=
"
<?=
$model
->
platform
?>
"
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=
"address"
value=
"
<?=
$model
->
address
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
私钥
</label>
<div
class=
"layui-input-block"
style=
"width: auto"
>
<input
class=
"layui-input"
name=
"private_key"
value=
"
<?=
$model
->
private_key
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
执行器
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"exer"
value=
"
<?=
$model
->
exer
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
手续费
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"fee"
value=
"
<?=
$model
->
fee
?>
"
>
</div>
</div>
</form>
</div>
</div>
backend/views/coin-platform-withhold/index.php
0 → 100644
View file @
3132db87
<?php
use
backend\assets\coinPlatformWithhold\IndexAsset
;
IndexAsset
::
register
(
$this
);
?>
<style>
.layui-table-tips-c
{
padding
:
0px
;
}
</style>
<h4>
平行链列表
</h4>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md1"
>
<a
href=
"/admin/coin-platform-withhold/add"
>
<button
class=
"layui-btn layui-btn-default"
id=
"add"
>
添加平行链
</button>
</a>
</div>
</div>
<div
class=
"layui-row"
>
<table
class=
"layui-table"
id=
"table1"
lay-filter=
"table1"
></table>
</div>
<script
type=
"text/html"
id=
"operationTpl"
>
<
a
class
=
"layui-btn layui-btn-xs"
lay
-
event
=
"edit"
>
编辑
<
/a>
<
a
class
=
"layui-btn layui-btn-primary layui-btn-xs"
href
=
"/admin/coin-supported-symbol/list?id={{d.id}}"
>
所支持货币对
<
/a>
</script>
backend/views/coin-supported-symbol/add.php
0 → 100644
View file @
3132db87
<h4>
添加货币对
</h4>
<style>
.layui-form-label
{
width
:
100px
;
}
</style>
<div
class=
"layui-row"
style=
"padding: 5px;"
>
<div
class=
"layui-col-md6"
>
<form
class=
"layui-form"
method=
"post"
action=
""
>
<input
name=
"_csrf"
type=
"hidden"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
货币对
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"symbol"
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<button
class=
"layui-btn"
>
提交
</button>
</div>
<input
class=
"layui-input"
name=
"platform_withhold_id"
type=
"hidden"
value=
"
<?=
$platform_withhold_id
?>
"
lay-verify=
"required"
>
</form>
</div>
</div>
backend/views/coin-supported-symbol/edit.php
0 → 100644
View file @
3132db87
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-5-31
* Time: 下午6:23
*/
?>
<style>
.layui-form-label
{
width
:
100px
;
}
</style>
<div
class=
"layui-row"
style=
"padding: 5px;"
>
<div
class=
"layui-col-md12"
>
<form
class=
"layui-form"
method=
"post"
action=
""
id=
"walletEdit"
>
<input
name=
"_csrf"
type=
"hidden"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
<input
name=
"id"
type=
"hidden"
value=
"
<?=
$model
->
id
?>
"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
简称
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name"
value=
"
<?=
$model
->
name
?>
"
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=
"download_url"
value=
"
<?=
$model
->
download_url
?>
"
>
</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>
</div>
</div>
</form>
</div>
</div>
<script>
var
laydate
=
layui
.
laydate
;
laydate
.
render
({
elem
:
"#time1"
});
//图片上传
var
uploader
=
layui
.
upload
;
$_csrf
=
$
(
"input[name='_csrf']"
).
val
();
uploader
.
render
({
elem
:
"#upload1"
,
url
:
'/admin/coin/upload'
,
data
:
{
_csrf
:
$_csrf
},
done
:
function
(
res
)
{
console
.
log
(
res
.
data
.
src
);
$
(
"input[name='icon']"
).
val
(
res
.
data
.
src
);
$
(
"#icon1"
).
attr
(
'src'
,
res
.
data
.
src
);
},
error
:
function
(
res
)
{
}
});
//form render
var
form
=
layui
.
form
;
form
.
render
();
</script>
backend/views/coin-supported-symbol/index.php
0 → 100644
View file @
3132db87
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-5-31
* Time: 上午9:59
*/
use
backend\assets\coinSupportedSymbol\IndexAsset
;
IndexAsset
::
register
(
$this
);
?>
<style>
.layui-table-tips-c
{
padding
:
0px
;
}
</style>
<h4>
货币对列表
</h4>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md1"
>
<a
href=
"/admin/coin-supported-symbol/add?platform_withhold_id=
<?=
$platform_withhold_id
?>
"
"
>
<button
class=
"layui-btn layui-btn-default"
id=
"add"
>
添加货币对
</button>
</a>
</div>
</div>
<input
id=
"platform_withhold_id"
type=
"hidden"
value=
"
<?=
$platform_withhold_id
?>
"
>
<div
class=
"layui-row"
>
<table
class=
"layui-table"
id=
"table1"
lay-filter=
"table1"
></table>
</div>
<script
type=
"text/html"
id=
"operationTpl"
>
<
a
lay
-
event
=
"delete"
>
<
button
class
=
"layui-btn layui-btn-sm layui-btn-danger"
><
i
class
=
"layui-icon"
>&
#
xe640
;
<
/i></
button
>
<
/a
>
</script>
backend/web/js/coin-platform-withhold/index.js
0 → 100644
View file @
3132db87
/**
* @author rlgyzhcn@qq.com
*/
var
table
=
layui
.
table
;
var
form
=
layui
.
form
;
var
layer
=
layui
.
layer
;
form
.
render
();
var
tableIns
=
table
.
render
({
elem
:
"#table1"
,
url
:
'/admin/coin-platform-withhold/index'
,
limit
:
10
,
page
:
1
,
loading
:
true
,
cols
:
[[
{
field
:
'platform'
,
title
:
'名称'
},
{
field
:
'address'
,
title
:
'地址'
},
{
field
:
'exer'
,
title
:
'执行器'
},
{
field
:
'fee'
,
title
:
'手续费'
},
{
field
:
'id'
,
title
:
'操作'
,
templet
:
'#operationTpl'
}
]],
});
form
.
on
(
'submit(form1)'
,
function
(
data
)
{
table
.
reload
(
"table1"
,
{
where
:
data
.
field
,
page
:
{
curr
:
1
},
});
return
false
;
});
//监听单元格事件
table
.
on
(
'tool(table1)'
,
function
(
obj
)
{
var
data
=
obj
.
data
;
if
(
obj
.
event
==
'delete'
)
{
layer
.
confirm
(
'真的要删除'
+
data
.
platform
+
'吗?'
,
{
icon
:
3
,
title
:
'删除'
},
function
(
index
)
{
layer
.
close
(
index
);
//向服务端发送删除指令
$
.
get
(
'/admin/coin-platform-withhold/delete?id='
+
obj
.
data
.
id
,
function
(
data
,
status
)
{
if
(
data
.
code
==
0
)
{
obj
.
del
();
//删除对应行(tr)的DOM结构
}
layer
.
msg
(
data
.
msg
);
});
});
}
else
if
(
obj
.
event
==
'edit'
)
{
$
.
get
(
'/admin/coin-platform-withhold/edit'
,
{
id
:
data
.
id
},
function
(
str
)
{
var
editIndex
=
layer
.
open
({
type
:
1
,
title
:
'编辑: '
+
data
.
platform
,
area
:
'700px'
,
content
:
str
,
btn
:
[
'保存'
,
'取消'
],
btn1
:
function
()
{
// console.log();
$
.
post
(
'/admin/coin-platform-withhold/edit'
,
$
(
"#platformEdit"
).
serialize
(),
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
rev
.
code
==
0
)
{
table
.
reload
(
"table1"
,
{
where
:
data
.
field
,
});
layer
.
close
(
editIndex
);
}
});
}
});
});
}
});
\ No newline at end of file
backend/web/js/coin-supported-symbol/index.js
0 → 100644
View file @
3132db87
/**
* @author rlgyzhcn@qq.com
*/
var
table
=
layui
.
table
;
var
form
=
layui
.
form
;
var
layer
=
layui
.
layer
;
form
.
render
();
var
platform_withhold_id
=
$
(
"#platform_withhold_id"
).
val
();
var
tableIns
=
table
.
render
({
elem
:
"#table1"
,
url
:
'/admin/coin-supported-symbol/list?id='
+
platform_withhold_id
,
limit
:
10
,
page
:
1
,
loading
:
true
,
cols
:
[[
{
field
:
'id'
,
title
:
'ID'
},
{
field
:
'symbol'
,
title
:
'货币对'
},
{
field
:
'create_time'
,
title
:
'创建时间'
},
{
field
:
'id'
,
title
:
'操作'
,
templet
:
'#operationTpl'
}
]],
});
form
.
on
(
'submit(form1)'
,
function
(
data
)
{
table
.
reload
(
"table1"
,
{
where
:
data
.
field
,
page
:
{
curr
:
1
},
});
return
false
;
});
//监听单元格事件
table
.
on
(
'tool(table1)'
,
function
(
obj
)
{
var
data
=
obj
.
data
;
if
(
obj
.
event
==
'delete'
)
{
layer
.
confirm
(
'真的要删除'
+
data
.
symbol
+
'吗?'
,
{
icon
:
3
,
title
:
'删除'
},
function
(
index
)
{
layer
.
close
(
index
);
//向服务端发送删除指令
$
.
get
(
'/admin/coin-supported-symbol/delete?id='
+
obj
.
data
.
id
,
function
(
data
,
status
)
{
if
(
data
.
code
==
0
)
{
obj
.
del
();
//删除对应行(tr)的DOM结构
}
layer
.
msg
(
data
.
msg
);
});
});
}
});
\ No newline at end of file
common/models/psources/CoinPlatformWithHold.php
View file @
3132db87
...
...
@@ -5,6 +5,7 @@
* Date: 2019/3/1
* Time: 17:37
*/
namespace
common\models\psources
;
class
CoinPlatformWithHold
extends
BaseActiveRecord
...
...
@@ -14,11 +15,59 @@ class CoinPlatformWithHold extends BaseActiveRecord
return
'coin_platform_withhold'
;
}
public
static
function
getRecord
(
$platform
)
{
return
self
::
find
()
->
where
([
'platform'
=>
$platform
])
->
asArray
()
->
one
();
}
public
static
function
getList
(
$page
=
1
,
$limit
=
10
,
$condition
=
[])
{
$query
=
self
::
find
();
foreach
(
$condition
as
$item
)
{
$query
=
$query
->
andWhere
(
$item
);
}
$count
=
$query
->
count
();
$data
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
$limit
);
$data
=
$data
->
asArray
()
->
all
();
return
[
'count'
=>
$count
,
'data'
=>
$data
,
'code'
=>
0
];
}
public
function
addOne
(
$params
)
{
$params
=
array_filter
(
$params
,
function
(
$value
)
{
if
(
null
==
$value
)
{
return
false
;
}
return
true
;
});
$this
->
setAttributes
(
$params
,
false
);
try
{
return
(
bool
)
$this
->
save
();
}
catch
(
\Exception
$exception
)
{
return
[
'code'
=>
$exception
->
getCode
(),
'message'
=>
$exception
->
getMessage
()];
}
}
public
function
updateOne
(
$params
)
{
$params
=
array_filter
(
$params
,
function
(
$value
)
{
if
(
null
===
$value
)
{
return
false
;
}
return
true
;
});
if
(
isset
(
$params
[
'id'
])
&&
!
empty
(
$params
[
'id'
]))
{
$coin
=
self
::
findOne
([
'id'
=>
$params
[
'id'
]]);
if
(
$coin
===
null
)
{
return
[
'code'
=>
1
,
'msg'
=>
'平台不存在'
];
}
unset
(
$params
[
'id'
]);
}
$coin
->
setAttributes
(
$params
,
false
);
try
{
return
(
bool
)
$coin
->
save
();
}
catch
(
\Exception
$exception
)
{
return
[
'code'
=>
$exception
->
getCode
(),
'message'
=>
$exception
->
getMessage
()];
}
}
}
\ No newline at end of file
common/models/psources/CoinSupportedSymbol.php
0 → 100644
View file @
3132db87
<?php
namespace
common\models\psources
;
class
CoinSupportedSymbol
extends
BaseActiveRecord
{
public
static
function
tableName
()
{
return
'{{%coin_supported_symbol}}'
;
}
public
static
function
getList
(
$page
=
1
,
$limit
=
10
,
$condition
=
[])
{
$query
=
self
::
find
();
foreach
(
$condition
as
$item
)
{
$query
=
$query
->
andWhere
(
$item
);
}
$count
=
$query
->
count
();
$data
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
$limit
)
->
asArray
()
->
all
();
return
[
'count'
=>
$count
,
'data'
=>
$data
];
}
public
function
addOne
(
$params
)
{
$params
=
array_filter
(
$params
,
function
(
$value
)
{
if
(
null
==
$value
)
{
return
false
;
}
return
true
;
});
$this
->
setAttributes
(
$params
,
false
);
try
{
return
(
bool
)
$this
->
save
();
}
catch
(
\Exception
$exception
)
{
return
[
'code'
=>
$exception
->
getCode
(),
'message'
=>
$exception
->
getMessage
()];
}
}
}
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