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,