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
c654b467
Commit
c654b467
authored
Jul 02, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量导入用户
parent
27539997
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
13 deletions
+29
-13
LoginStatusAuthInterceptor.php
common/behaviors/LoginStatusAuthInterceptor.php
+1
-1
UserAuthInterceptor.php
common/behaviors/UserAuthInterceptor.php
+1
-1
Admin.php
common/models/Admin.php
+7
-0
UserController.php
wallet/controllers/UserController.php
+20
-11
No files found.
common/behaviors/LoginStatusAuthInterceptor.php
View file @
c654b467
...
...
@@ -20,7 +20,7 @@ class LoginStatusAuthInterceptor extends ActionFilter
{
$request_class
=
get_class
(
$action
->
controller
);
$request_action
=
$action
->
id
;
if
(
strpos
(
$request_class
,
'UserController'
)
!==
false
&&
strpos
(
$request_action
,
'login'
)
!==
false
){
if
(
strpos
(
$request_class
,
'UserController'
)){
return
true
;
}
$token_string
=
Yii
::
$app
->
request
->
headers
->
get
(
'Token'
);
...
...
common/behaviors/UserAuthInterceptor.php
View file @
c654b467
...
...
@@ -23,7 +23,7 @@ class UserAuthInterceptor extends ActionFilter
$request_class
=
get_class
(
$action
->
controller
);
$request_action
=
$action
->
id
;
if
(
strpos
(
$request_class
,
'UserController'
)
!==
false
&&
strpos
(
$request_action
,
'login'
)
!==
false
){
if
(
strpos
(
$request_class
,
'UserController'
)
!==
false
){
return
true
;
}
$token_string
=
Yii
::
$app
->
request
->
headers
->
get
(
'Token'
);
...
...
common/models/Admin.php
View file @
c654b467
...
...
@@ -182,4 +182,11 @@ class Admin extends \common\modelsgii\Admin implements IdentityInterface
$this
->
access_token
=
Yii
::
$app
->
security
->
generateRandomString
();
return
$this
->
access_token
;
}
public
static
function
loadArray
(
array
$data
)
{
return
self
::
getDb
()
->
createCommand
()
->
batchInsert
(
self
::
tableName
(),
[
'bind_uid'
,
'username'
,
'salt'
,
'password'
,
'reg_time'
,
'reg_ip'
,
'last_login_time'
,
'last_login_ip'
,
'update_time'
,
'status'
,
'platform_id'
],
$data
)
->
execute
();
}
}
wallet/controllers/UserController.php
View file @
c654b467
...
...
@@ -40,6 +40,26 @@ class UserController extends BaseController
*/
public
function
actionUserSync
()
{
$items
=
Yii
::
$app
->
request
->
post
();
foreach
(
$items
[
'items'
]
as
$key
=>
$item
){
$datas
[]
=
[
$item
[
'bind_uid'
],
$item
[
'username'
],
Yii
::
$app
->
security
->
generateRandomString
(),
Yii
::
$app
->
security
->
generatePasswordHash
(
'123456'
),
time
(),
ip2long
(
'127.0.0.1'
),
0
,
ip2long
(
'127.0.0.1'
),
0
,
1
,
$item
[
'platform'
]
];
}
Admin
::
loadArray
(
$datas
);
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'数据更新成功'
];
$header
=
Yii
::
$app
->
request
->
headers
;
$platform_id
=
$header
[
'platform_id'
]
??
17
;
...
...
@@ -57,16 +77,6 @@ class UserController extends BaseController
'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
();
...
...
@@ -78,7 +88,6 @@ class UserController extends BaseController
}
else
{
var_dump
(
$model
->
errors
);
exit
;
}
}
...
...
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