|
|
@ -4,6 +4,7 @@ namespace App\Service; |
|
|
|
|
|
|
|
|
use App\Commons\Log; |
|
|
use App\Commons\Log; |
|
|
use App\Constants\LogLabel; |
|
|
use App\Constants\LogLabel; |
|
|
|
|
|
use App\Constants\SsdbKeysPrefix; |
|
|
use App\Model\FinancialRecord; |
|
|
use App\Model\FinancialRecord; |
|
|
use App\Model\Market; |
|
|
use App\Model\Market; |
|
|
use App\Model\MmInfo; |
|
|
use App\Model\MmInfo; |
|
|
@ -189,7 +190,15 @@ class SeparateAccountsService implements SeparateAccountsServiceInterface |
|
|
$mpInfo = MpInfo::query()->find($market->mp_id); // 服务商
|
|
|
$mpInfo = MpInfo::query()->find($market->mp_id); // 服务商
|
|
|
|
|
|
|
|
|
$ssdbName = 'mm_'.$mmInfo->id.'_award_'.$store->id; |
|
|
$ssdbName = 'mm_'.$mmInfo->id.'_award_'.$store->id; |
|
|
$record = $ssdb->exec('hgetall', $ssdbName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO 暂时在这里初始化
|
|
|
|
|
|
if (!$ssdb->exec('hexists', $ssdbName, 'is_awarded')) { |
|
|
|
|
|
$ssdb->exec('hset', $ssdbName, 'is_awarded', 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!$ssdb->exec('hexists', $ssdbName, 'new_user_number')) { |
|
|
|
|
|
$ssdb->exec('hset', $ssdbName, 'new_user_number', 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 平台新用户
|
|
|
// 平台新用户
|
|
|
if ($this->userService->isPlatformNewUser($orderMain->user_id, $orderMain->id)) { |
|
|
if ($this->userService->isPlatformNewUser($orderMain->user_id, $orderMain->id)) { |
|
|
@ -198,6 +207,8 @@ class SeparateAccountsService implements SeparateAccountsServiceInterface |
|
|
$this->financialRecordService->mpAwardByPlatNewUser($mpInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mp_new_user'], '市场经理「'.$mmInfo->name.'」发展新用户'); // 服务商新用户奖励
|
|
|
$this->financialRecordService->mpAwardByPlatNewUser($mpInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mp_new_user'], '市场经理「'.$mmInfo->name.'」发展新用户'); // 服务商新用户奖励
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$record = $ssdb->exec('hgetall', $ssdbName); |
|
|
|
|
|
|
|
|
// 判断是否已经奖励过新拓展商户的奖励,没有的话判断新用户个数是否达到要求,进行奖励
|
|
|
// 判断是否已经奖励过新拓展商户的奖励,没有的话判断新用户个数是否达到要求,进行奖励
|
|
|
if ( |
|
|
if ( |
|
|
!empty($record) |
|
|
!empty($record) |
|
|
@ -374,7 +385,15 @@ class SeparateAccountsService implements SeparateAccountsServiceInterface |
|
|
|
|
|
|
|
|
$ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); |
|
|
$ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); |
|
|
$ssdbName = 'mm_'.$mmInfo->id.'_award_'.$store->id; |
|
|
$ssdbName = 'mm_'.$mmInfo->id.'_award_'.$store->id; |
|
|
$record = $ssdb->exec('hgetall', $ssdbName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO 暂时在这里初始化
|
|
|
|
|
|
if (!$ssdb->exec('hexists', $ssdbName, 'is_awarded')) { |
|
|
|
|
|
$ssdb->exec('hset', $ssdbName, 'is_awarded', 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!$ssdb->exec('hexists', $ssdbName, 'new_user_number')) { |
|
|
|
|
|
$ssdb->exec('hset', $ssdbName, 'new_user_number', 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 平台新用户
|
|
|
// 平台新用户
|
|
|
if ($this->userService->isPlatformNewUser($orderMain->user_id, $orderMain->id)) { |
|
|
if ($this->userService->isPlatformNewUser($orderMain->user_id, $orderMain->id)) { |
|
|
@ -383,6 +402,7 @@ class SeparateAccountsService implements SeparateAccountsServiceInterface |
|
|
$this->financialRecordService->mpAwardByPlatNewUser($mpInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mp_new_user'], '市场经理「'.$mmInfo->name.'」发展新用户'); // 服务商新用户奖励
|
|
|
$this->financialRecordService->mpAwardByPlatNewUser($mpInfo->admin_user_id, $global_order_id, $MmMpAwardConfig['mp_new_user'], '市场经理「'.$mmInfo->name.'」发展新用户'); // 服务商新用户奖励
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$record = $ssdb->exec('hgetall', $ssdbName); |
|
|
// 判断是否已经奖励过新拓展商户的奖励,没有的话判断新用户个数是否达到要求,进行奖励
|
|
|
// 判断是否已经奖励过新拓展商户的奖励,没有的话判断新用户个数是否达到要求,进行奖励
|
|
|
if ( |
|
|
if ( |
|
|
!empty($record) |
|
|
!empty($record) |
|
|
|