Commit 952d24ec authored by pengfei's avatar pengfei

Merge branch 'colonel' into develop

parents 515e9658 f862e8f8
...@@ -36,10 +36,7 @@ class ColonelorderController extends Job ...@@ -36,10 +36,7 @@ class ColonelorderController extends Job
public function init() public function init()
{ {
parent::init(); parent::init();
$timeRange = PindanActivityColonelConfigService::getSettlementTimeRange(); $this->loadTimeConfig();
$this->settlementDate = $timeRange['date'];
$this->startTime = $timeRange['start_time'];
$this->endTime = $timeRange['end_time'];
$this->colonelConfigList = $this->getColonelConfig($this->settlementDate); $this->colonelConfigList = $this->getColonelConfig($this->settlementDate);
} }
...@@ -267,6 +264,28 @@ class ColonelorderController extends Job ...@@ -267,6 +264,28 @@ class ColonelorderController extends Job
return (int)ColonelDistributorPayInfo::save($data); return (int)ColonelDistributorPayInfo::save($data);
} }
/**
* Notes: 加载配置
* User: pengfei@yidian-inc.com
* Date: 2021/9/8 7:43 下午
*/
private function loadTimeConfig()
{
// 如果传入时间-使用指定时间
$params = $this->getRequest()->getParams();
if (empty($params['date']) || strtotime($params['date'])) {
$timeRange = PindanActivityColonelConfigService::getSettlementTimeRange();
$this->settlementDate = $timeRange['date'];
$this->startTime = $timeRange['start_time'];
$this->endTime = $timeRange['end_time'];
} else {
$hour = PindanActivityColonelConfigService::ACTIVITY_DEFAULT_HOUR;
$this->settlementDate = $params['date'];
$this->startTime = "{$params['date']} $hour:00:00";
$this->endTime = strtotime($this->startTime . ' +1 day');
}
}
/** /**
* Notes: 记录 info 日志 * Notes: 记录 info 日志
* User: pengfei@yidian-inc.com * User: pengfei@yidian-inc.com
......
...@@ -49,11 +49,11 @@ class ColonelService ...@@ -49,11 +49,11 @@ class ColonelService
$colonelData['take_place_name'] = "【团长】{$colonelData['take_place_name']}"; $colonelData['take_place_name'] = "【团长】{$colonelData['take_place_name']}";
} }
if (!$applyId = ColonelDistributorColonelApply::insertRecord($colonelData)) { if (!$applyId = ColonelDistributorColonelApply::insertRecord($colonelData)) {
throw new MarketingException(MarketingException::COLONEL_APPLY_FAILED); throw new Exception(MarketingException::COLONEL_APPLY_FAILED);
} }
return $applyId; return $applyId;
} catch (Exception $e) { } catch (Exception $e) {
throw new MarketingException(MarketingException::COLONEL_APPLY_FAILED); throw new MarketingException($e->getMessage());
} }
} }
...@@ -171,21 +171,21 @@ class ColonelService ...@@ -171,21 +171,21 @@ class ColonelService
['colonel_apply_id' => $applyId, 'audit_status[!]' => ColonelDistributorColonelApply::STATUS_PASS] ['colonel_apply_id' => $applyId, 'audit_status[!]' => ColonelDistributorColonelApply::STATUS_PASS]
); );
if (empty($updateStatus)) { if (empty($updateStatus)) {
throw new MarketingException(MarketingException::COLONEL_AUDIT_STATUS_FAILED); throw new Exception(MarketingException::COLONEL_AUDIT_STATUS_FAILED);
} }
// 审核成功 // 审核成功
if ($auditStatus == ColonelDistributorColonelApply::STATUS_PASS) { if ($auditStatus == ColonelDistributorColonelApply::STATUS_PASS) {
if (!self::handleAuditSuccess((array)$applyInfo)) { if (!self::handleAuditSuccess((array)$applyInfo)) {
throw new MarketingException(MarketingException::COLONEL_ADD_FAILED); throw new Exception(MarketingException::COLONEL_ADD_FAILED);
} }
} }
if (!ColonelDistributorColonelApply::commit()) { if (!ColonelDistributorColonelApply::commit()) {
throw new MarketingException(MarketingException::COMMIT_ERROR); throw new Exception(MarketingException::COMMIT_ERROR);
} }
return true; return true;
} catch (MarketingException $e) { } catch (Exception $e) {
ColonelDistributorColonelApply::rollback(); ColonelDistributorColonelApply::rollback();
throw new MarketingException($e->getCode()); throw new MarketingException($e->getMessage());
} }
} }
...@@ -232,19 +232,19 @@ class ColonelService ...@@ -232,19 +232,19 @@ class ColonelService
ColonelDistributorColonel::beginTransaction(); ColonelDistributorColonel::beginTransaction();
// 添加自提点 // 添加自提点
if (!$takePlaceId = TakePlaceService::add($params)) { if (!$takePlaceId = TakePlaceService::add($params)) {
throw new MarketingException(MarketingException::COLONEL_TAKE_PLACE_FAILED); throw new Exception(MarketingException::COLONEL_TAKE_PLACE_FAILED);
} }
// 修改自提点id // 修改自提点id
if (!ColonelDistributorColonel::updateRecord(['take_place_id' => $takePlaceId], $where)) { if (!ColonelDistributorColonel::updateRecord(['take_place_id' => $takePlaceId], $where)) {
throw new MarketingException(MarketingException::COLONEL_TAKE_PLACE_EDIT_FAILED); throw new Exception(MarketingException::COLONEL_TAKE_PLACE_EDIT_FAILED);
} }
if (!ColonelDistributorColonel::commit()) { if (!ColonelDistributorColonel::commit()) {
throw new MarketingException(MarketingException::COMMIT_ERROR); throw new Exception(MarketingException::COMMIT_ERROR);
} }
return (int)$takePlaceId; return (int)$takePlaceId;
} catch (MarketingException $e) { } catch (Exception $e) {
ColonelDistributorColonel::rollback(); ColonelDistributorColonel::rollback();
throw new MarketingException($e->getCode()); throw new MarketingException($e->getMessage());
} }
} }
......
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