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
7a15756a
Commit
7a15756a
authored
Aug 01, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
游戏
parent
e98655fe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
GameController.php
api/controllers/GameController.php
+15
-10
No files found.
api/controllers/GameController.php
View file @
7a15756a
...
@@ -13,14 +13,16 @@ use api\base\BaseController;
...
@@ -13,14 +13,16 @@ use api\base\BaseController;
use
common\models\pwallet\GameUser
;
use
common\models\pwallet\GameUser
;
use
common\models\pwallet\GameUserAddress
;
use
common\models\pwallet\GameUserAddress
;
class
GameController
extends
BaseController
{
class
GameController
extends
BaseController
{
/**
/**
* 保存地址与昵称
* 保存地址与昵称
*/
*/
public
function
actionSaveAddressAndNickname
(){
public
function
actionSaveAddressAndNickname
()
{
$post
=
Yii
::
$app
->
request
->
post
();
$post
=
Yii
::
$app
->
request
->
post
();
$address
=
$post
[
'address'
]
??
''
;
$address
=
$post
[
'address'
]
??
''
;
$nickname
=
$post
[
'nickname'
]
??
''
;
$nickname
=
$post
[
'nickname'
]
??
''
;
if
(
empty
(
$address
)
||
empty
(
$nickname
))
{
if
(
empty
(
$address
)
||
empty
(
$nickname
))
{
return
[
'code'
=>
-
1
,
'msg'
=>
'地址和昵称不能为空'
,
'data'
=>
''
];
return
[
'code'
=>
-
1
,
'msg'
=>
'地址和昵称不能为空'
,
'data'
=>
''
];
}
}
...
@@ -42,7 +44,8 @@ class GameController extends BaseController {
...
@@ -42,7 +44,8 @@ class GameController extends BaseController {
/**
/**
* 根据地址获取昵称
* 根据地址获取昵称
*/
*/
public
function
actionGetNicknameByAddress
(){
public
function
actionGetNicknameByAddress
()
{
$address
=
Yii
::
$app
->
request
->
post
(
'address'
,
''
);
$address
=
Yii
::
$app
->
request
->
post
(
'address'
,
''
);
if
(
empty
(
$address
))
{
if
(
empty
(
$address
))
{
return
[
'code'
=>
-
1
,
'msg'
=>
'地址不能为空'
,
'data'
=>
''
];
return
[
'code'
=>
-
1
,
'msg'
=>
'地址不能为空'
,
'data'
=>
''
];
...
@@ -50,12 +53,13 @@ class GameController extends BaseController {
...
@@ -50,12 +53,13 @@ class GameController extends BaseController {
//todo 获取地址
//todo 获取地址
$address
=
GameUser
::
find
()
->
select
([
'nickname'
])
->
where
([
'address'
=>
$address
])
->
one
();
$address
=
GameUser
::
find
()
->
select
([
'nickname'
])
->
where
([
'address'
=>
$address
])
->
one
();
if
(
!
empty
(
$address
))
{
if
(
!
empty
(
$address
))
{
return
[
'code'
=>
0
,
'msg'
=>
'Succeed'
,
'data'
=>
$address
];
return
[
'code'
=>
0
,
'msg'
=>
'Succeed'
,
'data'
=>
$address
];
}
}
return
[
'code'
=>
-
1
,
'msg'
=>
'Failed'
];
return
[
'code'
=>
-
1
,
'msg'
=>
'Failed'
];
}
}
public
function
actionSaveGameInfo
(){
public
function
actionSaveGameInfo
()
{
$post
=
Yii
::
$app
->
request
->
post
();
$post
=
Yii
::
$app
->
request
->
post
();
$address
=
$post
[
'address'
]
??
''
;
$address
=
$post
[
'address'
]
??
''
;
$nickname
=
$post
[
'nickname'
]
??
''
;
$nickname
=
$post
[
'nickname'
]
??
''
;
...
@@ -77,7 +81,8 @@ class GameController extends BaseController {
...
@@ -77,7 +81,8 @@ class GameController extends BaseController {
return
[
'code'
=>
-
1
,
'msg'
=>
'Failed'
,
'data'
=>
null
];
return
[
'code'
=>
-
1
,
'msg'
=>
'Failed'
,
'data'
=>
null
];
}
}
public
function
actionGetNicknameByAddressArr
(){
public
function
actionGetNicknameByAddressArr
()
{
$address
=
Yii
::
$app
->
request
->
post
(
'address'
,
''
);
$address
=
Yii
::
$app
->
request
->
post
(
'address'
,
''
);
if
(
empty
(
$address
))
{
if
(
empty
(
$address
))
{
return
[
'code'
=>
-
1
,
'msg'
=>
'地址不能为空'
,
'data'
=>
''
];
return
[
'code'
=>
-
1
,
'msg'
=>
'地址不能为空'
,
'data'
=>
''
];
...
@@ -85,10 +90,10 @@ class GameController extends BaseController {
...
@@ -85,10 +90,10 @@ class GameController extends BaseController {
//todo 获取地址
//todo 获取地址
$address
=
GameUserAddress
::
find
()
$address
=
GameUserAddress
::
find
()
->
select
([
'nickname'
,
'address'
])
->
select
([
'nickname'
,
'address'
])
->
where
([
'in'
,
'address'
,
$address
])
->
where
([
'in'
,
'address'
,
$address
])
->
asArray
()
->
all
();
->
asArray
()
->
all
();
if
(
!
empty
(
$address
))
{
if
(
!
empty
(
$address
))
{
return
[
'code'
=>
0
,
'msg'
=>
'Succeed'
,
'data'
=>
$address
];
return
[
'code'
=>
0
,
'msg'
=>
'Succeed'
,
'data'
=>
$address
];
}
}
return
[
'code'
=>
-
1
,
'msg'
=>
'Failed'
];
return
[
'code'
=>
-
1
,
'msg'
=>
'Failed'
];
}
}
...
...
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