feat: invite num
This commit is contained in:
@@ -14,6 +14,7 @@ use App\Constants\Common\CouponCode;
|
||||
use App\Extend\StringUtil;
|
||||
use App\Model\AdminUser;
|
||||
use App\Model\UserCoupon;
|
||||
use App\Model\UserInvite;
|
||||
use App\Service\Api\BaseService;
|
||||
use App\Service\ServiceTrait\Api\GetUserInfoTrait;
|
||||
use App\Service\ServiceTrait\Common\OssTrait;
|
||||
@@ -44,13 +45,19 @@ class MyPageService extends BaseService
|
||||
'mobile' => StringUtil::maskMiddleStrByNum($userInfo->mobile,4),
|
||||
'point' => 0,
|
||||
'coupon_num' => $this->getCouponNum(),
|
||||
'invite_num' => 0,
|
||||
'invite_num' => $this->getInviteNum(),
|
||||
'role_id' => (!empty($adminInfo) && $adminInfo->role_id > 0) ? $adminInfo->role_id : 0,
|
||||
];
|
||||
|
||||
return $this->return->success('success', $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* @var UserCoupon
|
||||
*/
|
||||
#[Inject]
|
||||
private UserCoupon $userCouponModel;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
@@ -64,8 +71,19 @@ class MyPageService extends BaseService
|
||||
}
|
||||
|
||||
/**
|
||||
* @var UserCoupon
|
||||
* @var UserInvite
|
||||
*/
|
||||
#[Inject]
|
||||
private UserCoupon $userCouponModel;
|
||||
private UserInvite $userInviteModel;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
private function getInviteNum(): int
|
||||
{
|
||||
return $this->userInviteModel
|
||||
->where('invitee_user_id',$this->userId)
|
||||
->count()?? 0;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user