|
@@ -70,8 +70,10 @@ class IntegralJob extends BaseJobs
|
|
|
$give_action_integral = bcdiv(bcmul($total_price, $award_ratio), 100, 2);
|
|
|
if ($give_action_integral > 0) {
|
|
|
$first = $awardIntegralService->getFirstStaticIntegral($spread['uid']);
|
|
|
- $mark = ',推荐用户' . $user['nickname'] . "({$user['uid']})" . '购买商品,获得加速积分';
|
|
|
- $awardIntegralService->incUpdateIntegral($first['id'], $integral_price, $give_action_integral, $mark);
|
|
|
+ if ($first) {
|
|
|
+ $mark = ',推荐用户' . $user['nickname'] . "({$user['uid']})" . '购买商品,获得加速积分';
|
|
|
+ $awardIntegralService->incUpdateIntegral($first['id'], $integral_price, $give_action_integral, $mark);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -189,8 +191,20 @@ class IntegralJob extends BaseJobs
|
|
|
$sum = $info['extract_sum'];
|
|
|
}
|
|
|
$real_out = bcdiv(bcmul($sum, sys_config('extract_ratio', 0)), 100, 2);
|
|
|
+ $left = bcsub($info['num'], bcdiv(bcmul($info['num'], sys_config('extract_ratio', 0)), 100, 2), 5);
|
|
|
+ $to_top = bcdiv(bcmul($left, sys_config('extract_speed_ratio', 0)), 100, 5);
|
|
|
+ $extract_speed_num = sys_config('extract_speed_num', 0);
|
|
|
+ if ($extract_speed_num > 0) {
|
|
|
+ $to_top = bcdiv($to_top, $extract_speed_num, 5);
|
|
|
+ } else {
|
|
|
+ $to_top = 0;
|
|
|
+ }
|
|
|
+ $to_spread = 0;
|
|
|
+ if ($info['type'] == 0) {
|
|
|
+ $to_spread = bcdiv(bcmul($info['num'], sys_config('extract_spread_ratio', 0)), 100, 2);
|
|
|
+ }
|
|
|
+ $user = $userService->getUserInfo($info['uid']);
|
|
|
if ($real_out > 0) {
|
|
|
- $user = $userService->getUserInfo($info['uid']);
|
|
|
$mark = '用户积分出局,出局时价格' . $price;
|
|
|
$res = $res && $awardIntegralService->addLake(-$real_out, $info['id'], $mark);
|
|
|
|
|
@@ -218,6 +232,29 @@ class IntegralJob extends BaseJobs
|
|
|
$res = $res && $userService->bcInc($info['uid'], 'energy', $to_energy, 'uid');
|
|
|
$res = $res && $awardIntegralService->update($info['id'], ['handle' => 0, 'extract_sum_real' => $sum, 'status' => 1, 'extract_time' => time()]);
|
|
|
}
|
|
|
+ if ($to_top > 0) {
|
|
|
+ $id = 0;
|
|
|
+ for ($i = 0; $i < $extract_speed_num; $i++) {
|
|
|
+ $first = $awardIntegralService->getTopStaticIntegral($id);
|
|
|
+ if ($first) {
|
|
|
+ $mark = ',用户' . $user['nickname'] . "({$user['uid']})" . '积分出局,获得加速积分';
|
|
|
+ $awardIntegralService->incUpdateIntegral($first['id'], 0, $to_top, $mark);
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $id = $first['id'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($to_spread > 0) {
|
|
|
+ $spread = $userService->getUserInfo($user['spread_uid']);
|
|
|
+ if ($spread) {
|
|
|
+ $first = $awardIntegralService->getFirstStaticIntegral($spread['uid']);
|
|
|
+ if ($first) {
|
|
|
+ $mark = ',推荐用户' . $user['nickname'] . "({$user['uid']})" . '消费分出局,获得加速积分';
|
|
|
+ $awardIntegralService->incUpdateIntegral($first['id'], 0, $to_spread, $mark);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (count($infos) > 0) return $res && $this->autoExtract($awardIntegralService->getPrice());
|
|
|
return $res;
|