转化支付配置

main
limu 9 months ago
parent 773a271043
commit e5dee1b9da
  1. 6
      app/controller/api/Auth.php
  2. 8
      crmeb/jobs/OrderPartnerJob.php

@ -795,13 +795,13 @@ class Auth extends BaseController
{ {
$userInfo = $this->request->userInfo(); $userInfo = $this->request->userInfo();
$data = userModel::getDB()->order("uid desc") $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) ->where("spread_uid2", $userInfo->uid)
->select() ->select()
->toArray(); ->toArray();
$users = userModel::getDB()->order("uid asc") $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) ->where('uid', '<>', $userInfo->uid)
->select() ->select()
->toArray(); ->toArray();
@ -810,7 +810,7 @@ class Auth extends BaseController
foreach ($data as &$item) { foreach ($data as &$item) {
$item['community_level'] = $level[$item['community_level']] ?? ''; $item['community_level'] = $level[$item['community_level']] ?? '';
$item['invites'] = $this->countSpInvites($users, $item['uid']); $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'); $item['amount'] = $this->countSpReferrals($users, $item['tid'], 'spread_pay_price');
} }

@ -164,7 +164,11 @@ class OrderPartnerJob implements JobInterface
//订单角色贡献值-30% //订单角色贡献值-30%
$user_value = bcmul($total_price, 0.3, 2); $user_value = bcmul($total_price, 0.3, 2);
$user = User::getDB()->where('uid', $data['uid'])->find(); $user = User::getDB()->where('uid', $data['uid'])->find();
if (!empty($user->all_value)) {
$user->all_value = bcadd($user->all_value, $user_value, 2); $user->all_value = bcadd($user->all_value, $user_value, 2);
} else {
$user->all_value = round($user_value, 2);
}
//增加生命值 //增加生命值
if (!empty($user_hb)) { if (!empty($user_hb)) {
$user->hp_value = bcadd($user->hp_value, $user_hb, 2); $user->hp_value = bcadd($user->hp_value, $user_hb, 2);
@ -183,7 +187,11 @@ class OrderPartnerJob implements JobInterface
if (!empty($user->spread_uid2)) { if (!empty($user->spread_uid2)) {
$user_zt = User::getDB()->where('uid', $user->spread_uid2)->find(); $user_zt = User::getDB()->where('uid', $user->spread_uid2)->find();
$zt_value = bcmul($total_price, 0.1, 2); $zt_value = bcmul($total_price, 0.1, 2);
if (!empty($user_zt->all_value)) {
$user_zt->all_value = bcadd($user_zt->all_value, $zt_value, 2); $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_zt->save();
$user_log_data[] = [ $user_log_data[] = [
'type' => 6, 'type' => 6,

Loading…
Cancel
Save