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
112e259f
Commit
112e259f
authored
Jun 05, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
矿工费
parent
3ad3580f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
355 additions
and
6 deletions
+355
-6
CoinController.php
backend/controllers/CoinController.php
+0
-6
MinerFeeController.php
backend/controllers/MinerFeeController.php
+137
-0
MinerFeeForm.php
backend/models/coin/MinerFeeForm.php
+54
-0
add.php
backend/views/miner-fee/add.php
+12
-0
edit.php
backend/views/miner-fee/edit.php
+11
-0
form.php
backend/views/miner-fee/form.php
+53
-0
index.php
backend/views/miner-fee/index.php
+48
-0
MinerFee.php
common/models/pwallet/MinerFee.php
+40
-0
No files found.
backend/controllers/CoinController.php
View file @
112e259f
...
...
@@ -137,9 +137,4 @@ class CoinController extends BaseController
return
[
'code'
=>
$exception
->
getCode
(),
'msg'
=>
$exception
->
getMessage
()];
}
}
public
function
actionCost
()
{
return
''
;
}
}
\ No newline at end of file
backend/controllers/MinerFeeController.php
0 → 100644
View file @
112e259f
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-5
* Time: 下午2:38
*/
namespace
backend\controllers
;
use
Yii
;
use
common\models\pwallet\MinerFee
;
use
backend\models\coin\MinerFeeForm
;
use
\Exception
;
class
MinerFeeController
extends
BaseController
{
/**
* 矿工费列表
*/
public
function
actionCost
()
{
if
(
Yii
::
$app
->
request
->
isAjax
)
{
$data
=
MinerFee
::
getList
(
1
,
999
,
[]);
//数据不多
if
(
$data
[
'count'
]
>
0
)
{
$data
[
'code'
]
=
0
;
}
else
{
$data
[
'code'
]
=
1
;
$data
[
'msg'
]
=
'数据为空'
;
}
Yii
::
$app
->
response
->
format
=
'json'
;
Yii
::
$app
->
response
->
data
=
$data
;
Yii
::
$app
->
response
->
send
();
}
return
$this
->
render
(
'index'
);
}
/**
* 添加矿工费
*/
public
function
actionAdd
()
{
$model
=
new
MinerFeeForm
();
$model
->
scenario
=
'add'
;
if
(
Yii
::
$app
->
request
->
isPost
)
{
$request
=
Yii
::
$app
->
request
;
if
(
$model
->
load
(
$request
->
post
())
&&
$model
->
validate
())
{
$minerFee
=
new
MinerFee
();
$minerFee
->
platform
=
$model
->
platform
;
$minerFee
->
min
=
$model
->
min
;
$minerFee
->
max
=
$model
->
max
;
$minerFee
->
level
=
$model
->
level
;
$minerFee
->
create_at
=
date
(
'Y-m-d H:i:s'
);
$minerFee
->
update_at
=
date
(
'Y-m-d H:i:s'
);
try
{
$minerFee
->
save
();
$this
->
success
(
'添加成功'
,
'/admin/miner-fee/cost'
);
}
catch
(
Exception
$exception
)
{
$this
->
error
(
$exception
->
getMessage
(),
'/admin/miner-fee/add'
);
}
}
//表单验证失败
$errors
=
$model
->
errors
;
if
(
$errors
)
{
foreach
(
$errors
as
$key
=>
$item
)
{
$errors
=
$item
[
0
];
break
;
}
}
$this
->
error
(
$errors
,
Yii
::
$app
->
request
->
getReferrer
());
}
return
$this
->
render
(
'add'
,
[
'model'
=>
$model
]);
}
/**
* 编辑
* @return string
*/
public
function
actionEdit
()
{
$model
=
new
MinerFeeForm
();
$model
->
scenario
=
'edit'
;
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
null
);
if
(
$id
)
{
$minerFee
=
MinerFee
::
findOne
([
'id'
=>
$id
]);
if
(
$minerFee
)
{
if
(
Yii
::
$app
->
request
->
isPost
)
{
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
validate
())
{
$minerFee
->
platform
=
$model
->
platform
;
$minerFee
->
min
=
$model
->
min
;
$minerFee
->
max
=
$model
->
max
;
$minerFee
->
level
=
$model
->
level
;
$minerFee
->
update_at
=
date
(
'Y-m-d H:i:s'
);
try
{
$minerFee
->
save
();
$this
->
success
(
'更新成功'
,
'/admin/miner-fee/cost'
);
}
catch
(
Exception
$exception
)
{
$this
->
error
(
$exception
->
getMessage
(),
Yii
::
$app
->
request
->
getReferrer
());
}
}
$errors
=
$model
->
errors
;
if
(
$errors
)
{
foreach
(
$errors
as
$k
=>
$v
)
{
$errors
=
$v
[
0
];
break
;
}
}
$this
->
error
(
$errors
,
Yii
::
$app
->
request
->
getReferrer
());
}
return
$this
->
render
(
'edit'
,
[
'model'
=>
$minerFee
]);
}
}
$this
->
error
(
'公告不存在'
,
Yii
::
$app
->
request
->
getReferrer
());
}
/**
* 删除
*/
public
function
actionDel
()
{
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
null
);
if
(
$id
)
{
$minerFee
=
MinerFee
::
findOne
([
'id'
=>
$id
]);
if
(
$minerFee
)
{
try
{
$minerFee
->
delete
();
$this
->
success
(
'删除成功'
,
Yii
::
$app
->
request
->
getReferrer
());
}
catch
(
Exception
$exception
)
{
}
}
}
$this
->
error
(
'删除失败'
,
Yii
::
$app
->
request
->
getReferrer
());
}
}
\ No newline at end of file
backend/models/coin/MinerFeeForm.php
0 → 100644
View file @
112e259f
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-5
* Time: 下午2:59
*/
namespace
backend\models\coin
;
use
yii\base\Model
;
class
MinerFeeForm
extends
Model
{
public
$id
;
public
$platform
;
public
$max
;
public
$min
;
public
$level
;
public
function
formName
()
{
return
''
;
}
public
function
rules
()
{
return
[
[[
'id'
,
'platform'
,
'min'
,
'max'
,
'level'
],
'required'
,
'on'
=>
'edit'
],
[[
'platform'
,
'min'
,
'max'
,
'level'
],
'required'
,
'on'
=>
'add'
],
[[
'id'
,
'max'
,
'min'
,
'level'
],
'number'
],
[[
'platform'
],
'string'
,
'max'
=>
255
],
];
}
public
function
scenarios
()
{
return
[
'add'
=>
[
'platform'
,
'min'
,
'max'
,
'level'
],
'edit'
=>
[
'id'
,
'platform'
,
'min'
,
'max'
,
'level'
],
];
}
public
function
attributeLabels
()
{
return
[
'platform'
=>
'平台'
,
'min'
=>
'最小值'
,
'max'
=>
'最大值'
,
'level'
=>
'分档'
,
];
}
}
\ No newline at end of file
backend/views/miner-fee/add.php
0 → 100644
View file @
112e259f
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-5-31
* Time: 下午3:31
*/
?>
<h4>
添加币种
</h4>
<?=
$this
->
render
(
'form'
,
[
'model'
=>
$model
])
?>
\ No newline at end of file
backend/views/miner-fee/edit.php
0 → 100644
View file @
112e259f
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-5-31
* Time: 下午6:23
*/
?>
<h4>
修改信息
</h4>
<?=
$this
->
render
(
'form'
,
[
'model'
=>
$model
])
?>
backend/views/miner-fee/form.php
0 → 100644
View file @
112e259f
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-5-31
* Time: 下午3:28
*/
/**
* @var $model backend\models\coin\CoinForm;
*/
?>
<style>
.layui-form-label
{
width
:
100px
;
}
</style>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md6"
>
<form
class=
"layui-form"
method=
"post"
action=
""
>
<input
name=
"_csrf"
type=
"hidden"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
<input
name=
"id"
type=
"hidden"
value=
"
<?=
$model
->
id
?>
"
>
<div
class=
"layui-form-item"
>
<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=
"min"
value=
"
<?=
$model
->
min
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
最大值
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"max"
value=
"
<?=
$model
->
max
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
分档
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"level"
value=
"
<?=
$model
->
level
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<button
class=
"layui-btn"
>
提交
</button>
</div>
</form>
</div>
</div>
backend/views/miner-fee/index.php
0 → 100644
View file @
112e259f
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-5
* Time: 下午2:40
*/
?>
<h4>
矿工费
</h4>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md1"
>
<a
href=
"/admin/miner-fee/add"
>
<button
class=
"layui-btn"
>
添加矿工费
</button>
</a>
</div>
<div
class=
"layui-col-md8"
>
</div>
</div>
<div
class=
"layui-row"
>
<table
id=
"table1"
class=
"layui-table"
></table>
</div>
<script>
var
table
=
layui
.
table
;
table
.
render
({
elem
:
"#table1"
,
cols
:
[[
{
field
:
'id'
,
title
:
'ID'
},
{
field
:
'platform'
,
title
:
'平台'
},
{
field
:
'min'
,
title
:
'最小值'
},
{
field
:
'max'
,
title
:
'最大值'
},
{
field
:
'level'
,
title
:
'分档'
},
{
field
:
'create_at'
,
title
:
'创建时间'
},
{
field
:
'update_at'
,
title
:
'更新时间'
},
{
field
:
'id'
,
title
:
'操作'
,
templet
:
"#operatorTpl"
}
]],
url
:
'/admin/miner-fee/cost'
});
</script>
<script
type=
"text/html"
id=
"operatorTpl"
>
<
a
href
=
"/admin/miner-fee/edit?id={{d.id}}"
>
<
button
class
=
"layui-btn layui-btn-sm"
>
编辑
<
/button
>
<
/a
>
<
a
href
=
"/admin/miner-fee/del?id={{d.id}}"
>
<
button
class
=
"layui-btn layui-btn-sm layui-btn-danger"
>
删除
<
/button
>
<
/a
>
</script>
\ No newline at end of file
common/models/pwallet/MinerFee.php
0 → 100644
View file @
112e259f
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-5
* Time: 下午2:50
*/
namespace
common\models\pwallet
;
use
Yii
;
use
common\core\BaseActiveRecord
;
class
MinerFee
extends
BaseActiveRecord
{
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'db_pwallet'
);
}
/**
* 获取矿工费列表
*
* @param int $page
* @param int $limit
* @param array $condition
* @return array
*/
public
static
function
getList
(
$page
=
1
,
$limit
=
10
,
$condition
=
[])
{
$query
=
self
::
find
();
foreach
(
$condition
as
$item
)
{
$query
=
$query
->
andFilterWhere
(
$item
);
}
$count
=
$query
->
count
();
$data
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
$limit
)
->
asArray
()
->
all
();
return
[
'count'
=>
$count
,
'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