|
@@ -31,20 +31,21 @@ class IntegralJob extends BaseJobs
|
|
|
$user = $userService->getUserInfo($order['uid']);
|
|
$user = $userService->getUserInfo($order['uid']);
|
|
|
$integral_price = $awardIntegralService->getPrice($order['id']);
|
|
$integral_price = $awardIntegralService->getPrice($order['id']);
|
|
|
$total_price = $order['total_price'];
|
|
$total_price = $order['total_price'];
|
|
|
- return $awardIntegralService->transaction(function () use ($levelServices, $awardIntegralService, $userService, $user, $integral_price, $total_price, $order) {
|
|
|
|
|
|
|
+ $award_price = bcsub($total_price, $order['cost'], 2);
|
|
|
|
|
+ return $awardIntegralService->transaction(function () use ($award_price, $levelServices, $awardIntegralService, $userService, $user, $integral_price, $total_price, $order) {
|
|
|
try {
|
|
try {
|
|
|
//添加静态积分
|
|
//添加静态积分
|
|
|
$static_integral_ratio = sys_config('static_integral_ratio', 0);
|
|
$static_integral_ratio = sys_config('static_integral_ratio', 0);
|
|
|
- $give_static_integral = bcdiv(bcmul($total_price, $static_integral_ratio), 100, 2);
|
|
|
|
|
|
|
+ $give_static_integral = bcdiv(bcmul($award_price, $static_integral_ratio), 100, 2);
|
|
|
if ($give_static_integral > 0) {
|
|
if ($give_static_integral > 0) {
|
|
|
$rate = sys_config('static_integral_rate', 3);
|
|
$rate = sys_config('static_integral_rate', 3);
|
|
|
- $extract_sum = bcmul($total_price, $rate, 2);
|
|
|
|
|
|
|
+ $extract_sum = bcmul($award_price, $rate, 2);
|
|
|
$mark = '购买商品,获得静态积分';
|
|
$mark = '购买商品,获得静态积分';
|
|
|
$awardIntegralService->incIntegral($order['uid'], $integral_price, $give_static_integral, $total_price, 0, $extract_sum, $order['id'], $mark);
|
|
$awardIntegralService->incIntegral($order['uid'], $integral_price, $give_static_integral, $total_price, 0, $extract_sum, $order['id'], $mark);
|
|
|
}
|
|
}
|
|
|
//添加奖池
|
|
//添加奖池
|
|
|
$lake_ratio = sys_config('lake_ratio', 0);
|
|
$lake_ratio = sys_config('lake_ratio', 0);
|
|
|
- $add_lake = bcdiv(bcmul($total_price, $lake_ratio), 100, 2);
|
|
|
|
|
|
|
+ $add_lake = bcdiv(bcmul($award_price, $lake_ratio), 100, 2);
|
|
|
if ($add_lake > 0) {
|
|
if ($add_lake > 0) {
|
|
|
$mark = '用户' . $order['uid'] . '购买商品,添加资金池';
|
|
$mark = '用户' . $order['uid'] . '购买商品,添加资金池';
|
|
|
$awardIntegralService->addLake($add_lake, $order['id'], $mark);
|
|
$awardIntegralService->addLake($add_lake, $order['id'], $mark);
|
|
@@ -56,7 +57,7 @@ class IntegralJob extends BaseJobs
|
|
|
if ($spread) {
|
|
if ($spread) {
|
|
|
if ($awardIntegralService->getPaySum($spread['uid']) >= 1000 || $awardIntegralService->getHourExtractPaySum($spread['uid'], 24) >= 1000) {
|
|
if ($awardIntegralService->getPaySum($spread['uid']) >= 1000 || $awardIntegralService->getHourExtractPaySum($spread['uid'], 24) >= 1000) {
|
|
|
$award_ratio = sys_config('recommend_integral', 0);
|
|
$award_ratio = sys_config('recommend_integral', 0);
|
|
|
- $give_action_integral = bcdiv(bcmul($total_price, $award_ratio), 100, 2);
|
|
|
|
|
|
|
+ $give_action_integral = bcdiv(bcmul($award_price, $award_ratio), 100, 2);
|
|
|
if ($give_action_integral > 0) {
|
|
if ($give_action_integral > 0) {
|
|
|
$extract_sum = bcmul($give_action_integral, $rate, 2);
|
|
$extract_sum = bcmul($give_action_integral, $rate, 2);
|
|
|
$mark = '推荐用户' . $user['nickname'] . "({$user['uid']})" . '购买商品,获得推荐积分';
|
|
$mark = '推荐用户' . $user['nickname'] . "({$user['uid']})" . '购买商品,获得推荐积分';
|
|
@@ -71,7 +72,7 @@ class IntegralJob extends BaseJobs
|
|
|
//先发奖,再结算等级
|
|
//先发奖,再结算等级
|
|
|
$level = $levelServices->getUserLevel($spread['uid']);
|
|
$level = $levelServices->getUserLevel($spread['uid']);
|
|
|
$ratio = $level['levelInfo']['group_award'] ?? 0;
|
|
$ratio = $level['levelInfo']['group_award'] ?? 0;
|
|
|
- $give_action_integral = bcdiv(bcmul($total_price, $ratio), 100, 2);
|
|
|
|
|
|
|
+ $give_action_integral = bcdiv(bcmul($award_price, $ratio), 100, 2);
|
|
|
if ($give_action_integral > $send) {
|
|
if ($give_action_integral > $send) {
|
|
|
$real_send = bcsub($give_action_integral, $send, 2);
|
|
$real_send = bcsub($give_action_integral, $send, 2);
|
|
|
$extract_sum = bcmul($real_send, $rate, 2);
|
|
$extract_sum = bcmul($real_send, $rate, 2);
|