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
1c1180ff
Commit
1c1180ff
authored
Apr 19, 2021
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
f85af2b0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
37 deletions
+16
-37
PlatformCoinsController.php
api/controllers/PlatformCoinsController.php
+14
-35
CoinPlatformCoins.php
common/models/psources/CoinPlatformCoins.php
+2
-2
No files found.
api/controllers/PlatformCoinsController.php
View file @
1c1180ff
...
...
@@ -106,8 +106,7 @@ class PlatformCoinsController extends BaseController
$platform_id
=
Yii
::
$app
->
request
->
post
(
'platform_id'
,
''
);
$coins_address
=
Yii
::
$app
->
request
->
post
(
'platform_coins'
,
''
);
$type
=
Yii
::
$app
->
request
->
post
(
'type'
,
''
);
$mobile
=
Yii
::
$app
->
request
->
post
(
'mobile'
,
''
);
$mail
=
Yii
::
$app
->
request
->
post
(
'mail'
,
''
);
$contact
=
Yii
::
$app
->
request
->
post
(
'contact'
,
''
);
$header
=
Yii
::
$app
->
request
->
headers
;
$deviceCode
=
$header
[
'FZM-REQUEST-UUID'
]
??
null
;
...
...
@@ -126,48 +125,28 @@ class PlatformCoinsController extends BaseController
return
[
'code'
=>
0
,
'data'
=>
null
,
'msg'
=>
'数据导入成功'
];
}
$item_array
=
[];
foreach
(
$coins_address
as
$item
)
{
$platform_coins_arr
=
explode
(
','
,
$item
);
$coin_name
=
$platform_coins_arr
[
0
];
$coins_address
=
$platform_coins_arr
[
1
];
if
(
empty
(
$coin_name
)
||
empty
(
$coins_address
))
continue
;
$isExistModel
=
CoinPlatformCoins
::
find
()
->
where
([
'coins_name'
=>
$coin_name
,
'coins_address'
=>
$coins_address
,
'platform_id'
=>
$platform_id
])
->
one
();
if
(
!
empty
(
$isExistModel
)
&&
empty
(
$isExistModel
->
deviceCode
))
{
$isExistModel
=
CoinPlatformCoins
::
find
()
->
where
([
'coins_name'
=>
$coin_name
,
'coins_address'
=>
$coins_address
,
'contact'
=>
$contact
])
->
one
();
if
(
$isExistModel
)
{
$isExistModel
->
update_time
=
date
(
'Y-m-d H:i:s'
);
}
else
{
$isExistModel
->
coins_name
=
$coin_name
;
$isExistModel
->
coins_address
=
$coins_address
;
$isExistModel
->
type
=
$type
;
$isExistModel
->
deviceCode
=
$deviceCode
;
$isExistModel
->
save
();
continue
;
}
// if (!empty($isExistModel) && strlen($isExistModel->deviceCode) > 0 && $isExistModel->deviceCode !== $deviceCode) {
// $isExistModel->deviceCode = $deviceCode;
// $isExistModel->save();
// continue;
// };
if
(
!
empty
(
$isExistModel
)
&&
$isExistModel
->
deviceCode
==
$deviceCode
)
{
continue
;
};
$item_array
[]
=
[
$coin_name
,
$coins_address
,
$type
,
$deviceCode
,
$platform_id
,
$device
,
$version
,
$mobile
,
$mail
];
}
if
(
empty
(
$item_array
))
{
return
[
'code'
=>
0
,
'data'
=>
null
,
'msg'
=>
'数据导入成功'
];
$isExistModel
->
platform_id
=
$platform_id
;
$isExistModel
->
device
=
$device
;
$isExistModel
->
version
=
$version
;
$isExistModel
->
contact
=
$contact
;
}
$result
=
CoinPlatformCoins
::
batchImport
(
$item_array
);
if
(
!
$result
)
{
return
[
'code'
=>
-
1
,
'data'
=>
null
,
'msg'
=>
'数据导入失败'
];
$isExistModel
->
save
();
}
return
[
'code'
=>
0
,
'data'
=>
null
,
'msg'
=>
'数据导入成功'
];
return
[
'code'
=>
$this
->
code
,
'data'
=>
$this
->
data
,
'msg'
=>
$this
->
msg
];
}
public
function
actionRelation
()
...
...
common/models/psources/CoinPlatformCoins.php
View file @
1c1180ff
...
...
@@ -26,14 +26,14 @@ class CoinPlatformCoins extends BaseActiveRecord
{
return
[
[[
'coins_name'
,
'coins_address'
,
'type'
,
'deviceCode'
,
'platform_id'
],
'required'
],
[[
'device'
,
'version'
,
'
mobile'
,
'mail
'
],
'safe'
],
[[
'device'
,
'version'
,
'
contact
'
],
'safe'
],
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'coins_name'
,
'coins_address'
,
'type'
,
'deviceCode'
,
'platform_id'
,
'device'
,
'version'
,
'
mobile'
,
'mail
'
],
self
::
SCENARIOS_CREATE
=>
[
'coins_name'
,
'coins_address'
,
'type'
,
'deviceCode'
,
'platform_id'
,
'device'
,
'version'
,
'
contact
'
],
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
...
...
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