Browse Source

会员升级

Kirin 6 months ago
parent
commit
2333a3f644
1 changed files with 28 additions and 0 deletions
  1. 28 0
      app/controller/api/v1/PublicController.php

+ 28 - 0
app/controller/api/v1/PublicController.php

@@ -74,6 +74,34 @@ class PublicController extends BaseController
     public function test()
     {
 //        (new IntegralJob)->dealOrderIntegral(StoreOrder::find(2529));
+        /** @var AwardIntegralServices $awardIntegralService */
+        $awardIntegralService = app()->make(AwardIntegralServices::class);
+        /** @var UserServices $userService */
+        $userService = app()->make(UserServices::class);
+        $rate = sys_config('action_integral_rate', 3);
+        $award_order_limit = sys_config('award_order_limit');
+        $order = StoreOrder::get(2913);
+        $total_price = $order['award_price'];
+        $user = $userService->getUserInfo($order['uid']);
+        $spread = $userService->getUserInfo($user['spread_uid']);
+        if ($spread && $spread['is_promoter']) {
+            echo $awardIntegralService->getPaySum($spread['uid']);
+            echo $award_order_limit;
+            if ($awardIntegralService->getPaySum($spread['uid']) >= $award_order_limit) {
+                $award_ratio = sys_config('recommend_integral', 0);
+                if (($integral_info['link_id'] ?? 0) > 0) {
+                    $award_ratio = sys_config('reorder_recommend_integral', 0);
+                }
+                $give_action_integral = bcdiv(bcmul($total_price, $award_ratio), 100, 2);
+                echo $award_order_limit;
+                if ($give_action_integral > 0) {
+//                    $extract_sum = bcmul($give_action_integral, $rate, 2);
+//                    $mark = '推荐用户' . $user['nickname'] . "({$user['uid']})" . '购买商品,获得推荐积分';
+//                    $this->sendAward($extract_sum, $spread['uid'], $mark, $order['id']);
+//                    $oldAwardIntegralService->incIntegral($spread['uid'], 0, $give_action_integral, $total_price, 1, $extract_sum, $order['id'], $mark);
+                }
+            }
+        }
     }