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
095af285
Commit
095af285
authored
Jun 27, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分离接口
parent
e8a4b09a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
92 deletions
+13
-92
UserController.php
wallet/controllers/UserController.php
+11
-10
WalletController.php
wallet/controllers/WalletController.php
+2
-82
No files found.
wallet/controllers/UserController.php
View file @
095af285
...
...
@@ -18,20 +18,21 @@ class UserController extends BaseController
*/
public
function
actionLogin
()
{
$msg
=
'ok'
;
$code
=
0
;
$model
=
new
LoginForm
();
$model
->
setScenario
(
LoginForm
::
SCENARIOS_LOGIN
);
$model
->
load
(
Yii
::
$app
->
request
->
post
(),
''
);
if
(
$model
->
login
())
{
$response
=
[
'access_token'
=>
$model
->
login
(),
];
}
else
{
$error
=
implode
(
", "
,
\yii\helpers\ArrayHelper
::
getColumn
(
$model
->
errors
,
0
,
false
));
// Model's Errors string
$response
=
[
'msg'
=>
$error
];
if
(
!
$model
->
login
()){
$msg
=
implode
(
", "
,
\yii\helpers\ArrayHelper
::
getColumn
(
$model
->
errors
,
0
,
false
));
// Model's Errors string
$data
=
null
;
$code
=
-
1
;
goto
doEnd
;
}
return
$response
;
$data
=
[
'access_token'
=>
$model
->
login
()];
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
/**
...
...
wallet/controllers/WalletController.php
View file @
095af285
...
...
@@ -19,87 +19,6 @@ class WalletController extends BaseController
{
$platforms
=
CoinPlatform
::
find
()
->
asArray
()
->
all
();
return
$platforms
;
}
/**
* 用户同步
*/
public
function
actionUserSync
()
{
$header
=
Yii
::
$app
->
request
->
headers
;
$platform_id
=
$header
[
'platform_id'
]
??
17
;
$post
=
Yii
::
$app
->
request
->
post
();
$data
=
[
'bind_uid'
=>
$post
[
'bind_uid'
],
'username'
=>
$post
[
'username'
],
'salt'
=>
Yii
::
$app
->
security
->
generateRandomString
(),
'password'
=>
Yii
::
$app
->
security
->
generatePasswordHash
(
'123456'
),
'reg_time'
=>
time
(),
'reg_ip'
=>
ip2long
(
'127.0.0.1'
),
'last_login_time'
=>
0
,
'last_login_ip'
=>
ip2long
(
'127.0.0.1'
),
'update_time'
=>
0
,
'status'
=>
1
,
'platform_id'
=>
$platform_id
];
// $password = Yii::$app->security->generatePasswordHash('123456');
// $salt = Yii::$app->security->generateRandomString();
// $reg_time = time();
// $reg_ip = ip2long('127.0.0.1');
// $last_login_time = 0;
// $last_login_ip = ip2long('127.0.0.1');
// $update_time = 0;
// $status = 1;
// $additional = [$password, $salt, $reg_time, $reg_ip, $last_login_time, $last_login_ip, $update_time, $status];
$role
=
Yii
::
$app
->
request
->
post
(
'role'
,
'GHPwallet'
);
$model
=
new
Admin
();
if
(
$model
->
load
(
$data
,
''
)
&&
$model
->
save
())
{
$auth
=
Yii
::
$app
->
authManager
;
$role
=
$auth
->
getRole
(
$role
);
$auth
->
assign
(
$role
,
$model
->
uid
);
exit
;
}
else
{
var_dump
(
$model
->
errors
);
exit
;
}
}
/**
* 用户注册
*/
public
function
actionCreate
()
{
}
/**
* 重置密码
*/
public
function
actionResetPassword
()
{
}
/**
* 获取用户基本信息
* @return array
*/
public
function
actionView
()
{
}
/*
* 更改密码
* @return array
*/
public
function
actionUpdatePassword
()
{
return
[
'code'
=>
0
,
'msg'
=>
'ok'
,
'data'
=>
$platforms
];
}
}
\ 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