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
5b9acaa8
Commit
5b9acaa8
authored
Jun 22, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
空投管理
parent
a9577677
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
5 deletions
+102
-5
InvestmentController.php
backend/controllers/InvestmentController.php
+25
-1
form_add_one.php
backend/views/investment/form_add_one.php
+6
-2
index.js
backend/web/js/investment/index.js
+5
-2
Investment.php
common/models/pwallet/Investment.php
+66
-0
No files found.
backend/controllers/InvestmentController.php
View file @
5b9acaa8
...
@@ -10,6 +10,7 @@ namespace backend\controllers;
...
@@ -10,6 +10,7 @@ namespace backend\controllers;
use
Yii
;
use
Yii
;
use
common\models\pwallet\InvestmentType
;
use
common\models\pwallet\InvestmentType
;
use
common\models\pwallet\Investment
;
class
InvestmentController
extends
BaseController
class
InvestmentController
extends
BaseController
{
{
...
@@ -21,7 +22,30 @@ class InvestmentController extends BaseController
...
@@ -21,7 +22,30 @@ class InvestmentController extends BaseController
public
function
actionAddOne
()
public
function
actionAddOne
()
{
{
$this
->
layout
=
false
;
$this
->
layout
=
false
;
return
$this
->
render
(
'form_add_one'
);
if
(
Yii
::
$app
->
request
->
isPost
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$post
=
Yii
::
$app
->
request
->
post
();
$model
=
new
Investment
();
if
(
$model
->
load
(
$post
)
&&
$model
->
validate
())
{
$model
->
create_at
=
date
(
'Y-m-d H:i:s'
);
$model
->
update_at
=
date
(
'Y-m-d H:i:s'
);
if
(
$model
->
save
())
{
return
[
'code'
=>
0
,
'msg'
=>
'succeed'
];
}
}
$error
=
$model
->
errors
;
if
(
$error
)
{
foreach
(
$error
as
$item
)
{
$error
=
$item
[
0
];
break
;
}
return
$error
;
}
return
[
'code'
=>
1
,
'msg'
=>
'未知错误'
];
}
else
{
return
$this
->
render
(
'form_add_one'
);
}
}
}
public
function
actionType
()
public
function
actionType
()
...
...
backend/views/investment/form_add_one.php
View file @
5b9acaa8
...
@@ -16,11 +16,15 @@ $type = InvestmentType::getList(1, 999, []);
...
@@ -16,11 +16,15 @@ $type = InvestmentType::getList(1, 999, []);
<input
name=
"_csrf"
type=
"hidden"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
<input
name=
"_csrf"
type=
"hidden"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
<div
class=
"input-group my-group"
>
<div
class=
"input-group my-group"
>
<span
class=
"input-group-addon"
>
UID
</span>
<span
class=
"input-group-addon"
>
UID
</span>
<input
name=
"uid"
type=
"text"
class=
"form-control"
>
<input
name=
"uid"
type=
"text"
class=
"form-control"
lay-verify=
"required"
>
</div>
</div>
<div
class=
"input-group my-group"
>
<div
class=
"input-group my-group"
>
<span
class=
"input-group-addon"
>
数量
</span>
<span
class=
"input-group-addon"
>
数量
</span>
<input
name=
"count"
type=
"text"
class=
"form-control"
>
<input
name=
"count"
type=
"text"
class=
"form-control"
lay-verify=
"required"
>
</div>
<div
class=
"input-group my-group"
>
<span
class=
"input-group-addon"
>
币种
</span>
<input
name=
"coin"
type=
"text"
class=
"form-control"
value=
"YCC"
readonly=
"readonly"
>
</div>
</div>
<div
class=
"input-group my-group"
>
<div
class=
"input-group my-group"
>
<span
class=
"input-group-addon"
>
类型
</span>
<span
class=
"input-group-addon"
>
类型
</span>
...
...
backend/web/js/investment/index.js
View file @
5b9acaa8
...
@@ -37,8 +37,11 @@ $("#add1").click(function () {
...
@@ -37,8 +37,11 @@ $("#add1").click(function () {
var
type
=
$
(
'#addData input[name="type"]'
).
val
();
var
type
=
$
(
'#addData input[name="type"]'
).
val
();
if
(
uid
!==
""
&&
count
!==
""
)
{
if
(
uid
!==
""
&&
count
!==
""
)
{
$btn
=
$
(
'.layui-layer-btn0'
).
button
(
'loading'
);
$btn
=
$
(
'.layui-layer-btn0'
).
button
(
'loading'
);
$
.
post
(
'/admin/investment/add-one'
,
{},
function
(
rev
)
{
$
.
post
(
'/admin/investment/add-one'
,
$
(
"#addData"
).
serialize
(),
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
rev
.
code
==
0
)
{
layer
.
close
(
index
);
}
});
});
$btn
.
button
(
'reset'
);
$btn
.
button
(
'reset'
);
}
else
{
}
else
{
...
...
common/models/pwallet/Investment.php
0 → 100644
View file @
5b9acaa8
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-20
* Time: 下午3:28
*/
namespace
common\models\pwallet
;
use
Yii
;
use
common\core\BaseActiveRecord
;
/**
* Class InvestmentType
* @property integer $id
* @property integer $uid
* @property integer $tid
* @property double $count
* @property string $coin
* @property string $address
* @property string $create_at
* @property string $update_at
* @package common\models\pwallet
*/
class
Investment
extends
BaseActiveRecord
{
/**
* @return null|object|\yii\db\Connection
* @throws \yii\base\InvalidConfigException
*/
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'db_pwallet'
);
}
public
function
formName
()
{
return
''
;
}
public
function
rules
()
{
return
[
[[
'id'
,
'uid'
,
'tid'
],
'integer'
],
[[
'coin'
,
'address'
],
'string'
]
];
}
public
function
attributeLabels
()
{
return
[
'id'
=>
'ID'
,
'uid'
=>
'UID'
,
'tid'
=>
'类型'
,
'count'
=>
'数量'
,
'coin'
=>
'币种'
,
'address'
=>
'地址'
,
'status'
=>
'状态'
,
'create_at'
=>
'创建时间'
,
'update_at'
=>
'更新时间'
,
];
}
}
\ 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