|
|
@@ -5,6 +5,9 @@ namespace SixShop\Lakala\Entity;
|
|
|
|
|
|
use SixShop\Core\Entity\BaseEntity;
|
|
|
use SixShop\Lakala\Config;
|
|
|
+use SixShop\Lakala\Enum\ProfitShareOrderStatusEnum;
|
|
|
+use SixShop\Lakala\Enum\ReceiverStatusEnum;
|
|
|
+use SixShop\Lakala\Facade\LedgerService;
|
|
|
use SixShop\Lakala\Facade\MMSService;
|
|
|
use SixShop\Lakala\Model\ProfitShareReceiverModel;
|
|
|
use think\facade\Db;
|
|
|
@@ -53,4 +56,33 @@ class ProfitShareReceiverEntity extends BaseEntity
|
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
+
|
|
|
+ public function apply(int $id):self
|
|
|
+ {
|
|
|
+ $entity = $this->getReceiver(['id' => $id]);
|
|
|
+ if ($entity->status != ReceiverStatusEnum::PENDING) {
|
|
|
+ throw_logic_exception('请不要重复提交申请!');
|
|
|
+ }
|
|
|
+ $reqData = [
|
|
|
+ 'orderNo' => $entity->order_no,
|
|
|
+ 'orgCode' => $entity->org_code,
|
|
|
+ 'receiverName' => $entity->receiver_name,
|
|
|
+ 'contactMobile' => $entity->contact_mobile,
|
|
|
+ 'acctNo' => $entity->acct_no,
|
|
|
+ 'acctName' => $entity->acct_name,
|
|
|
+ 'acctTypeCode' => $entity->acct_type_code,
|
|
|
+ 'acctCertificateType' => $entity->acct_certificate_type,
|
|
|
+ 'acctCertificateNo' => $entity->acct_certificate_no,
|
|
|
+ 'acctOpenBankCode' => $entity->acct_open_bank_code,
|
|
|
+ 'acctOpenBankName' => $entity->acct_open_bank_name,
|
|
|
+ 'acctClearBankCode' => $entity->acct_clear_bank_code,
|
|
|
+ ];
|
|
|
+ $response = LedgerService::applyLedgerReceiver($reqData);
|
|
|
+ $entity->org_id = $response->orgId;
|
|
|
+ $entity->org_name = $response->orgName;
|
|
|
+ $entity->receiver_no = $response->receiverNo;
|
|
|
+ $entity->status = ReceiverStatusEnum::SUBMITTING;
|
|
|
+ $entity->save();
|
|
|
+ return $entity;
|
|
|
+ }
|
|
|
}
|