Browse Source

会员升级

Kirin 1 week ago
parent
commit
e9aef3d89a
1 changed files with 31 additions and 1 deletions
  1. 31 1
      app/controller/api/v1/PublicController.php

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

@@ -52,6 +52,7 @@ use app\Request;
 use crmeb\services\CacheService;
 use crmeb\services\UploadService;
 use crmeb\basic\BaseController;
+use think\exception\ValidateException;
 use think\facade\Cache;
 use think\facade\Log;
 
@@ -80,8 +81,37 @@ class PublicController extends BaseController
 
 
         $order = StoreOrder::find(3442);
+        $total_price = $order['award_price'];
 
-        var_dump($awardIntegralService->dealOrderIntegral($order));
+        $user = User::find($order['uid']);
+
+        $rate = sys_config('static_integral_rate', 3);
+        $award_order_limit = sys_config('award_order_limit');
+
+        $award_order_limit_2 = sys_config('award_order_limit_2');
+
+
+        $rate = sys_config('action_integral_rate', 3);
+        $spread = $userService->getUserInfo($user['spread_uid']);
+        if ($spread && $spread['is_promoter']) {
+            if ($awardIntegralService->getPaySum($spread['uid']) >= $award_order_limit) {
+                var_dump(1212121);
+                $award_ratio = sys_config('recommend_integral', 0);
+                if ($order['pay_type'] == 'yue') {
+                    $award_ratio = sys_config('recommend_integral_yue', 0);
+                }
+                var_dump($award_ratio);
+                if (($integral_info['link_id'] ?? 0) > 0) {
+                    $award_ratio = sys_config('reorder_recommend_integral', 0);
+                    if ($order['pay_type'] == 'yue') {
+                        $award_ratio = sys_config('reorder_recommend_integral_yue', 0);
+                    }
+                }
+                var_dump($award_ratio);
+                $give_action_integral = bcdiv(bcmul($total_price, $award_ratio), 100, 2);
+                var_dump($give_action_integral);
+            }
+        }
 //        $userService = app()->make(UserServices::class);
 //        $rate = sys_config('action_integral_rate', 3);
 //        $award_order_limit = sys_config('award_order_limit');