增加驳回打款凭证
This commit is contained in:
@@ -10,13 +10,15 @@ class UserIdentityResource extends JsonResource
|
||||
{
|
||||
public function toArray($request): array
|
||||
{
|
||||
$user = Api::user();
|
||||
$open = $renew = false;
|
||||
$text = '立即开通';
|
||||
$price = $this->getCondition('price', '0');
|
||||
$cost = $this->getCondition('cost', '0');
|
||||
$identityName = $this->name;
|
||||
$coupon_price = 0;
|
||||
$user = Api::user();
|
||||
$open = $renew = false;
|
||||
$text = '立即开通';
|
||||
$price = $this->getCondition('price', '0');
|
||||
$cost = $this->getCondition('cost', '0');
|
||||
$identityName = $this->name;
|
||||
$coupon_price = 0;
|
||||
$reopen = false;//是否需要重新提交凭证
|
||||
$identityOrder = '';
|
||||
|
||||
if ($user) {
|
||||
$identity = $user->identityFirst();
|
||||
@@ -30,10 +32,13 @@ class UserIdentityResource extends JsonResource
|
||||
} else {
|
||||
$identityOrder = Order::ByUser($user)
|
||||
->where('identity_id', $this->id)
|
||||
->where('state', Order::STATE_INIT)
|
||||
->first();
|
||||
if ($identityOrder) {
|
||||
|
||||
if ($identityOrder && $identityOrder->state == Order::STATE_INIT) {
|
||||
$text = '等待审核';
|
||||
} elseif ($identityOrder && $identityOrder->state == Order::STATE_REJECT) {
|
||||
$text = '驳回申请';
|
||||
$reopen = true;
|
||||
} else {
|
||||
$open = true;
|
||||
}
|
||||
@@ -45,11 +50,11 @@ class UserIdentityResource extends JsonResource
|
||||
}
|
||||
|
||||
return [
|
||||
'identity_id' => $this->id,
|
||||
'name' => $identityName,
|
||||
'stock' => $this->stock,
|
||||
'years' => $this->years,
|
||||
'times' => $this->when($user && $this->id == $user->identityFirst()->id, function () use ($user) {
|
||||
'identity_id' => $this->id,
|
||||
'name' => $identityName,
|
||||
'stock' => $this->stock,
|
||||
'years' => $this->years,
|
||||
'times' => $this->when($user && $this->id == $user->identityFirst()->id, function () use ($user) {
|
||||
return new IdentityMiddleResource($user->identityMiddle()->first());
|
||||
}, [
|
||||
'name' => '---',
|
||||
@@ -57,22 +62,26 @@ class UserIdentityResource extends JsonResource
|
||||
'started_at' => '---',
|
||||
'ended_at' => '---',
|
||||
]),
|
||||
'cover' => $this->cover_url,
|
||||
'order' => $this->order,
|
||||
'description' => $this->description ?? "",
|
||||
'coupon_price' => floatval($coupon_price),//开通金额
|
||||
'cost' => floatval($cost),//开通金额
|
||||
'price' => floatval($price),//开通金额
|
||||
'can' => [
|
||||
'buy' => (bool) $this->can_buy,
|
||||
'open' => $this->can_buy ? $open : false,//开通
|
||||
'renew' => $this->can_buy ? $renew : false,//续费
|
||||
'cover' => $this->cover_url,
|
||||
'order' => $this->order,
|
||||
'description' => $this->description ?? "",
|
||||
'coupon_price' => floatval($coupon_price),//开通金额
|
||||
'cost' => floatval($cost),//开通金额
|
||||
'price' => floatval($price),//开通金额
|
||||
'can' => [
|
||||
'buy' => (bool) $this->can_buy,
|
||||
'open' => $this->can_buy ? $open : false,//开通
|
||||
'renew' => $this->can_buy ? $renew : false,//续费
|
||||
're_open' => $reopen,
|
||||
],
|
||||
'buttonText' => $text,
|
||||
'rights' => $this->rights,
|
||||
'rules' => $this->getRules(),
|
||||
'not_rules' => $this->getNotRules(),
|
||||
'is_open' => $user && $this->id == $user->identityFirst()->id
|
||||
'identity_order' => $this->when($identityOrder, function () use ($identityOrder) {
|
||||
return new UserOrderResource($identityOrder);
|
||||
}),
|
||||
'buttonText' => $text,
|
||||
'rights' => $this->rights,
|
||||
'rules' => $this->getRules(),
|
||||
'not_rules' => $this->getNotRules(),
|
||||
'is_open' => $user && $this->id == $user->identityFirst()->id
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user