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
60971b5e
Commit
60971b5e
authored
Jul 03, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采用新表
parent
e553cb92
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
1 deletion
+49
-1
GameController.php
api/controllers/GameController.php
+24
-1
GameUserAddress.php
common/models/pwallet/GameUserAddress.php
+25
-0
No files found.
api/controllers/GameController.php
View file @
60971b5e
...
...
@@ -11,6 +11,7 @@ namespace api\controllers;
use
Yii
;
use
api\base\BaseController
;
use
common\models\pwallet\GameUser
;
use
common\models\pwallet\GameUserAddress
;
class
GameController
extends
BaseController
{
/**
...
...
@@ -54,13 +55,35 @@ class GameController extends BaseController {
return
[
'code'
=>
-
1
,
'msg'
=>
'Failed'
];
}
public
function
actionSaveGameInfo
(){
$post
=
Yii
::
$app
->
request
->
post
();
$address
=
$post
[
'address'
]
??
''
;
$nickname
=
$post
[
'nickname'
]
??
''
;
if
(
empty
(
$address
)
||
empty
(
$nickname
))
{
return
[
'code'
=>
-
1
,
'msg'
=>
'地址和昵称不能为空'
,
'data'
=>
null
];
}
//判断重复
$count
=
GameUserAddress
::
find
()
->
where
([
'address'
=>
$address
])
->
count
();
if
(
$count
>
0
)
{
return
[
'code'
=>
-
1
,
'msg'
=>
'地址已存在'
,
'data'
=>
null
];
}
// todo 保存
$models
=
new
GameUserAddress
();
$models
->
nickname
=
$nickname
;
$models
->
address
=
$address
;
if
(
$models
->
save
())
{
return
[
'code'
=>
0
,
'msg'
=>
'Succeed'
,
'data'
=>
$models
->
id
];
}
return
[
'code'
=>
-
1
,
'msg'
=>
'Failed'
,
'data'
=>
null
];
}
public
function
actionGetNicknameByAddressArr
(){
$address
=
Yii
::
$app
->
request
->
post
(
'address'
,
''
);
if
(
empty
(
$address
))
{
return
[
'code'
=>
-
1
,
'msg'
=>
'地址不能为空'
,
'data'
=>
''
];
}
//todo 获取地址
$address
=
GameUser
::
find
()
$address
=
GameUser
Address
::
find
()
->
select
([
'nickname'
,
'address'
])
->
where
([
'in'
,
'address'
,
$address
])
->
asArray
()
->
all
();
...
...
common/models/pwallet/GameUserAddress.php
0 → 100644
View file @
60971b5e
<?php
/**
* Created By Sublime text 3
* User: rlgyzhcn
* Date: 18-08-12
* Time: 下午14:17
*/
namespace
common\models\pwallet
;
use
common\core\BaseActiveRecord
;
use
Yii
;
class
GameUserAddress
extends
BaseActiveRecord
{
public
static
function
getDb
(){
return
Yii
::
$app
->
get
(
'db_pwallet'
);
}
public
function
formName
()
{
return
''
;
}
}
\ 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