转化支付配置

main
limu 9 months ago
parent 773a271043
commit e5dee1b9da
  1. 6
      app/controller/api/Auth.php
  2. 14
      crmeb/jobs/OrderPartnerJob.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');
}

@ -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,

Loading…
Cancel
Save