Browse Source

会员升级

Kirin 2 months ago
parent
commit
4d274af7f4
1 changed files with 1 additions and 44 deletions
  1. 1 44
      app/controller/api/v1/PublicController.php

+ 1 - 44
app/controller/api/v1/PublicController.php

@@ -73,53 +73,10 @@ class PublicController extends BaseController
 
     public function test()
     {
-        echo time();
+        (new IntegralJob)->dealOrderIntegral(StoreOrder::find(2529));
     }
 
 
-    public function dealOrderIntegral($order_id, $uid, $order_price, $add_time)
-    {
-        Log::debug(date('Y-m-d H:i:s') . '开始处理' . $order_id . '积分');
-        /** @var AwardIntegralServices $awardIntegralService */
-        $awardIntegralService = app()->make(AwardIntegralServices::class);
-        /** @var UserServices $userService */
-        $userService = app()->make(UserServices::class);
-        $user = $userService->getUserInfo($uid);
-        $total_price = $order_price;
-        return $awardIntegralService->transaction(function () use ($awardIntegralService, $userService, $user, $total_price, $order_id, $add_time) {
-            try {
-                $rate = sys_config('static_integral_rate', 3);
-                $give_static_integral = bcmul($total_price, $rate);
-                if ($give_static_integral > 0) {
-                    $mark = '购买商品,获得参考分';
-                    $integral_info = $awardIntegralService->incIntegral($user['uid'], $give_static_integral, $total_price, $order_id, $mark, $add_time);
-                }
-                //TODO 加动态积分
-                //推荐奖
-                $spread = $userService->getUserInfo($user['spread_uid']);
-                if ($spread && $spread['is_promoter']) {
-                    if ($awardIntegralService->getPaySum($spread['uid']) >= 2000) {
-                        $award_ratio = sys_config('recommend_speed_integral', 0);
-                        $give_action_integral = bcdiv(bcmul($total_price, $award_ratio), 100, 2);
-                        if ($give_action_integral > 0) {
-                            $first = $awardIntegralService->getFirstStaticIntegral($spread['uid']);
-                            if ($first) {
-                                $awardIntegralService->upSpeedIntegral($first['id'], $give_action_integral);
-                            }
-                        }
-                    }
-                }
-                Log::debug(date('Y-m-d H:i:s') . '结束处理' . $order_id . '积分');
-                return true;
-            } catch (\Throwable $e) {
-                Log::error('处理积分奖池失败,失败原因:' . $e->getMessage());
-                Log::debug(date('Y-m-d H:i:s') . '结束处理' . $order_id . '积分');
-                return false;
-            }
-        });
-
-    }
-
 //    public function send_test()
 //    {
 //        $service = app()->make(AwardIntegralServices::class);