|
|
@@ -41,14 +41,14 @@ class ProfitShareReceiverEntity extends BaseEntity
|
|
|
return $entity;
|
|
|
}
|
|
|
|
|
|
- public function getReceiverList(array $params, array $pageAndLimit):Paginator
|
|
|
+ public function getReceiverList(array $params, array $pageAndLimit): Paginator
|
|
|
{
|
|
|
return $this->withSearch(['order_no', 'status', 'user_id'], $params)
|
|
|
->append(['status_text'])
|
|
|
->paginate($pageAndLimit);
|
|
|
}
|
|
|
|
|
|
- public function getReceiver(array $params):self
|
|
|
+ public function getReceiver(array $params): self
|
|
|
{
|
|
|
$entity = $this->where($params)
|
|
|
->append(['status_text'])
|
|
|
@@ -57,17 +57,34 @@ class ProfitShareReceiverEntity extends BaseEntity
|
|
|
throw_logic_exception('分账接收方申请记录不存在!');
|
|
|
}
|
|
|
if ($entity->receiver_no && $entity->status == ReceiverStatusEnum::SUBMITTING) {
|
|
|
- $response = LedgerService::queryReceiverDetail($entity->order_no, $entity->receiver_no);
|
|
|
+ $response = LedgerService::queryReceiverDetail($entity->order_no, $entity->receiver_no, $entity->org_code);
|
|
|
if ($response->rowStatus == 'VALID') {
|
|
|
$entity->status = ReceiverStatusEnum::VERIFIED;
|
|
|
$entity->wallet_id = $response->walletId;
|
|
|
}
|
|
|
$entity->save();
|
|
|
}
|
|
|
+ if ($entity->status == ReceiverStatusEnum::BINDING) {
|
|
|
+ $response = LedgerService::queryBindApplyList([
|
|
|
+ 'orderNo' => $entity->order_no,
|
|
|
+ 'orgCode' => $entity->org_code,
|
|
|
+ 'receiverNo' => $entity->receiver_no,
|
|
|
+ ], $entity->org_code);
|
|
|
+ if (isset($response->list[0])
|
|
|
+ && $response->list[0]->rowSno == $entity->order_no) {
|
|
|
+ $entity->status = match ($response->list[0]->auditStatus) {
|
|
|
+ '0' => ReceiverStatusEnum::BINDING,
|
|
|
+ '1' => ReceiverStatusEnum::BOUND,
|
|
|
+ '2' => ReceiverStatusEnum::BIND_FAILED
|
|
|
+ };
|
|
|
+ $entity->fail_reason = $response->list[0]->remark;
|
|
|
+ $entity->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
return $entity;
|
|
|
}
|
|
|
|
|
|
- public function apply(int $id):self
|
|
|
+ public function apply(int $id): self
|
|
|
{
|
|
|
$entity = $this->getReceiver(['id' => $id]);
|
|
|
if ($entity->status != ReceiverStatusEnum::PENDING) {
|
|
|
@@ -94,7 +111,7 @@ class ProfitShareReceiverEntity extends BaseEntity
|
|
|
// 系统异常,请稍后重试
|
|
|
// 创建新的申请记录
|
|
|
$newEntity = $entity->clone()->toArray();
|
|
|
- unset($newEntity['id'],$newEntity['order_no']);
|
|
|
+ unset($newEntity['id'], $newEntity['order_no']);
|
|
|
$this->save($newEntity);
|
|
|
$entity->delete();
|
|
|
}
|
|
|
@@ -108,7 +125,7 @@ class ProfitShareReceiverEntity extends BaseEntity
|
|
|
return $entity;
|
|
|
}
|
|
|
|
|
|
- public function bind(int $id):self
|
|
|
+ public function bind(int $id): self
|
|
|
{
|
|
|
$entity = $this->getReceiver(['id' => $id]);
|
|
|
if ($entity->status != ReceiverStatusEnum::VERIFIED) {
|
|
|
@@ -125,15 +142,15 @@ class ProfitShareReceiverEntity extends BaseEntity
|
|
|
$entity->save();
|
|
|
}
|
|
|
// 上传协议文件
|
|
|
- $entrustLocalPath = public_path().$entity->entrust_local_path;
|
|
|
+ $entrustLocalPath = public_path() . $entity->entrust_local_path;
|
|
|
$pathInfo = pathinfo($entrustLocalPath);
|
|
|
$response = MMSService::uploadFile(
|
|
|
orderNo: $entity->order_no,
|
|
|
attType: UploadFileTypeEnum::SPLIT_COOPERATION_FILE,
|
|
|
- attExtName : $pathInfo['extension'],
|
|
|
+ attExtName: $pathInfo['extension'],
|
|
|
fileContent: file_get_contents($entrustLocalPath),
|
|
|
);
|
|
|
- $entity->entrust_file_name = '合作协议'.$pathInfo['extension'];
|
|
|
+ $entity->entrust_file_name = '合作协议' . $pathInfo['extension'];
|
|
|
$entity->entrust_file_path = $response->attFileId;
|
|
|
$entity->save();
|
|
|
}
|