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
5289d7a2
Commit
5289d7a2
authored
Sep 21, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
b6918f76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
15 deletions
+92
-15
add.php
backend/views/coin/add.php
+1
-1
Coin.php
common/models/psources/Coin.php
+32
-14
GuodunController.php
h5/controllers/GuodunController.php
+59
-0
No files found.
backend/views/coin/add.php
View file @
5289d7a2
...
...
@@ -24,7 +24,7 @@
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
中文
明
</label>
<label
class=
"layui-form-label"
>
中文
名
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"nickname"
value=
"
<?=
$model
->
nickname
?>
"
>
</div>
...
...
common/models/psources/Coin.php
View file @
5289d7a2
...
...
@@ -35,9 +35,10 @@ class Coin extends BaseActiveRecord
/**
* 获取币种信息列表
* @param int $page
* @param int $limit
* @param array $condition
*
* @param int $page
* @param int $limit
* @param array $condition
* @return array|\yii\db\ActiveRecord[]
*/
public
static
function
getList
(
$page
=
1
,
$limit
=
10
,
$condition
=
[])
...
...
@@ -56,9 +57,10 @@ class Coin extends BaseActiveRecord
/**
* 获取币种信息列表
* @param int $page
* @param int $limit
* @param array $condition
*
* @param int $page
* @param int $limit
* @param array $condition
* @return array|\yii\db\ActiveRecord[]
*/
public
static
function
getSelectList
(
$page
=
1
,
$limit
=
10
,
$columns
=
[],
$condition
=
[])
...
...
@@ -85,7 +87,7 @@ class Coin extends BaseActiveRecord
});
$this
->
setAttributes
(
$params
,
false
);
try
{
return
(
bool
)
$this
->
save
();
return
(
bool
)
$this
->
save
();
}
catch
(
\Exception
$exception
)
{
return
[
'code'
=>
$exception
->
getCode
(),
'message'
=>
$exception
->
getMessage
()];
}
...
...
@@ -111,7 +113,7 @@ class Coin extends BaseActiveRecord
}
$coin
->
setAttributes
(
$params
,
false
);
try
{
return
(
bool
)
$coin
->
save
();
return
(
bool
)
$coin
->
save
();
}
catch
(
\Exception
$exception
)
{
return
[
'code'
=>
$exception
->
getCode
(),
'message'
=>
$exception
->
getMessage
()];
}
...
...
@@ -136,6 +138,7 @@ class Coin extends BaseActiveRecord
/**
* 返回类型,类型就是币种的主链
*
* @return array|\yii\db\ActiveRecord[]
*/
public
static
function
getChainList
()
...
...
@@ -170,9 +173,9 @@ class Coin extends BaseActiveRecord
/**
* 根据id列表获取币种信息
*
* @param array $ids
[description]
* @param array $select
[description]
* @param string $sort_by
[description]
* @param array $ids [description]
* @param array $select [description]
* @param string $sort_by [description]
* @return array [description]
*/
public
static
function
getCoinInfoByIds
(
$ids
,
$select
,
$sort_by
)
...
...
@@ -197,9 +200,9 @@ class Coin extends BaseActiveRecord
/**
* 获取推介币种信息列表
*
* @param int
$page
* @param int
$limit
* @param array
$condition
* @param int $page
* @param int $limit
* @param array $condition
* @return array|\yii\db\ActiveRecord[]
*/
public
static
function
getRecommendList
(
$page
=
1
,
$limit
=
10
,
$condition
=
[])
...
...
@@ -216,4 +219,19 @@ class Coin extends BaseActiveRecord
}
return
[
'count'
=>
$count
,
'data'
=>
$data
];
}
/**
* 批量获取币种别称
*
* @param array $names
* @return array
*/
public
static
function
getNicknamesByNames
(
array
$names
)
{
$data
=
self
::
find
()
->
select
([
'name'
,
'nickname'
])
->
where
([
'in'
,
'name'
,
$names
])
->
asArray
()
->
all
();
if
(
$data
&&
is_array
(
$data
))
{
$data
=
array_column
(
$data
,
'nickname'
,
'name'
);
}
return
$data
;
}
}
h5/controllers/GuodunController.php
0 → 100644
View file @
5289d7a2
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-9-21
* Time: 上午11:16
*/
namespace
h5\controllers
;
use
common\models\psources\Coin
;
use
common\models\psources\CoinPublishRule
;
use
common\models\psources\CoinReleaseMember
;
use
h5\base\ResponseBuild
;
use
Yii
;
use
h5\base\BaseController
;
class
GuodunController
extends
BaseController
{
public
function
actionGetUserAssets
()
{
$post
=
Yii
::
$app
->
request
->
post
();
$mobile
=
$post
[
'mobile'
]
??
''
;
$page
=
$post
[
'page'
]
??
1
;
$limit
=
$post
[
'limit'
]
??
10
;
$response_
=
new
ResponseBuild
();
if
(
empty
(
$mobile
))
{
$response_
->
build
(
ResponseBuild
::
STATUS_PARAMS_NOT_VALIDATE
);
return
$response_
;
}
$data
=
CoinReleaseMember
::
getList2
(
$page
,
$limit
,
[
'mobile'
=>
$mobile
],
[
'create_time'
=>
SORT_DESC
]);
if
(
$data
)
{
$infos
=
&
$data
[
'data'
];
$names
=
array_unique
(
array_column
(
$infos
,
'coin'
));
$nicknames
=
Coin
::
getNicknamesByNames
(
$names
);
//获取昵称
$rule_ids
=
array_unique
(
array_column
(
$infos
,
'rule_id'
));
$rules
=
CoinPublishRule
::
find
()
->
where
([
'in'
,
'id'
,
$rule_ids
])
->
asArray
()
->
all
();
//获取锁仓规则
$rules
=
array_column
(
$rules
,
null
,
'id'
);
//构造返回数据
foreach
(
$infos
as
$key
=>
&
$item
)
{
$rule
=
$rules
[
$item
[
'rule_id'
]];
$item
[
'nickname'
]
=
$nicknames
[
$item
[
'coin'
]]
??
''
;
$item
[
'repeat'
]
=
$rule
[
'repeat'
];
$item
[
'date'
]
=
date
(
CoinPublishRule
::
DATE_FORMAT
[
$rule
[
'repeat'
]],
strtotime
(
$rule
[
'release_time'
]));
unset
(
$item
[
'rule_id'
],
$item
[
'user_id'
],
$item
[
'platform_id'
]);
}
$response_
->
build
(
ResponseBuild
::
STATUS_SUCCEED
,
''
,
$data
);
return
$response_
;
}
else
{
$response_
->
build
(
-
1
,
'数据为空'
);
return
$response_
;
}
}
}
\ 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