add:押金充值对公账户临时方案

This commit is contained in:
chenbo 2023-10-17 14:14:45 +08:00
parent 22ed2105fb
commit eb5607bfe4
3 changed files with 47 additions and 6 deletions

View File

@ -523,4 +523,33 @@ class CompanyController extends BaseAdminController
}
}
public function getPartyA()
{
$companyId = $this->request->param('company_id');
$re = CompanyLogic::getPartyA($companyId);
if ($re === false) {
return $this->fail(CompanyLogic::getError());
}
return $this->success('成功', $re);
}
public function getDepositRechargeTransferVoucherList()
{
$companyId = $this->request->param('company_id');
$list = CompanyDepositVoucher::where(['company_id' => $companyId])->select()->toArray();
return $this->success('成功',$list);
}
public function depositRechargeTransferVoucherDetail()
{
$param = $this->request->param();
$companyDepositVoucher = CompanyDepositVoucher::where(['id' => $param['id']])->findOrEmpty()->toArray();
if (empty($companyDepositVoucher)) {
return $this->fail('数据不存在');
}
$contract = Contract::where(['party_b'=>$companyDepositVoucher['company_id']])->with(['partyA', 'partyB'])->findOrEmpty()->toArray();
return $this->success('成功', array_merge($companyDepositVoucher, $contract));
}
}

View File

@ -2,6 +2,7 @@
namespace app\api\controller;
use app\common\logic\CompanyLogic;
use app\common\logic\contract\ContractLogic;
use app\common\model\auth\Admin;
use app\common\model\Company;
@ -366,12 +367,10 @@ class CompanyController extends BaseApiController
*/
public function getPartyACompany()
{
$company = Company::where(['id'=>$this->userInfo['company_id']])->find();
$contract = Contract::where(['party_b'=>$company['id']])->find();
if ($contract) {
$partyA = Company::where(['id'=>$contract['party_a']])->find();
return $this->success('ok', $partyA);
$re = CompanyLogic::getPartyA($this->userInfo['company_id']);
if ($re === false) {
return $this->fail(CompanyLogic::getError());
}
return $this->fail('当前公司未签约甲方公司');
return $this->success('成功',$re);
}
}

View File

@ -425,4 +425,17 @@ class CompanyLogic extends BaseLogic
$model->save();
return $model->id;
}
public static function getPartyA($companyId)
{
$company = Company::where(['id' => $companyId])->find();
$contract = Contract::where(['party_b'=>$company['id']])->find();
if ($contract) {
$partyA = Company::where(['id'=>$contract['party_a']])->find()->toArray();
return $partyA;
} else {
self::setError("该公司未与上级公司签约,无法充值押金");
return false;
}
}
}