Commit 0344ce7c authored by pengfei's avatar pengfei

update 更改团长分销活动-团长表名

parent 0aba4b7a
......@@ -9,9 +9,9 @@ namespace App\Models\marketing\mysql;
use Api\PhpUtils\Mysql\MysqlBase;
class PindanActivityColonelApply extends MysqlBase
class ColonelDistributorColonelApply extends MysqlBase
{
const TABLE_NAME = 'pindan_activity_colonel_apply';
const TABLE_NAME = 'colonel_distributor_colonel_apply';
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'colonel_apply_id';
......
......@@ -9,7 +9,7 @@ namespace App\Services\marketing;
use App\Exception\custom\MarketingException;
use App\Models\marketing\mysql\PindanActivityColonel;
use App\Models\marketing\mysql\PindanActivityColonelApply;
use App\Models\marketing\mysql\ColonelDistributorColonelApply;
use App\Models\user\mysql\UserWechatBind;
use Exception;
......@@ -25,7 +25,7 @@ class ColonelService
*/
public static function apply(array $params): int
{
if (PindanActivityColonelApply::existUser($params['user_id'])) {
if (ColonelDistributorColonelApply::existUser($params['user_id'])) {
throw new MarketingException(MarketingException::COLONEL_APPLY_EXIST);
}
$colonelData = [
......@@ -43,7 +43,7 @@ class ColonelService
'area' => $params['area'] ?? '',
];
try {
if (!$applyId = PindanActivityColonelApply::insertRecord($colonelData)) {
if (!$applyId = ColonelDistributorColonelApply::insertRecord($colonelData)) {
throw new MarketingException(MarketingException::COLONEL_APPLY_FAILED);
}
return $applyId;
......@@ -63,7 +63,7 @@ class ColonelService
public static function getManageList(array $params): array
{
$params = self::getPageParams($params);
$result = PindanActivityColonelApply::getPages([], PindanActivityColonelApply::DEFAULT_COLUMN, $params['page'], $params['page_size']);
$result = ColonelDistributorColonelApply::getPages([], ColonelDistributorColonelApply::DEFAULT_COLUMN, $params['page'], $params['page_size']);
if (empty($result['count'])) {
return $result;
}
......@@ -86,29 +86,29 @@ class ColonelService
*/
public static function handleManageAudit(int $applyId, int $auditStatus): bool
{
if (!in_array($auditStatus, [PindanActivityColonelApply::STATUS_PASS,PindanActivityColonelApply::STATUS_REJECT])) {
if (!in_array($auditStatus, [ColonelDistributorColonelApply::STATUS_PASS,ColonelDistributorColonelApply::STATUS_REJECT])) {
throw new MarketingException(MarketingException::COLONEL_AUDIT_STATUS);
}
$applyInfo = PindanActivityColonelApply::getRecord(['colonel_apply_id' => $applyId]);
if (empty($applyInfo) || $applyInfo['audit_status'] != PindanActivityColonelApply::STATUS_AUDIT) {
$applyInfo = ColonelDistributorColonelApply::getRecord(['colonel_apply_id' => $applyId]);
if (empty($applyInfo) || $applyInfo['audit_status'] != ColonelDistributorColonelApply::STATUS_AUDIT) {
throw new MarketingException(MarketingException::COLONEL_AUDIT_STATUS);
}
try {
PindanActivityColonelApply::beginTransaction();
ColonelDistributorColonelApply::beginTransaction();
// 修改申请状态
$updateStatus = PindanActivityColonelApply::update(['audit_status' => $auditStatus], ['colonel_apply_id' => $applyId,'audit_status' => PindanActivityColonelApply::STATUS_AUDIT]);
$updateStatus = ColonelDistributorColonelApply::update(['audit_status' => $auditStatus], ['colonel_apply_id' => $applyId,'audit_status' => ColonelDistributorColonelApply::STATUS_AUDIT]);
if (empty($updateStatus)) {
throw new MarketingException(MarketingException::COLONEL_AUDIT_STATUS_FAILED);
}
// 审核成功,入库团长表
if ($auditStatus == PindanActivityColonelApply::STATUS_PASS) {
if ($auditStatus == ColonelDistributorColonelApply::STATUS_PASS) {
if (!self::handleAuditSuccess((array)$applyInfo)) {
throw new MarketingException(MarketingException::COLONEL_AUDIT_STATUS_FAILED);
}
}
return PindanActivityColonelApply::commit();
return ColonelDistributorColonelApply::commit();
} catch (MarketingException $e) {
PindanActivityColonelApply::rollback();
ColonelDistributorColonelApply::rollback();
throw new MarketingException(MarketingException::COLONEL_AUDIT_STATUS_FAILED);
}
}
......
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