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
1d717ea8
Commit
1d717ea8
authored
Nov 21, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
9a9a1dc7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
21 deletions
+91
-21
CoinSupportedCurrency.php
common/models/psources/CoinSupportedCurrency.php
+3
-3
WalletController.php
wallet/controllers/WalletController.php
+88
-18
No files found.
common/models/psources/CoinSupportedCurrency.php
View file @
1d717ea8
...
@@ -27,7 +27,7 @@ class CoinSupportedCurrency extends BaseActiveRecord
...
@@ -27,7 +27,7 @@ class CoinSupportedCurrency extends BaseActiveRecord
{
{
return
[
return
[
[[
'platform_id'
,
'currency_id'
],
'required'
],
[[
'platform_id'
,
'currency_id'
],
'required'
],
[[
'platform_id'
,
'currency_id'
],
'integer'
],
[[
'platform_id'
,
'currency_id'
,
'sort'
],
'integer'
],
];
];
}
}
...
@@ -42,8 +42,8 @@ class CoinSupportedCurrency extends BaseActiveRecord
...
@@ -42,8 +42,8 @@ class CoinSupportedCurrency extends BaseActiveRecord
public
function
scenarios
()
public
function
scenarios
()
{
{
$scenarios
=
[
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'platform_id'
,
'currency_id'
],
self
::
SCENARIOS_CREATE
=>
[
'platform_id'
,
'currency_id'
,
'sort'
],
self
::
SCENARIOS_UPDATE
=>
[
'id'
,
'platform_id'
,
'currency_id'
],
self
::
SCENARIOS_UPDATE
=>
[
'id'
,
'platform_id'
,
'currency_id'
,
'sort'
],
];
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
}
...
...
wallet/controllers/WalletController.php
View file @
1d717ea8
...
@@ -108,16 +108,15 @@ class WalletController extends BaseController
...
@@ -108,16 +108,15 @@ class WalletController extends BaseController
$code
=
0
;
$code
=
0
;
$msg
=
'success'
;
$msg
=
'success'
;
$data
=
null
;
$data
=
null
;
$current_platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
Yii
::
$app
->
request
->
isGet
)
{
if
(
Yii
::
$app
->
request
->
isGet
)
{
if
(
1
===
$current_platform_id
)
{
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
0
);
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
1
);
if
(
false
==
$platform_id
)
{
$
platform_id
=
empty
(
$platform_id
)
?
1
:
$platform_id
;
$
msg
=
'参数错误'
;
}
else
{
$code
=
-
1
;
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
()
;
goto
doEnd
;
}
}
$coin_currency
=
CoinCurrency
::
find
()
->
select
(
'id, pj_name, pj_symbol'
)
->
asArray
()
->
all
();
$coin_currency
=
CoinCurrency
::
find
()
->
select
(
'id, pj_name'
)
->
asArray
()
->
all
();
$coin_supported_currency
=
CoinSupportedCurrency
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
asArray
()
->
all
();
$coin_supported_currency
=
CoinSupportedCurrency
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
asArray
()
->
all
();
$coin_supported_currency_id
=
ArrayHelper
::
getColumn
(
$coin_supported_currency
,
'currency_id'
);
$coin_supported_currency_id
=
ArrayHelper
::
getColumn
(
$coin_supported_currency
,
'currency_id'
);
...
@@ -131,23 +130,94 @@ class WalletController extends BaseController
...
@@ -131,23 +130,94 @@ class WalletController extends BaseController
goto
doEnd
;
goto
doEnd
;
}
}
if
(
Yii
::
$app
->
request
->
isPut
)
{
if
(
Yii
::
$app
->
request
->
isPost
)
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
1
!=
$platform_id
)
{
$msg
=
'权限未开通'
;
$code
=
-
1
;
goto
doEnd
;
}
$params
=
Yii
::
$app
->
request
->
post
();
$params
=
Yii
::
$app
->
request
->
post
();
$currency_ids
=
isset
(
$params
[
'currency_id'
])
?
$params
[
'currency_id'
]
:
null
;
$platform_id
=
isset
(
$params
[
'platform_id'
])
?
$params
[
'platform_id'
]
:
null
;
if
(
false
==
$currency_ids
)
{
$currency_id
=
isset
(
$params
[
'currency_id'
])
?
$params
[
'currency_id'
]
:
null
;
$msg
=
'参数错误'
;
$sort
=
isset
(
$params
[
'sort'
])
?
$params
[
'sort'
]
:
1
;
$datas
=
[
'platform_id'
=>
$platform_id
,
'currency_id'
=>
$currency_id
,
'sort'
=>
$sort
];
$isExist
=
CoinSupportedCurrency
::
find
()
->
where
([
'platform_id'
=>
$platform_id
,
'currency_id'
=>
$currency_id
])
->
one
();
if
(
false
!=
$isExist
)
{
$msg
=
'记录已存在'
;
$code
=
-
1
;
goto
doEnd
;
}
$model
=
new
CoinSupportedCurrency
();
$model
->
setScenario
(
CoinSupportedCurrency
::
SCENARIOS_CREATE
);
$model
->
load
(
$datas
,
''
);
if
(
!
$model
->
validate
())
{
$msg
=
$model
->
errors
;
$code
=
-
1
;
$code
=
-
1
;
goto
doEnd
;
goto
doEnd
;
}
}
CoinSupportedCurrency
::
deleteAll
([
'in'
,
'platform_id'
,
$current_platform_id
]);
$model
->
save
();
goto
doEnd
;
}
$currency_id_arr
=
explode
(
','
,
$currency_ids
);
if
(
Yii
::
$app
->
request
->
isPut
)
{
foreach
(
$currency_id_arr
as
$val
)
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
$datas
[]
=
[
if
(
1
!=
$platform_id
)
{
$current_platform_id
,
(
int
)
$val
$msg
=
'权限未开通'
;
$code
=
-
1
;
goto
doEnd
;
}
$params
=
Yii
::
$app
->
request
->
post
();
$id
=
isset
(
$params
[
'id'
])
?
$params
[
'id'
]
:
null
;
$platform_id
=
isset
(
$params
[
'platform_id'
])
?
$params
[
'platform_id'
]
:
null
;
$currency_id
=
isset
(
$params
[
'currency_id'
])
?
$params
[
'currency_id'
]
:
null
;
$sort
=
isset
(
$params
[
'sort'
])
?
$params
[
'sort'
]
:
1
;
$datas
=
[
'platform_id'
=>
$platform_id
,
'currency_id'
=>
$currency_id
,
'sort'
=>
$sort
,
'id'
=>
$id
];
];
$model
=
CoinSupportedCurrency
::
find
()
->
where
([
'id'
=>
$id
])
->
one
();
if
(
false
==
$model
)
{
$msg
=
'记录未存在'
;
$code
=
-
1
;
goto
doEnd
;
}
$model
->
setScenario
(
CoinSupportedCurrency
::
SCENARIOS_UPDATE
);
$model
->
load
(
$datas
,
''
);
if
(
!
$model
->
validate
())
{
$msg
=
$model
->
errors
;
$code
=
-
1
;
goto
doEnd
;
}
$model
->
save
();
goto
doEnd
;
}
if
(
Yii
::
$app
->
request
->
isDelete
)
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
1
!=
$platform_id
)
{
$msg
=
'权限未开通'
;
$code
=
-
1
;
goto
doEnd
;
}
$params
=
Yii
::
$app
->
request
->
get
();
$id
=
isset
(
$params
[
'id'
])
?
$params
[
'id'
]
:
null
;
$model
=
CoinSupportedCurrency
::
find
()
->
where
([
'id'
=>
$id
])
->
one
();
if
(
false
==
$model
)
{
$msg
=
'记录未存在'
;
$code
=
-
1
;
goto
doEnd
;
}
}
CoinSupportedCurrency
::
loadArray
(
$datas
);
$model
->
delete
(
);
goto
doEnd
;
goto
doEnd
;
}
}
...
...
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