Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Cong.Zhao
/
musician-api.hikoon.com
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
c140375e
...
c140375eda4ec4d342684a43f5d15522580398a0
authored
2021-11-17 10:57:18 +0800
by
lemon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改同步脚本
1 parent
aeef5467
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
app/Console/Commands/StakeholderIncomeSyncCommand.php
app/Helper/Http.php
app/Console/Commands/StakeholderIncomeSyncCommand.php
View file @
c140375
...
...
@@ -74,10 +74,10 @@ class StakeholderIncomeSyncCommand extends Command
$id
=
key
(
$msg
[
$key
]);
$serial_no
=
$msg
[
$key
][
$id
][
'serial_no'
];
$http_res
=
[];
Log
::
channel
(
'api'
)
->
warning
(
__METHOD__
.
"streamid:
{
$id
}
-即将处理任务"
,
[
'item'
=>
$msg
[
$key
][
$id
]]);
//获取记录
if
(
$http_data
=
$this
->
resolveSyncData
(
$serial_no
))
{
...
...
@@ -93,7 +93,7 @@ class StakeholderIncomeSyncCommand extends Command
Log
::
channel
(
'api'
)
->
info
(
__METHOD__
,
[
'msg'
=>
'找不到需要同步的对应的收益记录'
,
'serial_no'
=>
$serial_no
]);
}
$this
->
consumeTask
(
$redis
,
$key
,
$id
);
$this
->
consumeTask
(
$
http_res
,
$
redis
,
$key
,
$id
);
}
}
}
...
...
@@ -115,10 +115,10 @@ class StakeholderIncomeSyncCommand extends Command
'response_log'
=>
$response
]);
if
(
!
empty
(
$response
)
&&
(
$response
[
'code'
]
==
0
)
)
{
if
(
!
empty
(
$response
))
{
StakeholderIncomeSyncApp
::
query
()
->
where
([
'serial_no'
=>
$serial_no
])
->
update
([
'busi_id'
=>
$response
[
'id'
],
'sync_status'
=>
1
,
'sync_status'
=>
(
$response
[
'code'
]
==
0
)
?
1
:
2
,
]);
}
...
...
@@ -133,14 +133,17 @@ class StakeholderIncomeSyncCommand extends Command
}
/**
* 消费任务
* 将任务id标记为删除
* @param $http_res
* @param $redis
* @param $key
* @param $id
* @return mixed
*/
private
function
consumeTask
(
$redis
,
$key
,
$id
)
private
function
consumeTask
(
$
http_res
,
$
redis
,
$key
,
$id
)
{
return
$redis
->
xdel
(
$key
,
[
$id
]);
}
...
...
app/Helper/Http.php
View file @
c140375
...
...
@@ -33,12 +33,12 @@ class Http
$data
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
Log
::
info
(
__METHOD__
,
[
'url'
=>
$url
,
'params'
=>
$params
,
'data'
=>
$data
]);
Log
::
channel
(
'api'
)
->
info
(
__METHOD__
,
[
'url'
=>
$url
,
'params'
=>
$params
,
'data'
=>
$data
]);
return
$data
;
}
catch
(
\Exception
$e
)
{
Log
::
info
(
__METHOD__
,
[
'msg'
=>
$e
->
getMessage
()]);
Log
::
channel
(
'api'
)
->
info
(
__METHOD__
,
[
'msg'
=>
$e
->
getMessage
()]);
return
[];
}
}
...
...
@@ -57,12 +57,12 @@ class Http
$data
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
Log
::
info
(
__METHOD__
,
[
'url'
=>
$url
,
'data'
=>
$data
]);
Log
::
channel
(
'api'
)
->
info
(
__METHOD__
,
[
'url'
=>
$url
,
'data'
=>
$data
]);
return
$data
;
}
catch
(
\Exception
$e
)
{
Log
::
info
(
__METHOD__
,
[
'msg'
=>
$e
->
getMessage
()]);
Log
::
channel
(
'api'
)
->
info
(
__METHOD__
,
[
'msg'
=>
$e
->
getMessage
()]);
return
[];
}
}
...
...
Please
register
or
sign in
to post a comment