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
8ac488e5
Commit
8ac488e5
authored
Jun 19, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步用户接口
parent
1e858c3a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
1 deletion
+96
-1
UserController.php
api/controllers/UserController.php
+92
-0
Admin.php
common/models/Admin.php
+1
-0
Admin.php
common/modelsgii/Admin.php
+3
-1
No files found.
api/controllers/UserController.php
0 → 100644
View file @
8ac488e5
<?php
namespace
api\controllers
;
use
common\models\Admin
;
use
Yii
;
use
api\base\BaseController
;
class
UserController
extends
BaseController
{
/**
* 用户同步
*/
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
()
{
}
}
\ No newline at end of file
common/models/Admin.php
View file @
8ac488e5
...
...
@@ -19,6 +19,7 @@ use yii\web\IdentityInterface;
* @property string $last_login_ip
* @property string $update_time
* @property integer $status
* @property integer $platform_id
*/
class
Admin
extends
\common\modelsgii\Admin
implements
IdentityInterface
{
...
...
common/modelsgii/Admin.php
View file @
8ac488e5
...
...
@@ -17,6 +17,7 @@ use yii\helpers\HtmlPurifier;
* @property string $last_login_ip
* @property string $update_time
* @property integer $status
* @property integer $platform_id
*/
class
Admin
extends
\common\core\BaseActiveRecord
{
...
...
@@ -42,7 +43,7 @@ class Admin extends \common\core\BaseActiveRecord
return
HtmlPurifier
::
process
(
$str
);
}
],
[[
'reg_time'
,
'reg_ip'
,
'last_login_time'
,
'last_login_ip'
,
'update_time'
,
'status'
],
'integer'
],
[[
'reg_time'
,
'reg_ip'
,
'last_login_time'
,
'last_login_ip'
,
'update_time'
,
'status'
,
'platform_id'
],
'integer'
],
[[
'username'
],
'string'
,
'max'
=>
32
],
[[
'password'
],
'string'
,
'min'
=>
6
,
'max'
=>
60
],
[[
'salt'
],
'string'
,
'max'
=>
32
],
...
...
@@ -65,6 +66,7 @@ class Admin extends \common\core\BaseActiveRecord
'last_login_ip'
=>
'Last Login Ip'
,
'update_time'
=>
'Update Time'
,
'status'
=>
'Status'
,
'platform_id'
=>
'platform_id'
,
'group'
=>
'group'
];
}
...
...
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