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
c961677c
Commit
c961677c
authored
Sep 03, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'colonel' of
https://git.yidian-inc.com:8021/bp/goods
into colonel
parents
c1a11906
1789292b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
136 additions
and
79 deletions
+136
-79
Colonelorder.php
application/modules/Job/controllers/Colonelorder.php
+35
-29
Colonelwallet.php
application/modules/Job/controllers/Colonelwallet.php
+80
-35
ColonelService.php
application/services/marketing/ColonelService.php
+20
-14
PindanActivityColonelConfigService.php
...services/marketing/PindanActivityColonelConfigService.php
+1
-1
No files found.
application/modules/Job/controllers/Colonelorder.php
View file @
c961677c
...
@@ -72,7 +72,7 @@ class ColonelorderController extends Job
...
@@ -72,7 +72,7 @@ class ColonelorderController extends Job
*/
*/
private
function
handleSavePayInfo
(
$colonelPayInfoData
)
private
function
handleSavePayInfo
(
$colonelPayInfoData
)
{
{
$this
->
loggerInfo
(
'colonelPayInfoCount='
.
count
(
$colonelPayInfoData
));
$this
->
loggerInfo
(
'colonelPayInfoCount='
.
count
(
$colonelPayInfoData
));
if
(
!
empty
(
$colonelPayInfoData
))
{
if
(
!
empty
(
$colonelPayInfoData
))
{
$data
=
$this
->
getFormatPayInfoData
(
$colonelPayInfoData
);
$data
=
$this
->
getFormatPayInfoData
(
$colonelPayInfoData
);
try
{
try
{
...
@@ -83,9 +83,10 @@ class ColonelorderController extends Job
...
@@ -83,9 +83,10 @@ class ColonelorderController extends Job
if
(
!
ColonelDistributorPayInfo
::
commit
())
{
if
(
!
ColonelDistributorPayInfo
::
commit
())
{
throw
new
Exception
(
sprintf
(
"事务提交失败 %s"
,
json_encode
(
$data
)));
throw
new
Exception
(
sprintf
(
"事务提交失败 %s"
,
json_encode
(
$data
)));
}
}
$this
->
loggerError
(
'success'
);
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
ColonelDistributorPayInfo
::
rollback
();
ColonelDistributorPayInfo
::
rollback
();
$this
->
loggerError
(
'error='
.
$e
->
getMessage
());
$this
->
loggerError
(
'error='
.
$e
->
getMessage
());
}
}
}
}
}
}
...
@@ -103,16 +104,15 @@ class ColonelorderController extends Job
...
@@ -103,16 +104,15 @@ class ColonelorderController extends Job
if
(
$inviteNewUserList
=
$this
->
getInviteNewUserList
(
$userIds
))
{
if
(
$inviteNewUserList
=
$this
->
getInviteNewUserList
(
$userIds
))
{
$userNickList
=
$this
->
getUserList
(
array_column
(
$inviteNewUserList
,
'user_id'
));
$userNickList
=
$this
->
getUserList
(
array_column
(
$inviteNewUserList
,
'user_id'
));
foreach
(
$inviteNewUserList
as
$newUser
)
{
foreach
(
$inviteNewUserList
as
$newUser
)
{
$payInfo
=
[
$colonelPayInfoData
[]
=
[
'colonel_user_id'
=>
$newUser
[
'inviter_user_id'
],
'date'
=>
$this
->
settlementDate
,
'date'
=>
$this
->
settlementDate
,
'type'
=>
ColonelDistributorPayInfo
::
TYPE_NEW_USER
,
'type'
=>
ColonelDistributorPayInfo
::
TYPE_NEW_USER
,
'reward'
=>
self
::
INVITE_NEW_USER_REWARD
,
'reward'
=>
self
::
INVITE_NEW_USER_REWARD
,
'finish_num'
=>
1
,
'finish_num'
=>
1
,
'invite_user_id'
=>
$newUser
[
'user_id'
],
'invite_user_id'
=>
$newUser
[
'user_id'
],
'invite_user_nick'
=>
empty
(
$userNickList
[
$newUser
[
'user_id'
]][
'user_nick'
])
?
''
:
$userNickList
[
$newUser
[
'user_id'
]][
'user_nick'
],
'invite_user_nick'
=>
empty
(
$userNickList
[
$newUser
[
'user_id'
]][
'user_nick'
])
?
''
:
$userNickList
[
$newUser
[
'user_id'
]][
'user_nick'
],
'colonel_user_id'
=>
$newUser
[
'inviter_user_id'
],
];
];
$colonelPayInfoData
[]
=
$payInfo
;
}
}
}
}
}
}
...
@@ -131,16 +131,15 @@ class ColonelorderController extends Job
...
@@ -131,16 +131,15 @@ class ColonelorderController extends Job
foreach
(
$inviteOrderNumList
as
$orderNum
)
{
foreach
(
$inviteOrderNumList
as
$orderNum
)
{
foreach
(
$this
->
colonelConfigList
as
$config
)
{
foreach
(
$this
->
colonelConfigList
as
$config
)
{
if
(
$orderNum
[
'num'
]
>=
$config
[
'assess_order_num'
])
{
if
(
$orderNum
[
'num'
]
>=
$config
[
'assess_order_num'
])
{
$payInfo
=
[
$colonelPayInfoData
[]
=
[
'colonel_user_id'
=>
$orderNum
[
'colonel_user_id'
],
'date'
=>
$this
->
settlementDate
,
'date'
=>
$this
->
settlementDate
,
'type'
=>
ColonelDistributorPayInfo
::
TYPE_FINISH_TARGET
,
'type'
=>
ColonelDistributorPayInfo
::
TYPE_FINISH_TARGET
,
'reward'
=>
$config
[
'reward_amount'
]
*
self
::
REWARD_UNIT
,
'reward'
=>
$config
[
'reward_amount'
]
*
self
::
REWARD_UNIT
,
'finish_num'
=>
$config
[
'assess_order_num'
],
'finish_num'
=>
$config
[
'assess_order_num'
],
'invite_user_id'
=>
0
,
'invite_user_id'
=>
0
,
'invite_user_nick'
=>
''
,
'invite_user_nick'
=>
''
,
'colonel_user_id'
=>
$orderNum
[
'colonel_user_id'
],
];
];
$colonelPayInfoData
[]
=
$payInfo
;
}
}
}
}
}
}
...
@@ -154,17 +153,20 @@ class ColonelorderController extends Job
...
@@ -154,17 +153,20 @@ class ColonelorderController extends Job
*/
*/
private
function
getColonelConfig
(
$yesterday
)
:
array
private
function
getColonelConfig
(
$yesterday
)
:
array
{
{
$config
=
ColonelDistributorConfig
::
getRecord
([
'date'
=>
$yesterday
,
'type'
=>
ColonelDistributorConfig
::
TYPE_COLONEL
]);
$config
=
ColonelDistributorConfig
::
getRecord
([
'date'
=>
$yesterday
,
'type'
=>
ColonelDistributorConfig
::
TYPE_COLONEL
]);
if
(
empty
(
$config
))
{
if
(
empty
(
$config
))
{
$config
=
ColonelDistributorConfig
::
getRecord
([
$config
=
ColonelDistributorConfig
::
getRecord
([
'date[<=]'
=>
$yesterday
,
'date[<=]'
=>
$yesterday
,
'ORDER'
=>
[
'date'
=>
'DESC'
],
'ORDER'
=>
[
'date'
=>
'DESC'
],
'LIMIT'
=>
1
'LIMIT'
=>
1
]);
]);
}
}
$configData
=
[];
$configData
=
[];
if
(
empty
(
$config
[
'data'
]))
{
if
(
empty
(
$config
[
'data'
]))
{
$configData
=
json_decode
(
$config
[
'data'
],
true
);
$configData
=
json_decode
(
$config
[
'data'
],
true
);
}
}
return
$configData
;
return
$configData
;
}
}
...
@@ -180,7 +182,7 @@ class ColonelorderController extends Job
...
@@ -180,7 +182,7 @@ class ColonelorderController extends Job
return
ColonelDistributorInviteOrderNum
::
getRecords
(
return
ColonelDistributorInviteOrderNum
::
getRecords
(
[
[
'colonel_user_id'
=>
$colonelUserIds
,
'colonel_user_id'
=>
$colonelUserIds
,
'date'
=>
$date
,
'date'
=>
$date
,
],
],
[
'colonel_user_id'
,
'num'
]
[
'colonel_user_id'
,
'num'
]
);
);
...
@@ -201,7 +203,8 @@ class ColonelorderController extends Job
...
@@ -201,7 +203,8 @@ class ColonelorderController extends Job
throw
new
InterfaceException
([
'cus'
=>
0
]);
throw
new
InterfaceException
([
'cus'
=>
0
]);
}
}
$res
=
HttpUtil
::
get
(
$url
,
[
'user_ids'
=>
$userIds
,
'start_time'
=>
$this
->
startTime
,
'end_time'
=>
$this
->
endTime
]);
$res
=
HttpUtil
::
get
(
$url
,
[
'user_ids'
=>
$userIds
,
'start_time'
=>
$this
->
startTime
,
'end_time'
=>
$this
->
endTime
]);
if
(
!
empty
(
$res
[
'response'
][
'result'
]))
{
if
(
!
empty
(
$res
[
'response'
][
'result'
]))
{
return
array_values
(
array_column
(
$res
[
'response'
][
'result'
],
null
,
'user_id'
));
return
array_values
(
array_column
(
$res
[
'response'
][
'result'
],
null
,
'user_id'
));
}
}
...
@@ -218,10 +221,13 @@ class ColonelorderController extends Job
...
@@ -218,10 +221,13 @@ class ColonelorderController extends Job
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'
),
[],
[[
$res
=
Idgen
::
get
(
appConfig
(
'idgen.partner'
),
appConfig
(
'idgen.key'
),
[],
[
'type'
=>
'goods'
,
[
'number'
=>
00
,
'type'
=>
'goods'
,
'count'
=>
$count
]]);
'number'
=>
00
,
'count'
=>
$count
]
]);
$ids
=
$res
[
'id_datetime'
][
'goods'
]
??
[];
$ids
=
$res
[
'id_datetime'
][
'goods'
]
??
[];
foreach
(
$data
as
$key
=>
$item
)
{
foreach
(
$data
as
$key
=>
$item
)
{
$data
[
$key
][
'colonel_distributor_pay_info_id'
]
=
$ids
[
$key
];
$data
[
$key
][
'colonel_distributor_pay_info_id'
]
=
$ids
[
$key
];
...
@@ -262,7 +268,7 @@ class ColonelorderController extends Job
...
@@ -262,7 +268,7 @@ class ColonelorderController extends Job
*/
*/
private
function
loggerInfo
(
$log
)
private
function
loggerInfo
(
$log
)
{
{
FileLog
::
info
(
'colonel_distributor_order'
,
'colonel_distributor_order:'
.
$log
,
false
,
true
);
FileLog
::
info
(
'colonel_distributor_order'
,
'colonel_distributor_order:'
.
$log
,
false
,
true
);
}
}
/**
/**
...
...
application/modules/Job/controllers/Colonelwallet.php
View file @
c961677c
...
@@ -28,11 +28,13 @@ class ColonelwalletController extends Job
...
@@ -28,11 +28,13 @@ class ColonelwalletController extends Job
{
{
$this
->
loggerInfo
(
'start'
);
$this
->
loggerInfo
(
'start'
);
$payInfoList
=
$this
->
getPayInfoList
();
$payInfoList
=
$this
->
getPayInfoList
();
$this
->
loggerInfo
(
'payInfoCount='
.
count
(
$payInfoList
));
$this
->
loggerInfo
(
'payInfoCount='
.
count
(
$payInfoList
));
if
(
!
empty
(
$payInfoList
))
{
if
(
!
empty
(
$payInfoList
))
{
if
(
$this
->
deductingInventory
(
$payInfoList
))
{
if
(
$this
->
deductingInventory
(
$payInfoList
))
{
if
(
$this
->
toWallet
(
$payInfoList
))
{
if
(
$this
->
toWallet
(
$payInfoList
))
{
$this
->
handlePayInfoStatus
(
array_column
(
$payInfoList
,
'pay_info_id'
));
if
(
$this
->
handlePayInfoStatus
(
array_column
(
$payInfoList
,
'pay_info_id'
)))
{
$this
->
loggerInfo
(
'success'
);
}
}
}
}
}
}
}
...
@@ -52,26 +54,28 @@ class ColonelwalletController extends Job
...
@@ -52,26 +54,28 @@ class ColonelwalletController extends Job
if
(
!
$url
=
config
(
'interface'
,
'wallet.account.transfer'
))
{
if
(
!
$url
=
config
(
'interface'
,
'wallet.account.transfer'
))
{
throw
new
InterfaceException
([
'cus'
=>
0
]);
throw
new
InterfaceException
([
'cus'
=>
0
]);
}
}
$data
=
[];
$httpParams
=
self
::
getWalletHttpParams
();
$list
=
[];
foreach
(
$payInfoList
as
$payInfo
)
{
foreach
(
$payInfoList
as
$payInfo
)
{
$
tmp
=
[];
$
list
[]
=
[
$tmp
[
'user_id'
]
=
$payInfo
[
'colonel_user_id'
];
'user_id'
=>
$payInfo
[
'colonel_user_id'
],
$tmp
[
'service_name'
]
=
self
::
WALLET_SERVICE_NAME
;
'service_name'
=>
self
::
WALLET_SERVICE_NAME
,
$tmp
[
'source_name'
]
=
self
::
WALLET_SOURCE_NAME
;
'source_name'
=>
self
::
WALLET_SOURCE_NAME
,
$tmp
[
'third_order_id'
]
=
$payInfo
[
'colonel_distributor_pay_info_id'
];
'third_order_id'
=>
$payInfo
[
'colonel_distributor_pay_info_id'
],
$tmp
[
'third_order_id_type'
]
=
$payInfo
[
'type'
];
'third_order_id_type'
=>
$payInfo
[
'type'
],
$tmp
[
'third_order_desc'
]
=
self
::
getThirdOrderDesc
(
$payInfo
);
'third_order_desc'
=>
self
::
getThirdOrderDesc
(
$payInfo
),
$tmp
[
'amount'
]
=
$payInfo
[
'reward'
];
'amount'
=>
$payInfo
[
'reward'
],
$tmp
[
'extra'
]
=
$payInfo
;
'extra'
=>
$payInfo
$data
[]
=
$tmp
;
]
;
}
}
$res
=
HttpUtil
::
post
(
$url
,
[
'list'
=>
$data
]);
$httpParams
[
'list'
]
=
$list
;
if
(
!
empty
(
$res
[
'response'
][
'result'
])
&&
$res
[
'code'
]
==
0
)
{
$response
=
HttpUtil
::
post
(
$url
,
$httpParams
,
100000
,
3
);
$this
->
loggerInfo
(
'写入钱包成功'
);
$this
->
loggerInfo
(
"url=
$url
,response:"
.
json_encode
(
$response
));
if
(
!
empty
(
$response
[
'response'
][
'result'
])
&&
$response
[
'code'
]
==
0
)
{
$this
->
loggerInfo
(
'调用钱包服务成功,count='
.
count
(
$payInfoList
));
return
true
;
return
true
;
}
else
{
}
else
{
$msg
=
json_encode
([
'list'
=>
$data
]);
$this
->
loggerError
(
'调用钱包服务失败,httpParams='
.
json_encode
(
$httpParams
));
$this
->
loggerError
(
$msg
);
return
false
;
return
false
;
}
}
}
}
...
@@ -90,28 +94,68 @@ class ColonelwalletController extends Job
...
@@ -90,28 +94,68 @@ class ColonelwalletController extends Job
if
(
!
$url
=
config
(
'interface'
,
'coupon.capitalpool.grant_user_amount'
))
{
if
(
!
$url
=
config
(
'interface'
,
'coupon.capitalpool.grant_user_amount'
))
{
throw
new
InterfaceException
([
'cus'
=>
0
]);
throw
new
InterfaceException
([
'cus'
=>
0
]);
}
}
$data
[
'capital_pool_id'
]
=
self
::
CAPITAL_POOL_ID
;
$httpParams
=
[
'capital_pool_id'
=>
self
::
CAPITAL_POOL_ID
];
$body
=
[];
foreach
(
$payInfoList
as
$payInfo
)
{
foreach
(
$payInfoList
as
$payInfo
)
{
$
tmp
=
[];
$
body
[]
=
[
$tmp
[
'op'
]
=
self
::
CAPITAL_POOL_OP
;
'op'
=>
self
::
CAPITAL_POOL_OP
,
$tmp
[
'user_id'
]
=
$payInfo
[
'colonel_user_id'
];
'user_id'
=>
$payInfo
[
'colonel_user_id'
],
$tmp
[
'amount'
]
=
$payInfo
[
'reward'
];
'amount'
=>
$payInfo
[
'reward'
],
$tmp
[
'third_order_id'
]
=
$payInfo
[
'colonel_distributor_pay_info_id'
];
'third_order_id'
=>
$payInfo
[
'colonel_distributor_pay_info_id'
],
$tmp
[
'third_order_id_type'
]
=
$payInfo
[
'type'
];
'third_order_id_type'
=>
$payInfo
[
'type'
],
$tmp
[
'third_order_desc'
]
=
self
::
getThirdOrderDesc
(
$payInfo
);
'third_order_desc'
=>
self
::
getThirdOrderDesc
(
$payInfo
),
$data
[
'body'
][]
=
$tmp
;
]
;
}
}
$res
=
HttpUtil
::
post
(
$url
,
$data
,
100000
,
3
);
$httpParams
[
'body'
]
=
$body
;
$res
=
HttpUtil
::
post
(
$url
,
$httpParams
,
100000
,
3
);
$this
->
loggerInfo
(
"url=
$url
,response:"
.
json_encode
(
$res
));
if
(
$res
[
'code'
]
==
0
&&
isset
(
$res
[
'response'
][
'result'
]))
{
if
(
$res
[
'code'
]
==
0
&&
isset
(
$res
[
'response'
][
'result'
]))
{
$this
->
loggerInfo
(
'
资金池授予用户奖励成功,count='
.
count
(
$payInfoList
));
$this
->
loggerInfo
(
'
调用资金池服务成功,count='
.
count
(
$payInfoList
));
return
true
;
return
true
;
}
else
{
}
else
{
$msg
=
json_encode
([
'list'
=>
$data
]);
$this
->
loggerError
(
'调用资金池服务失败,httpParams='
.
json_encode
(
$httpParams
));
$this
->
loggerError
(
"资金池授予用户奖励成功,
$msg
"
);
return
false
;
return
false
;
}
}
}
}
/**
* Notes: 获取钱包服务请求参数
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 7:34 下午
* @return array
*/
private
function
getWalletHttpParams
()
:
array
{
// TODO 此处看后期业务发展 看是否需要封装WalletSdk
$date
=
date
(
'Y-m-d H:i:s'
);
return
[
'transfer_service_id'
=>
''
,
//TODO
'sign'
=>
self
::
getWalletHttpSign
(
$date
),
'time'
=>
$date
];
}
/**
* Notes: 获取钱包签名
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 7:34 下午
* @param $date
* @return string
*/
private
function
getWalletHttpSign
(
$date
)
:
string
{
$transfer_service_secret
=
''
;
//TODO
return
md5
(
$date
.
$transfer_service_secret
);
}
/**
* Notes: 获取待结算数据
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 7:23 下午
* @return array
*/
private
function
getPayInfoList
()
:
array
private
function
getPayInfoList
()
:
array
{
{
return
ColonelDistributorPayInfo
::
getRecords
([
'status'
=>
ColonelDistributorPayInfo
::
STATUS_NOT_USE
]);
return
ColonelDistributorPayInfo
::
getRecords
([
'status'
=>
ColonelDistributorPayInfo
::
STATUS_NOT_USE
]);
...
@@ -128,9 +172,9 @@ class ColonelwalletController extends Job
...
@@ -128,9 +172,9 @@ class ColonelwalletController extends Job
{
{
$desc
=
''
;
$desc
=
''
;
if
(
$payInfo
[
'type'
]
==
ColonelDistributorPayInfo
::
TYPE_NEW_USER
)
{
if
(
$payInfo
[
'type'
]
==
ColonelDistributorPayInfo
::
TYPE_NEW_USER
)
{
$desc
=
"邀请新用户("
.
$payInfo
[
"invite_user_nick"
]
.
")完成下单奖励"
;
$desc
=
"邀请新用户("
.
$payInfo
[
"invite_user_nick"
]
.
")完成下单奖励"
;
}
elseif
(
$payInfo
[
'type'
]
==
ColonelDistributorPayInfo
::
TYPE_FINISH_TARGET
)
{
}
elseif
(
$payInfo
[
'type'
]
==
ColonelDistributorPayInfo
::
TYPE_FINISH_TARGET
)
{
$desc
=
"完成"
.
$payInfo
[
"finish_num"
]
.
"单用户下单奖励"
;
$desc
=
"完成"
.
$payInfo
[
"finish_num"
]
.
"单用户下单奖励"
;
}
}
return
$desc
;
return
$desc
;
}
}
...
@@ -144,7 +188,8 @@ class ColonelwalletController extends Job
...
@@ -144,7 +188,8 @@ class ColonelwalletController extends Job
*/
*/
private
function
handlePayInfoStatus
(
array
$payInfoIds
)
:
bool
private
function
handlePayInfoStatus
(
array
$payInfoIds
)
:
bool
{
{
return
ColonelDistributorPayInfo
::
updateRecord
([
'status'
=>
ColonelDistributorPayInfo
::
STATUS_USE
],
[
'pay_info_id'
=>
$payInfoIds
]);
return
ColonelDistributorPayInfo
::
updateRecord
([
'status'
=>
ColonelDistributorPayInfo
::
STATUS_USE
],
[
'pay_info_id'
=>
$payInfoIds
]);
}
}
/**
/**
...
@@ -155,7 +200,7 @@ class ColonelwalletController extends Job
...
@@ -155,7 +200,7 @@ class ColonelwalletController extends Job
*/
*/
private
function
loggerInfo
(
$log
)
private
function
loggerInfo
(
$log
)
{
{
FileLog
::
info
(
'colonel_distributor_wallet'
,
'colonel_distributor_wallet:'
.
$log
,
false
,
true
);
FileLog
::
info
(
'colonel_distributor_wallet'
,
'colonel_distributor_wallet:'
.
$log
,
false
,
true
);
}
}
/**
/**
...
...
application/services/marketing/ColonelService.php
View file @
c961677c
...
@@ -66,7 +66,8 @@ class ColonelService
...
@@ -66,7 +66,8 @@ class ColonelService
*/
*/
public
static
function
isApply
(
$userId
)
:
array
public
static
function
isApply
(
$userId
)
:
array
{
{
$applyInfo
=
ColonelDistributorColonelApply
::
getRecord
([
'user_id'
=>
$userId
],
[
'colonel_apply_id'
,
'audit_status'
]);
$applyInfo
=
ColonelDistributorColonelApply
::
getRecord
([
'user_id'
=>
$userId
],
[
'colonel_apply_id'
,
'audit_status'
]);
return
[
return
[
// -1.未申请 0.未审核 1.审核通过 2.审核未通过
// -1.未申请 0.未审核 1.审核通过 2.审核未通过
'apply_status'
=>
isset
(
$applyInfo
[
'audit_status'
])
?
intval
(
$applyInfo
[
'audit_status'
])
:
-
1
'apply_status'
=>
isset
(
$applyInfo
[
'audit_status'
])
?
intval
(
$applyInfo
[
'audit_status'
])
:
-
1
...
@@ -83,12 +84,13 @@ class ColonelService
...
@@ -83,12 +84,13 @@ class ColonelService
*/
*/
public
static
function
getManageApplyList
(
array
$params
)
:
array
public
static
function
getManageApplyList
(
array
$params
)
:
array
{
{
$params
=
self
::
getPageParams
(
$params
);
$params
=
self
::
getPageParams
(
$params
);
$result
=
ColonelDistributorColonelApply
::
getPages
([],
ColonelDistributorColonelApply
::
DEFAULT_COLUMN
,
$params
[
'page'
],
$params
[
'page_size'
]);
$result
=
ColonelDistributorColonelApply
::
getPages
([],
ColonelDistributorColonelApply
::
DEFAULT_COLUMN
,
$params
[
'page'
],
$params
[
'page_size'
]);
if
(
empty
(
$result
[
'count'
]))
{
if
(
empty
(
$result
[
'count'
]))
{
return
$result
;
return
$result
;
}
}
$userMap
=
self
::
getUserMap
(
array_column
(
$result
[
'result'
],
'user_id'
));
$userMap
=
self
::
getUserMap
(
array_column
(
$result
[
'result'
],
'user_id'
));
$takePlaceMap
=
self
::
getColonelTakePlaceMap
(
array_column
(
$result
[
'result'
],
'colonel_apply_id'
));
$takePlaceMap
=
self
::
getColonelTakePlaceMap
(
array_column
(
$result
[
'result'
],
'colonel_apply_id'
));
foreach
(
$result
[
'result'
]
as
&
$applyVal
)
{
foreach
(
$result
[
'result'
]
as
&
$applyVal
)
{
$applyVal
[
'user_avatar'
]
=
!
empty
(
$userMap
[
$applyVal
[
'user_id'
]][
'user_avatar'
])
?
$userMap
[
$applyVal
[
'user_id'
]][
'user_avatar'
]
:
''
;
$applyVal
[
'user_avatar'
]
=
!
empty
(
$userMap
[
$applyVal
[
'user_id'
]][
'user_avatar'
])
?
$userMap
[
$applyVal
[
'user_id'
]][
'user_avatar'
]
:
''
;
...
@@ -114,8 +116,9 @@ class ColonelService
...
@@ -114,8 +116,9 @@ class ColonelService
*/
*/
public
static
function
getManageList
(
array
$params
)
:
array
public
static
function
getManageList
(
array
$params
)
:
array
{
{
$params
=
self
::
getPageParams
(
$params
);
$params
=
self
::
getPageParams
(
$params
);
$result
=
ColonelDistributorColonel
::
getPages
([],
ColonelDistributorColonel
::
DEFAULT_COLUMN
,
$params
[
'page'
],
$params
[
'page_size'
]);
$result
=
ColonelDistributorColonel
::
getPages
([],
ColonelDistributorColonel
::
DEFAULT_COLUMN
,
$params
[
'page'
],
$params
[
'page_size'
]);
if
(
empty
(
$result
[
'count'
]))
{
if
(
empty
(
$result
[
'count'
]))
{
return
$result
;
return
$result
;
}
}
...
@@ -124,9 +127,9 @@ class ColonelService
...
@@ -124,9 +127,9 @@ class ColonelService
$incomeMap
=
PindanActivityInviteOrderService
::
incomeStatistics
([
"user_ids"
=>
$userIds
]);
$incomeMap
=
PindanActivityInviteOrderService
::
incomeStatistics
([
"user_ids"
=>
$userIds
]);
foreach
(
$result
[
'result'
]
as
&
$colonelVal
)
{
foreach
(
$result
[
'result'
]
as
&
$colonelVal
)
{
$userId
=
$colonelVal
[
'user_id'
];
$userId
=
$colonelVal
[
'user_id'
];
$colonelVal
[
'user_avatar'
]
=
!
empty
(
$userMap
[
$userId
][
'user_avatar'
])
?
$userMap
[
$userId
][
'user_avatar'
]
:
''
;
$colonelVal
[
'user_avatar'
]
=
!
empty
(
$userMap
[
$userId
][
'user_avatar'
])
?
$userMap
[
$userId
][
'user_avatar'
]
:
''
;
$colonelVal
[
'yesterday_income'
]
=
!
empty
(
$incomeMap
[
$userId
][
'yesterday_reward'
])
?
$incomeMap
[
$userId
][
'yesterday_reward'
]
:
0
;
$colonelVal
[
'yesterday_income'
]
=
!
empty
(
$incomeMap
[
$userId
][
'yesterday_reward'
])
?
$incomeMap
[
$userId
][
'yesterday_reward'
]
:
0
;
$colonelVal
[
'total_income'
]
=
!
empty
(
$incomeMap
[
$userId
][
'all_reward'
])
?
$incomeMap
[
$userId
][
'all_reward'
]
:
0
;
$colonelVal
[
'total_income'
]
=
!
empty
(
$incomeMap
[
$userId
][
'all_reward'
])
?
$incomeMap
[
$userId
][
'all_reward'
]
:
0
;
}
}
unset
(
$colonelVal
);
unset
(
$colonelVal
);
return
$result
;
return
$result
;
...
@@ -144,7 +147,8 @@ class ColonelService
...
@@ -144,7 +147,8 @@ class ColonelService
public
static
function
handleManageAudit
(
$applyId
,
$auditStatus
)
:
bool
public
static
function
handleManageAudit
(
$applyId
,
$auditStatus
)
:
bool
{
{
// 审核状态参数检测
// 审核状态参数检测
if
(
!
in_array
(
$auditStatus
,
[
ColonelDistributorColonelApply
::
STATUS_PASS
,
ColonelDistributorColonelApply
::
STATUS_REJECT
]))
{
if
(
!
in_array
(
$auditStatus
,
[
ColonelDistributorColonelApply
::
STATUS_PASS
,
ColonelDistributorColonelApply
::
STATUS_REJECT
]))
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS
);
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS
);
}
}
// 审核状态数据检测
// 审核状态数据检测
...
@@ -155,7 +159,8 @@ class ColonelService
...
@@ -155,7 +159,8 @@ class ColonelService
try
{
try
{
ColonelDistributorColonelApply
::
beginTransaction
();
ColonelDistributorColonelApply
::
beginTransaction
();
// 修改申请状态
// 修改申请状态
$updateStatus
=
ColonelDistributorColonelApply
::
updateRecord
([
'audit_status'
=>
$auditStatus
],
[
'colonel_apply_id'
=>
$applyId
,
'audit_status'
=>
ColonelDistributorColonelApply
::
STATUS_AUDIT
]);
$updateStatus
=
ColonelDistributorColonelApply
::
updateRecord
([
'audit_status'
=>
$auditStatus
],
[
'colonel_apply_id'
=>
$applyId
,
'audit_status'
=>
ColonelDistributorColonelApply
::
STATUS_AUDIT
]);
if
(
empty
(
$updateStatus
))
{
if
(
empty
(
$updateStatus
))
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS_FAILED
);
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS_FAILED
);
}
}
...
@@ -265,7 +270,7 @@ class ColonelService
...
@@ -265,7 +270,7 @@ class ColonelService
*/
*/
private
static
function
getUserMap
(
array
$userIds
)
:
array
private
static
function
getUserMap
(
array
$userIds
)
:
array
{
{
$userWechatList
=
UserWechatBind
::
getRecords
([
'user_id'
=>
$userIds
],
[
'user_id'
,
'user_nick'
,
'user_avatar'
]);
$userWechatList
=
UserWechatBind
::
getRecords
([
'user_id'
=>
$userIds
],
[
'user_id'
,
'user_nick'
,
'user_avatar'
]);
return
array_column
((
array
)
$userWechatList
,
null
,
'user_id'
);
return
array_column
((
array
)
$userWechatList
,
null
,
'user_id'
);
}
}
...
@@ -278,7 +283,8 @@ class ColonelService
...
@@ -278,7 +283,8 @@ class ColonelService
*/
*/
private
static
function
getColonelTakePlaceMap
(
array
$colonelApplyIds
)
:
array
private
static
function
getColonelTakePlaceMap
(
array
$colonelApplyIds
)
:
array
{
{
$colonels
=
ColonelDistributorColonel
::
getRecords
([
'colonel_apply_id'
=>
$colonelApplyIds
],
[
'colonel_apply_id'
,
'take_place_id'
]);
$colonels
=
ColonelDistributorColonel
::
getRecords
([
'colonel_apply_id'
=>
$colonelApplyIds
],
[
'colonel_apply_id'
,
'take_place_id'
]);
return
array_column
((
array
)
$colonels
,
'take_place_id'
,
'colonel_apply_id'
);
return
array_column
((
array
)
$colonels
,
'take_place_id'
,
'colonel_apply_id'
);
}
}
...
@@ -291,8 +297,8 @@ class ColonelService
...
@@ -291,8 +297,8 @@ class ColonelService
*/
*/
private
static
function
getPageParams
(
array
$params
=
[])
:
array
private
static
function
getPageParams
(
array
$params
=
[])
:
array
{
{
$params
[
'page'
]
=
!
empty
(
$params
[
'page'
])
?
$params
[
'page'
]
:
1
;
$params
[
'page'
]
=
!
empty
(
$params
[
'page'
])
?
$params
[
'page'
]
:
1
;
$params
[
'page_size'
]
=
!
empty
(
$params
[
'page_size'
])
?
$params
[
'page_size'
]
:
20
;
$params
[
'page_size'
]
=
!
empty
(
$params
[
'page_size'
])
?
$params
[
'page_size'
]
:
20
;
return
$params
;
return
$params
;
}
}
}
}
application/services/marketing/PindanActivityColonelConfigService.php
View file @
c961677c
...
@@ -139,7 +139,7 @@ class PindanActivityColonelConfigService
...
@@ -139,7 +139,7 @@ class PindanActivityColonelConfigService
{
{
// 获取活动时间范围 例如活动时间(2021-09-03) --- 2021-09-03:12:00:00 - 2021-09-04:12:00:00
// 获取活动时间范围 例如活动时间(2021-09-03) --- 2021-09-03:12:00:00 - 2021-09-04:12:00:00
$hour
=
' '
.
self
::
ACTIVITY_DEFAULT_HOUR
.
':00:00'
;
$hour
=
' '
.
self
::
ACTIVITY_DEFAULT_HOUR
.
':00:00'
;
if
(
date
(
'H'
)
>=
12
)
{
if
(
date
(
'H'
)
>=
self
::
ACTIVITY_DEFAULT_HOUR
)
{
$startTime
=
date
(
'Y-m-d'
)
.
$hour
;
$startTime
=
date
(
'Y-m-d'
)
.
$hour
;
$endTime
=
date
(
'Y-m-d'
,
strtotime
(
'+1 day'
))
.
$hour
;
$endTime
=
date
(
'Y-m-d'
,
strtotime
(
'+1 day'
))
.
$hour
;
}
else
{
}
else
{
...
...
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