|
|
|
@ -171,20 +171,26 @@ class PromoteCompanyService
|
|
|
|
|
unset($companyInfo['relation']);
|
|
|
|
|
unset($companyInfo['promotes']);
|
|
|
|
|
|
|
|
|
|
$isNew = false;
|
|
|
|
|
$isNewDeposit = false;
|
|
|
|
|
if($application['company_id'] == 0){
|
|
|
|
|
//新增
|
|
|
|
|
$isNew = true;
|
|
|
|
|
$isNewDeposit = true;
|
|
|
|
|
$application['company_id'] = $companyInfo['id'] = M('promote_company', 'tab_')->add($companyInfo);
|
|
|
|
|
}else{
|
|
|
|
|
//编辑
|
|
|
|
|
$oldInfo = M('promote_company', 'tab_')->field(['id', 'company_belong'])->where(['id' => $application['company_id']])->find();
|
|
|
|
|
/** 内团/无 切换为外团 */
|
|
|
|
|
if (in_array($companyInfo['company_belong'], [1, 2]) && !in_array($oldInfo['company_belong'], [1, 2])) {
|
|
|
|
|
$isNewDeposit = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
M('promote_company', 'tab_')->save($companyInfo);
|
|
|
|
|
$this->changePromote($companyInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->savePromoteCompanyRelation($bindRelation, $companyInfo);
|
|
|
|
|
$this->savePromotes($promotes, $companyInfo, $creator);
|
|
|
|
|
if ($isNew && in_array($companyInfo['company_belong'], [1, 2])) {
|
|
|
|
|
if ($isNewDeposit && in_array($companyInfo['company_belong'], [1, 2])) {
|
|
|
|
|
$depositService = new PresidentDepositService();
|
|
|
|
|
$depositService->save($deposit, $companyInfo);
|
|
|
|
|
}
|
|
|
|
|