This commit is contained in:
2026-08-02 16:47:19 +03:30
parent ef32046e85
commit ec0fd28efc
4 changed files with 113 additions and 31 deletions
@@ -28,7 +28,9 @@ class CustomerController extends SuperController
public function __construct()
{
$this->with = [];
// referral لازم است تا در show/جزئیات ادمین «نام/کد معرف کاربر» خالی نماند
// (referral_to_id در DB هست؛ بدون with فقط کد خام دیده نمی‌شود و UI از userInfo.referral می‌خواند)
$this->with = ['referral'];
$this->select = ['*'];
$search=['name','mobile'];
$this->query = Customer::with($this->with,'wallet')->where('is_archive',false)->where('type',1);
@@ -573,20 +575,16 @@ class CustomerController extends SuperController
$customer->is_legal = 2;
$customer->save();
if ($this->Config('has_page_earn_money') == 'true') {
$referrer = $customer->referrer();
if (
$referrer
&& Customer::where('referral_to_id', $referrer->referral_id)->where('is_legal', '!=', 0)->count() < 4
) {
$gift_permision = app(ReferralGiftService::class)->resolveReferrerGiftPermission($referrer);
app(ReferralGiftService::class)->tryGiveOnRegistration(
$customer,
$referrer,
$gift_permision,
false
);
}
// واریز پاداش معرف مستقل از has_page_earn_money (آن فقط منوی اپ است)
$referrer = $customer->referrer();
if ($referrer) {
$gift_permision = app(ReferralGiftService::class)->resolveReferrerGiftPermission($referrer);
app(ReferralGiftService::class)->tryGiveOnRegistration(
$customer,
$referrer,
$gift_permision,
false
);
}