Commit 417366c5 authored by pengfei's avatar pengfei

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

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