From e5dee1b9da0ea6e492146a7215d72fdcddae4e28 Mon Sep 17 00:00:00 2001 From: limu <610543851@qq.com> Date: Thu, 22 Feb 2024 16:34:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E5=8C=96=E6=94=AF=E4=BB=98=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Auth.php | 6 +++--- crmeb/jobs/OrderPartnerJob.php | 14 +++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 42abc5e..06038f7 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -795,13 +795,13 @@ class Auth extends BaseController { $userInfo = $this->request->userInfo(); $data = userModel::getDB()->order("uid desc") - ->field("uid,phone,nickname,create_time,community_level,pay_count,spread_uid as sid,spread_uid2 as tid") + ->field("uid,phone,nickname,create_time,community_level,pay_count,spread_uid as sid,spread_uid2 as tid,pay_price") ->where("spread_uid2", $userInfo->uid) ->select() ->toArray(); $users = userModel::getDB()->order("uid asc") - ->field("uid,spread_uid as sid,spread_uid2 as tid,spread_count,spread_pay_price") + ->field("uid,spread_uid as sid,spread_uid2 as tid,spread_count,spread_pay_price,pay_price") ->where('uid', '<>', $userInfo->uid) ->select() ->toArray(); @@ -810,7 +810,7 @@ class Auth extends BaseController foreach ($data as &$item) { $item['community_level'] = $level[$item['community_level']] ?? ''; $item['invites'] = $this->countSpInvites($users, $item['uid']); - $item['referrals'] = $this->countSpReferrals($users, $item['tid'], 'spread_count'); + $item['referrals'] = $this->countSpReferrals($users, $item['tid'], 'pay_price'); $item['amount'] = $this->countSpReferrals($users, $item['tid'], 'spread_pay_price'); } diff --git a/crmeb/jobs/OrderPartnerJob.php b/crmeb/jobs/OrderPartnerJob.php index 21f011e..6d7f699 100644 --- a/crmeb/jobs/OrderPartnerJob.php +++ b/crmeb/jobs/OrderPartnerJob.php @@ -164,7 +164,11 @@ class OrderPartnerJob implements JobInterface //订单角色贡献值-30% $user_value = bcmul($total_price, 0.3, 2); $user = User::getDB()->where('uid', $data['uid'])->find(); - $user->all_value = bcadd($user->all_value, $user_value, 2); + if (!empty($user->all_value)) { + $user->all_value = bcadd($user->all_value, $user_value, 2); + } else { + $user->all_value = round($user_value, 2); + } //增加生命值 if (!empty($user_hb)) { $user->hp_value = bcadd($user->hp_value, $user_hb, 2); @@ -180,10 +184,14 @@ class OrderPartnerJob implements JobInterface ]; //直推贡献10% - if(!empty($user->spread_uid2)){ + if (!empty($user->spread_uid2)) { $user_zt = User::getDB()->where('uid', $user->spread_uid2)->find(); $zt_value = bcmul($total_price, 0.1, 2); - $user_zt->all_value = bcadd($user_zt->all_value, $zt_value, 2); + if (!empty($user_zt->all_value)) { + $user_zt->all_value = bcadd($user_zt->all_value, $zt_value, 2); + } else { + $user_zt->all_value = round($zt_value, 2); + } $user_zt->save(); $user_log_data[] = [ 'type' => 6,