Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
bp
goods
Commits
fa50faa6
Commit
fa50faa6
authored
Sep 07, 2021
by
pengfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 团长分销-增加奖励脚本请求idgen服务异常报警
parent
1a1f019a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
20 deletions
+32
-20
Colonelorder.php
application/modules/Job/controllers/Colonelorder.php
+32
-20
No files found.
application/modules/Job/controllers/Colonelorder.php
View file @
fa50faa6
...
@@ -59,7 +59,16 @@ class ColonelorderController extends Job
...
@@ -59,7 +59,16 @@ class ColonelorderController extends Job
$this
->
getInviteOrderData
(
$userIds
,
$colonelPayInfoData
);
// 完成目标单数
$this
->
getInviteOrderData
(
$userIds
,
$colonelPayInfoData
);
// 完成目标单数
$this
->
getInviteNewUserData
(
$userIds
,
$colonelPayInfoData
);
// 邀请新用户奖励
$this
->
getInviteNewUserData
(
$userIds
,
$colonelPayInfoData
);
// 邀请新用户奖励
}
}
$this
->
handleSavePayInfo
(
$colonelPayInfoData
);
if
(
!
empty
(
$colonelPayInfoData
))
{
try
{
$this
->
loggerInfo
(
'colonelPayInfoCount='
.
count
(
$colonelPayInfoData
));
$colonelPayInfoData
=
$this
->
getFormatPayInfoData
(
$colonelPayInfoData
);
$this
->
handleSavePayInfo
(
$colonelPayInfoData
);
$this
->
loggerInfo
(
'success'
);
}
catch
(
Exception
$e
)
{
$this
->
loggerError
(
'error='
.
$e
->
getMessage
());
}
}
}
}
$this
->
loggerInfo
(
'end'
);
$this
->
loggerInfo
(
'end'
);
}
}
...
@@ -67,28 +76,26 @@ class ColonelorderController extends Job
...
@@ -67,28 +76,26 @@ class ColonelorderController extends Job
/**
/**
* Notes: 保存奖励信息
* Notes: 保存奖励信息
* User: pengfei@yidian-inc.com
* User: pengfei@yidian-inc.com
* Date: 2021/9/
3 4:34 下
午
* Date: 2021/9/
7 10:40 上
午
* @param $colonelPayInfoData
* @param $colonelPayInfoData
* @return bool
* @throws Exception
*/
*/
private
function
handleSavePayInfo
(
$colonelPayInfoData
)
private
function
handleSavePayInfo
(
$colonelPayInfoData
)
{
{
$this
->
loggerInfo
(
'colonelPayInfoCount='
.
count
(
$colonelPayInfoData
));
try
{
if
(
!
empty
(
$colonelPayInfoData
))
{
ColonelDistributorPayInfo
::
beginTransaction
();
$data
=
$this
->
getFormatPayInfoData
(
$colonelPayInfoData
);
if
(
!
$this
->
addColonelDistributorPayInfo
(
$colonelPayInfoData
))
{
try
{
throw
new
Exception
(
sprintf
(
"写入错误参数 %s"
,
json_encode
(
$colonelPayInfoData
)));
ColonelDistributorPayInfo
::
beginTransaction
();
}
if
(
!
$this
->
addColonelDistributorPayInfo
(
$data
))
{
if
(
!
ColonelDistributorPayInfo
::
commit
())
{
throw
new
Exception
(
sprintf
(
"写入错误参数 %s"
,
json_encode
(
$data
)));
throw
new
Exception
(
sprintf
(
"事务提交失败 %s"
,
json_encode
(
$colonelPayInfoData
)));
}
if
(
!
ColonelDistributorPayInfo
::
commit
())
{
throw
new
Exception
(
sprintf
(
"事务提交失败 %s"
,
json_encode
(
$data
)));
}
$this
->
loggerInfo
(
'success'
);
}
catch
(
Exception
$e
)
{
ColonelDistributorPayInfo
::
rollback
();
$this
->
loggerError
(
'error='
.
$e
->
getMessage
());
}
}
}
catch
(
Exception
$e
)
{
ColonelDistributorPayInfo
::
rollback
();
throw
new
Exception
(
$e
->
getMessage
());
}
}
return
true
;
}
}
/**
/**
...
@@ -211,21 +218,26 @@ class ColonelorderController extends Job
...
@@ -211,21 +218,26 @@ class ColonelorderController extends Job
/**
/**
* Notes: 获取pay_info数据
* Notes: 获取pay_info数据
* User: pengfei@yidian-inc.com
* User: pengfei@yidian-inc.com
* Date: 2021/9/
3 4:07 下
午
* Date: 2021/9/
7 10:34 上
午
* @param $data
* @param $data
* @return array
* @return array
* @throws Exception
*/
*/
private
function
getFormatPayInfoData
(
$data
)
:
array
private
function
getFormatPayInfoData
(
$data
)
:
array
{
{
$count
=
count
(
$data
);
$count
=
count
(
$data
);
$
res
=
Idgen
::
get
(
appConfig
(
'idgen.partner'
),
appConfig
(
'idgen.key'
),
[],
[
$
httpParams
=
[
[
[
'type'
=>
'goods'
,
'type'
=>
'goods'
,
'number'
=>
00
,
'number'
=>
00
,
'count'
=>
$count
'count'
=>
$count
]
]
]);
];
$res
=
Idgen
::
get
(
appConfig
(
'idgen.partner'
),
appConfig
(
'idgen.key'
),
[],
$httpParams
);
$ids
=
$res
[
'id_datetime'
][
'goods'
]
??
[];
$ids
=
$res
[
'id_datetime'
][
'goods'
]
??
[];
if
(
$count
>
count
(
$ids
))
{
throw
new
Exception
(
'请求idgen服务失败,request:'
.
json_encode
(
$httpParams
)
.
';response:'
.
json_encode
(
$res
));
}
foreach
(
$data
as
$key
=>
$item
)
{
foreach
(
$data
as
$key
=>
$item
)
{
$data
[
$key
][
'pay_info_trade_id'
]
=
$ids
[
$key
];
$data
[
$key
][
'pay_info_trade_id'
]
=
$ids
[
$key
];
}
}
...
...
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