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
7151a999
Commit
7151a999
authored
Jun 22, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
空投管理
parent
d563234d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
11 deletions
+81
-11
InvestmentController.php
backend/controllers/InvestmentController.php
+12
-5
index.php
backend/views/investment/index.php
+4
-3
index.js
backend/web/js/investment/index.js
+11
-2
Investment.php
common/models/pwallet/Investment.php
+48
-1
Member.php
common/models/pwallet/Member.php
+6
-0
No files found.
backend/controllers/InvestmentController.php
View file @
7151a999
...
...
@@ -21,17 +21,21 @@ class InvestmentController extends BaseController
$page
=
$request
->
get
(
'page'
,
1
);
$limit
=
$request
->
get
(
'limit'
,
10
);
$status
=
$request
->
get
(
'status'
,
0
);
$tid
=
$request
->
get
(
'tid'
,
0
);
$uid
=
$request
->
get
(
'uid'
,
0
);
$coin
=
$request
->
get
(
'coin'
,
''
);
$where
=
[];
if
(
$uid
)
{
$where
[]
=
[
'uid'
=>
$uid
];
$where
[]
=
[
'
a.
uid'
=>
$uid
];
}
if
(
$status
)
{
$where
[]
=
[
'status'
=>
$status
];
$where
[]
=
[
'a.status'
=>
$status
];
}
if
(
$tid
)
{
$where
[]
=
[
'a.tid'
=>
$tid
];
}
if
(
$coin
)
{
$where
[]
=
[
'coin'
=>
$coin
];
$where
[]
=
[
'
a.
coin'
=>
$coin
];
}
Yii
::
$app
->
response
->
format
=
'json'
;
return
Investment
::
getList
(
$page
,
$limit
,
$where
);
...
...
@@ -50,9 +54,12 @@ class InvestmentController extends BaseController
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'
];
try
{
$model
->
save
();
}
catch
(
\Exception
$e
)
{
return
[
'code'
=>
$e
->
getCode
(),
'msg'
=>
$e
->
getMessage
()];
}
return
[
'code'
=>
0
,
'msg'
=>
'succeed'
];
}
$error
=
$model
->
errors
;
if
(
$error
)
{
...
...
backend/views/investment/index.php
View file @
7151a999
...
...
@@ -26,9 +26,10 @@ $type = InvestmentType::getList(1, 999, []);
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
style=
"width: 55px;margin-bottom: 0; padding-left: 10px;text-align: left"
>
类型
</label>
<label
class=
"layui-form-label"
style=
"width: 55px;margin-bottom: 0; padding-left: 10px;text-align: left"
>
类型
</label>
<div
class=
"layui-input-inline"
>
<select
name=
"t
ype
"
>
<select
name=
"t
id
"
>
<option
value=
"0"
>
全部
</option>
<?php
if
(
$type
[
'count'
]
>
0
)
:
?>
<?php
foreach
(
$type
[
'data'
]
as
$item
)
:
?>
...
...
@@ -49,7 +50,7 @@ $type = InvestmentType::getList(1, 999, []);
</div>
</div>
<div
class=
"layui-inline"
>
<button
class=
"layui-btn"
>
搜索
</button>
<button
class=
"layui-btn"
lay-filter=
"form1"
lay-submit
>
搜索
</button>
<button
class=
"layui-btn"
type=
"reset"
>
重置
</button>
<button
class=
"layui-btn"
id=
"add1"
>
添加数据
</button>
<button
class=
"layui-btn"
id=
"add2"
>
导入文件
</button>
...
...
backend/web/js/investment/index.js
View file @
7151a999
...
...
@@ -14,11 +14,11 @@ table.render({
{
field
:
'nickname'
,
title
:
"昵称"
},
{
field
:
'coin'
,
title
:
"币种"
},
{
field
:
'count'
,
title
:
"数量"
},
{
field
:
't
id
'
,
title
:
"类型"
},
{
field
:
't
ype
'
,
title
:
"类型"
},
{
field
:
'status'
,
title
:
"状态"
},
{
field
:
'address'
,
title
:
"地址"
},
{
field
:
'create_at'
,
title
:
"添加时间"
},
{
field
:
'
dealwith
_at'
,
title
:
"处理时间"
}
{
field
:
'
update
_at'
,
title
:
"处理时间"
}
]]
});
$
(
"#add1"
).
click
(
function
()
{
...
...
@@ -59,3 +59,11 @@ $("#add1").click(function () {
$
(
"#add2"
).
click
(
function
()
{
return
false
;
});
form
.
on
(
'submit(form1)'
,
function
(
data
)
{
table
.
reload
(
'table1'
,
{
where
:
data
.
field
,
page
:
{
curr
:
1
}
});
return
false
;
});
\ No newline at end of file
common/models/pwallet/Investment.php
View file @
7151a999
...
...
@@ -44,10 +44,24 @@ class Investment extends BaseActiveRecord
return
[
[[
'id'
,
'uid'
,
'tid'
],
'integer'
],
[[
'coin'
,
'address'
],
'string'
],
[[
'count'
],
'default'
]
[[
'count'
],
'default'
]
];
}
/**
* @param bool $runValidation
* @param null $attributeNames
* @return bool
* @throws \Exception
*/
public
function
save
(
$runValidation
=
true
,
$attributeNames
=
null
)
{
$uid
=
$this
->
uid
;
if
(
!
Member
::
userExists
(
$uid
))
{
throw
new
\Exception
(
'用户不存在'
,
'2300'
);
}
return
parent
::
save
(
$runValidation
,
$attributeNames
);
// TODO: Change the autogenerated stub
}
public
function
attributeLabels
()
{
...
...
@@ -63,4 +77,36 @@ class Investment extends BaseActiveRecord
'update_at'
=>
'更新时间'
,
];
}
public
static
function
getList
(
$page
=
1
,
$limit
=
10
,
$condition
=
[])
{
$query
=
self
::
find
()
->
from
(
'investment as a'
)
->
select
([
'a.id'
,
'a.uid'
,
'c.nickname'
,
'a.coin'
,
'a.count'
,
'b.name as type'
,
'a.status'
,
'a.address'
,
'a.create_at'
,
'a.update_at'
,
])
->
leftJoin
(
'investment_type as b'
,
'a.tid=b.id'
)
->
leftJoin
(
'member as c'
,
'a.uid=c.uid'
);
foreach
(
$condition
as
$item
)
{
$query
=
$query
->
andWhere
(
$item
);
}
$count
=
$query
->
count
();
$data
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
$limit
)
->
asArray
()
->
all
();
// $sql = $query->createCommand()->getSql();
$data
=
[
'count'
=>
$count
,
'data'
=>
$data
];
if
(
$count
>
0
)
{
$data
[
'code'
]
=
0
;
}
else
{
$data
[
'code'
]
=
1
;
$data
[
'msg'
]
=
'数据为空'
;
}
return
$data
;
}
}
\ No newline at end of file
common/models/pwallet/Member.php
View file @
7151a999
...
...
@@ -169,4 +169,9 @@ class Member extends BaseActiveRecord
$this
->
save
(
false
);
}
public
static
function
userExists
(
$uid
)
{
return
(
bool
)
self
::
findOne
(
$uid
);
}
}
\ 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