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
2cf4eeb0
Commit
2cf4eeb0
authored
Dec 17, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/manage-user' into 'develop'
Feature/manage user See merge request
!426
parents
4c81a3f2
5056fa96
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
19 deletions
+27
-19
AirDropController.php
api/controllers/AirDropController.php
+12
-10
Admin.php
common/models/Admin.php
+3
-3
User.php
common/models/User.php
+2
-2
Hd.php
common/service/exchange/Hd.php
+2
-2
HdBuilder.php
common/service/exchange/factory/HdBuilder.php
+2
-2
UserController.php
wallet/controllers/UserController.php
+6
-0
No files found.
api/controllers/AirDropController.php
View file @
2cf4eeb0
...
@@ -18,27 +18,29 @@ class AirDropController extends BaseController
...
@@ -18,27 +18,29 @@ class AirDropController extends BaseController
$data
=
Yii
::
$app
->
request
->
get
();
$data
=
Yii
::
$app
->
request
->
get
();
$identifier
=
$data
[
'identifier'
]
??
null
;
$identifier
=
$data
[
'identifier'
]
??
null
;
$miner_address
=
$data
[
'miner_address'
]
??
null
;
if
(
false
==
$identifier
)
{
if
(
false
==
$identifier
||
false
==
$miner_address
)
{
$this
->
code
=
-
1
;
$this
->
code
=
-
1
;
$this
->
msg
=
'设备号错误,请重新输入.'
;
$this
->
msg
=
'设备号错误,请重新输入.'
;
goto
doEnd
;
goto
doEnd
;
}
}
// $exist = AirDropRulePool::find()->where(['identifier' => $identifier])->one();
$exist
=
AirDropRulePool
::
find
()
->
where
([
'identifier'
=>
$identifier
])
->
one
();
// if (false == $exist || false == $exist->rule) {
// $this->code = -1;
// $this->msg = '设备号错误,请重新输入.';
// goto doEnd;
// }
$exist
=
AirDrop
::
find
()
->
where
([
'identifier'
=>
$identifier
,
'miner_address'
=>
$miner_address
])
->
one
();
if
(
false
==
$exist
||
false
==
$exist
->
rule
)
{
if
(
false
==
$exist
||
false
==
$exist
->
rule
)
{
$this
->
code
=
-
1
;
$this
->
code
=
-
1
;
$this
->
msg
=
'设备号错误,请重新输入.'
;
$this
->
msg
=
'设备号错误,请重新输入.'
;
goto
doEnd
;
goto
doEnd
;
}
}
$miner_address
=
$data
[
'miner_address'
]
??
null
;
if
(
!
empty
(
$miner_address
))
{
$exist
=
AirDrop
::
find
()
->
where
([
'identifier'
=>
$identifier
,
'miner_address'
=>
$miner_address
])
->
one
();
if
(
false
==
$exist
)
{
$this
->
code
=
-
1
;
$this
->
msg
=
'设备号和矿工地址不匹配,请重新确认.'
;
goto
doEnd
;
}
}
doEnd
:
doEnd
:
return
[
'code'
=>
$this
->
code
,
'msg'
=>
$this
->
msg
,
'data'
=>
$this
->
data
];
return
[
'code'
=>
$this
->
code
,
'msg'
=>
$this
->
msg
,
'data'
=>
$this
->
data
];
}
}
...
...
common/models/Admin.php
View file @
2cf4eeb0
...
@@ -26,7 +26,7 @@ use yii\web\IdentityInterface;
...
@@ -26,7 +26,7 @@ use yii\web\IdentityInterface;
*/
*/
class
Admin
extends
\common\modelsgii\Admin
implements
IdentityInterface
class
Admin
extends
\common\modelsgii\Admin
implements
IdentityInterface
{
{
const
STATUS_DELETED
=
0
;
const
STATUS_DELETED
=
2
;
const
STATUS_ACTIVE
=
1
;
const
STATUS_ACTIVE
=
1
;
/**
/**
...
@@ -34,7 +34,7 @@ class Admin extends \common\modelsgii\Admin implements IdentityInterface
...
@@ -34,7 +34,7 @@ class Admin extends \common\modelsgii\Admin implements IdentityInterface
*/
*/
public
static
function
findIdentity
(
$uid
)
public
static
function
findIdentity
(
$uid
)
{
{
return
static
::
find
()
->
where
([
'uid'
=>
$uid
,
'status'
=>
self
::
STATUS_ACTIVE
])
->
one
();
return
static
::
find
()
->
where
([
'uid'
=>
$uid
])
->
one
();
}
}
/**
/**
...
@@ -45,7 +45,7 @@ class Admin extends \common\modelsgii\Admin implements IdentityInterface
...
@@ -45,7 +45,7 @@ class Admin extends \common\modelsgii\Admin implements IdentityInterface
*/
*/
public
static
function
findByUsername
(
$username
)
public
static
function
findByUsername
(
$username
)
{
{
return
static
::
findOne
([
'username'
=>
$username
,
'status'
=>
self
::
STATUS_ACTIVE
]);
return
static
::
findOne
([
'username'
=>
$username
]);
}
}
/**
/**
...
...
common/models/User.php
View file @
2cf4eeb0
...
@@ -23,8 +23,8 @@ use yii\web\IdentityInterface;
...
@@ -23,8 +23,8 @@ use yii\web\IdentityInterface;
*/
*/
class
User
extends
ActiveRecord
implements
IdentityInterface
class
User
extends
ActiveRecord
implements
IdentityInterface
{
{
const
STATUS_DELETED
=
0
;
const
STATUS_DELETED
=
2
;
const
STATUS_ACTIVE
=
1
0
;
const
STATUS_ACTIVE
=
1
;
const
AUTH_SUPER
=
'administrator'
;
const
AUTH_SUPER
=
'administrator'
;
...
...
common/service/exchange/Hd.php
View file @
2cf4eeb0
...
@@ -14,7 +14,7 @@ class Hd extends Exchange implements ExchangeInterface
...
@@ -14,7 +14,7 @@ class Hd extends Exchange implements ExchangeInterface
{
{
protected
$supported_symbol
=
'supported_symbol_hd'
;
protected
$supported_symbol
=
'supported_symbol_hd'
;
protected
$quotation_prefix
=
'quotation_hd_'
;
protected
$quotation_prefix
=
'quotation_hd_'
;
protected
$base_url
=
'https://app.honordecent.com/exchange/get
HdcCurrPrice
'
;
protected
$base_url
=
'https://app.honordecent.com/exchange/get
NowData
'
;
public
function
symbolExists
(
$tag
=
'HDC'
,
$aim
=
"USDT"
)
public
function
symbolExists
(
$tag
=
'HDC'
,
$aim
=
"USDT"
)
{
{
...
@@ -58,7 +58,7 @@ class Hd extends Exchange implements ExchangeInterface
...
@@ -58,7 +58,7 @@ class Hd extends Exchange implements ExchangeInterface
$res
=
$curl
->
get
(
$this
->
base_url
,
false
);
$res
=
$curl
->
get
(
$this
->
base_url
,
false
);
if
(
is_array
(
$res
)
&&
1
==
$res
[
'code'
])
{
if
(
is_array
(
$res
)
&&
1
==
$res
[
'code'
])
{
$key
=
$this
->
quotation_prefix
.
'HDCUSDT'
;
$key
=
$this
->
quotation_prefix
.
'HDCUSDT'
;
$this
->
redis
->
hmset
(
$key
,
'low'
,
$res
[
'data'
]
,
'high'
,
$res
[
'data'
],
'last'
,
$res
[
'data
'
]);
$this
->
redis
->
hmset
(
$key
,
'low'
,
$res
[
'data'
]
[
'currPrice'
],
'high'
,
$res
[
'data'
][
'currPrice'
],
'last'
,
$res
[
'data'
][
'currPrice'
],
'change'
,
$res
[
'data'
][
'range
'
]);
if
(
!
$this
->
redis
->
sismember
(
$this
->
supported_symbol
,
'HDCUSDT'
))
{
if
(
!
$this
->
redis
->
sismember
(
$this
->
supported_symbol
,
'HDCUSDT'
))
{
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'HDCUSDT'
);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'HDCUSDT'
);
}
}
...
...
common/service/exchange/factory/HdBuilder.php
View file @
2cf4eeb0
...
@@ -30,7 +30,7 @@ class HdBuilder extends FactoryService
...
@@ -30,7 +30,7 @@ class HdBuilder extends FactoryService
$ticker
=
[];
$ticker
=
[];
foreach
(
$symbol
as
$val
)
{
foreach
(
$symbol
as
$val
)
{
list
(
$low
,
$high
,
$last
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtoupper
(
$val
),
'low'
,
'high'
,
'last
'
);
list
(
$low
,
$high
,
$last
,
$change
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtoupper
(
$val
),
'low'
,
'high'
,
'last'
,
'change
'
);
$explode_arr
=
explode
(
'usdt'
,
$val
);
$explode_arr
=
explode
(
'usdt'
,
$val
);
$temp
=
[];
$temp
=
[];
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/USDT'
;
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/USDT'
;
...
@@ -39,7 +39,7 @@ class HdBuilder extends FactoryService
...
@@ -39,7 +39,7 @@ class HdBuilder extends FactoryService
$temp
[
'close'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$last
);
$temp
[
'close'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$last
);
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$last
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$last
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$last
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$last
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'change'
]
=
(
0
==
$low
)
?
0
:
(
float
)
sprintf
(
"%0.2f"
,
(
$last
-
$low
)
/
$low
*
100
);
$temp
[
'change'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$change
);
$temp
[
'high_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'high_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'low_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'low_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'high_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'high_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
...
...
wallet/controllers/UserController.php
View file @
2cf4eeb0
...
@@ -34,6 +34,12 @@ class UserController extends BaseController
...
@@ -34,6 +34,12 @@ class UserController extends BaseController
$code
=
-
1
;
$code
=
-
1
;
goto
doEnd
;
goto
doEnd
;
}
}
if
(
Admin
::
STATUS_DELETED
==
$user
->
status
)
{
$msg
=
'用户已停用'
;
$data
=
null
;
$code
=
-
1
;
goto
doEnd
;
}
$token
=
[
$token
=
[
'iss'
=>
'https://www.bitfeel.cn'
,
//签发者 可选
'iss'
=>
'https://www.bitfeel.cn'
,
//签发者 可选
'aud'
=>
'https://www.bitfeel.cn'
,
//接收该JWT的一方,可选
'aud'
=>
'https://www.bitfeel.cn'
,
//接收该JWT的一方,可选
...
...
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