Commit 417366c5 authored by pengfei's avatar pengfei

update 团长分销-下单活动日期问题修复

parent f862e8f8
......@@ -7,7 +7,6 @@
use App\Base\Job;
use App\Models\marketing\mysql\ColonelDistributorPayInfo;
use App\Exception\custom\InterfaceException;
use Api\PhpUtils\Http\HttpUtil;
use Api\PhpUtils\Log\JobLog;
......@@ -21,8 +20,7 @@ class ColonelwalletController extends Job
/**
* Notes: 奖励结算脚本
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 6:03 下午
* @throws InterfaceException
* Date: 2021/9/9 11:17 上午
*/
public function indexAction()
{
......@@ -30,14 +28,15 @@ class ColonelwalletController extends Job
$payInfoList = $this->getPayInfoList();
$this->loggerInfo('payInfoCount=' . count($payInfoList));
if (!empty($payInfoList)) {
if ($this->deductingInventory($payInfoList)) {
if ($this->toWallet($payInfoList)) {
if ($this->handlePayInfoStatus(array_column($payInfoList, 'pay_info_id'))) {
$this->loggerInfo('success');
} else {
$this->loggerError('更新状态失败');
try {
if ($this->deductingInventory($payInfoList)) {
if ($this->toWallet($payInfoList)) {
$this->handlePayInfoStatus(array_column($payInfoList, 'pay_info_id'));
}
}
$this->loggerInfo('success');
} catch (Exception $e) {
$this->loggerError('error:' . $e->getMessage());
}
}
$this->loggerInfo('end');
......@@ -49,12 +48,12 @@ class ColonelwalletController extends Job
* Date: 2021/9/3 6:04 下午
* @param $payInfoList
* @return bool
* @throws InterfaceException
* @throws Exception
*/
private function toWallet($payInfoList): bool
{
if (!$url = config('interface', 'wallet.account.transfer')) {
throw new InterfaceException(['cus' => 0]);
throw new Exception('没有wallet.account.transfer配置');
}
$httpParams = self::getWalletHttpParams();
$list = [];
......@@ -77,8 +76,7 @@ class ColonelwalletController extends Job
$this->loggerInfo('调用钱包服务成功,count=' . count($payInfoList));
return true;
} else {
$this->loggerError('调用钱包服务失败,httpParams=' . json_encode($httpParams));
return false;
throw new Exception('调用钱包服务失败,httpParams=' . json_encode($httpParams));
}
}
......@@ -89,12 +87,12 @@ class ColonelwalletController extends Job
* Date: 2021/9/3 6:04 下午
* @param $payInfoList
* @return bool
* @throws InterfaceException
* @throws Exception
*/
private function deductingInventory($payInfoList): bool
{
if (!$url = config('interface', 'coupon.capitalpool.grant_user_amount')) {
throw new InterfaceException(['cus' => 0]);
throw new Exception('没有grant_user_amount配置');
}
$httpParams = [
'capital_pool_id' => self::CAPITAL_POOL_ID
......@@ -112,13 +110,11 @@ class ColonelwalletController extends Job
}
$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'])) {
$this->loggerInfo('调用资金池服务成功,count=' . count($payInfoList));
return true;
} else {
$this->loggerError('调用资金池服务失败,httpParams=' . json_encode($httpParams));
return false;
throw new Exception('调用资金池服务失败,httpParams=' . json_encode($httpParams));
}
}
......@@ -180,17 +176,23 @@ class ColonelwalletController extends Job
return $desc;
}
/**
* Notes: 修改状态
* User: pengfei@yidian-inc.com
* Date: 2021/9/3 6:09 下
* Date: 2021/9/9 11:15 上
* @param array $payInfoIds
* @return bool
* @throws Exception
*/
private function handlePayInfoStatus(array $payInfoIds): bool
{
return ColonelDistributorPayInfo::updateRecord(['status' => ColonelDistributorPayInfo::STATUS_USE],
$upStatus = ColonelDistributorPayInfo::updateRecord(['status' => ColonelDistributorPayInfo::STATUS_USE],
['pay_info_id' => $payInfoIds]);
if (empty($upStatus)) {
throw new Exception('更新pay_info状态失败.pay_info_ids=' . implode(',',$payInfoIds));
}
return $upStatus;
}
/**
......
......@@ -35,9 +35,10 @@ class PindanActivityInviteOrderService
return true;
}
$timeRange = PindanActivityColonelConfigService::getActivityTimeRange();
$inviteOrderNumData = [
"colonel_user_id" => $params["colonel_user_id"],
"date" => date("Y-m-d")
"date" => $timeRange['date']
];
$inviteOrderNum = ColonelDistributorInviteOrderNum::selectMaster("*", $inviteOrderNumData, []);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment