Browse Source

会员升级

Kirin 2 months ago
parent
commit
1bebe27e3c

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

@@ -73,73 +73,7 @@ class PublicController extends BaseController
 
     public function test()
     {
-//        $list = UserBill::where('type', 'activity_energy')->select();
-//        foreach ($list as $v) {
-//            $mark = explode(',', $v['mark']);
-//            if (!UserIntegral::where('uid', $v['uid'])->where('add_time', strtotime($v['add_time']))->where('mark', $mark[0])->find()) {
-//                UserIntegral::create([
-//                    'uid' => $v['uid'],
-//                    'type' => 1,
-//                    'num' => 0,
-//                    'price' => 0,
-//                    'sum_price' => $v['number'] * 10,
-//                    'extract_sum' => $v['number'] * 10,
-//                    'link_id' => $v['link_id'],
-//                    'mark' => $mark[0],
-//                    'order_price' => StoreOrder::where('id', $v['link_id'])->value('award_price'),
-//                    'add_time' => strtotime($v['add_time']),
-//                    'status' => 1,
-//                ]);
-//            }
-//        }
-
-//        event('user.cancelUser', [4]);
-//        event('user.cancelUser', [5]);
-//        event('user.cancelUser', [6]);
-//        event('user.cancelUser', [7]);
-//        event('user.cancelUser', [8]);
-//        event('user.cancelUser', [9]);
-//        event('user.cancelUser', [10]);
-
-//        $max_id = CacheService::redisHandler()->get('max_id', 0);
-//        $list = UserIntegral::where('type', 0)->where('status', 0)->order('id asc')->where('id', '>', $max_id)->limit(300)->select();
-//        $last_time = CacheService::redisHandler()->get('last_time', 0);
-//        $service = app()->make(AwardIntegralServices::class);
-//        echo date('Y-m-d', $list[0]['add_time']) . '<br>';
-//        foreach ($list as $v) {
-//            if (date('Y-m-d', $v['add_time']) != date('Y-m-d', $last_time) && $last_time > 0) {
-//                echo date('Y-m-d', $v['add_time']) . '<br>';
-//                $days = (strtotime(date('Y-m-d', $v['add_time'])) - strtotime(date('Y-m-d', $last_time))) / (24 * 3600);
-//                echo '时间间隔' . $days . '天<br>';
-//                for ($i = 0; $i < $days; $i++) {
-//                    $service->daySend(true);
-//                }
-//            }
-//            $this->dealOrderIntegral($v['link_id'], $v['uid'], $v['order_price'], $v['add_time']);
-//            $last_time = $v['add_time'];
-//            $max_id = $v['id'];
-//        }
-//        CacheService::redisHandler()->set('max_id', $max_id);
-//        CacheService::redisHandler()->set('last_time', $last_time);
-//
-//        if (count($list) < 300 && strtotime(date('Y-m-d', $last_time)) < strtotime(date('Y-m-d'))) {
-//            echo date('Y-m-d') . '<br>';
-//            $days = (strtotime(date('Y-m-d')) - strtotime(date('Y-m-d', $last_time))) / (24 * 3600);
-//            echo '时间间隔' . $days . '天<br>';
-//            for ($i = 0; $i < $days; $i++) {
-//                $service->daySend(true);
-//            }
-//        }
-//        $main_orders = $service->getIntegralList(['uid' => 1, 'link_id' => 0, 'order_price_elt' => 2500, 'valid' => 2]);//满足复投条件的主单
-//        var_dump($main_orders);
-//        var_dump(AwardIntegral::getLastSql());
-//        $service->daySend(true);
-
-//        $orders = StoreOrder::where('pay_time', '>', '1721215334')->where('supplier_id', '>', 0)->where('is_del', 0)->where('is_system_del', 0)->where('refund_status', 0)->where('paid', 1)->where('pid', '>=', 0)->select();
-//        foreach ($orders as $v) {
-//            $supplierFlowServices = app()->make(SupplierFlowingWaterServices::class);
-//            $supplierFlowServices->setSupplierFinance($v['id']);
-//        }
+        echo time();
     }
 
 

+ 9 - 4
app/services/user/AwardIntegralServices.php

@@ -261,15 +261,20 @@ class AwardIntegralServices extends BaseServices
     {
         $sum = $this->dao->search()->whereTime('add_time', 'yesterday')->sum('order_price');
         $system_check = sys_config('system_achievement_check', 10000);
+        if ($sum < $system_check) {
+            $update['send_time'] = time();
+            $this->dao->search()->where('status', 0)->where('sent_num<num')->where('send_time', '<', $test ? (time() + 1000) : strtotime('today'))->update($update);
+            return true;
+        }
         $list = $this->dao->search()->where('status', 0)->where('sent_num<num')->where('send_time', '<', $test ? (time() + 1000) : strtotime('today'))->limit($test ? 10000 : 50)->select();
         foreach ($list as $v) {
             $day_send = $v['day_send'];
             $send_day = $v['send_day'];
             $up_speed = $v['up_speed'] - $v['up_speed_used'];
-            if ($sum < $system_check) {
-                if (!$test) $send_day = $v['send_day'] + sys_config('fail_inc_send_day', 1);
-                $day_send = bcdiv((string)(($v['num'] - $v['sent_num'] + $v['up_speed_used'])), (string)($send_day - $v['sent_day']), 2);
-            }
+//            if ($sum < $system_check) {
+//            if (!$test) $send_day = $v['send_day'] + sys_config('fail_inc_send_day', 1);
+//            $day_send = bcdiv((string)(($v['num'] - $v['sent_num'] + $v['up_speed_used'])), (string)($send_day - $v['sent_day']), 2);
+//            }
             $up_speed = bcdiv((string)$up_speed, (string)($send_day - $v['sent_day']), 2);
 
             $real_send = $day_send + $up_speed;