Browse Source

feat(api): 添加共富万人团分红测试接口

- 在api路由中添加share_prosperity_test_group接口
- 实现Task控制器中的share_prosperity_test_group方法
- 查询共富万人团用户数据并进行分红处理
- 为每个用户插入分红账单记录
- 更新用户佣金金额
- 设置分红类型为共享共富团佣金
shichen 5 months ago
parent
commit
b2841dab96
2 changed files with 42 additions and 0 deletions
  1. 39 0
      app/controller/api/shareProsperity/Task.php
  2. 3 0
      route/api.php

+ 39 - 0
app/controller/api/shareProsperity/Task.php

@@ -428,4 +428,43 @@ class Task
428 428
             $b = Db::name('user')->where('uid',$uid)->inc('brokerage_price',$money)->update();
429 429
         }
430 430
     }
431
+
432
+    public function share_prosperity_test_group()
433
+    {
434
+        $groupUser = Db::name('shared_prosperity_group_user')->where('group_id',1)->select()->toArray();
435
+        $userData = array_column($groupUser,'user_id');
436
+        $money = 1.26;
437
+        foreach ($userData as $key => $uid) {
438
+            $bill = [
439
+                'uid' => $uid,
440
+                'link_id' => 0,
441
+                'pm' => 1,
442
+                'title' => '共富万人团分红',
443
+                'category' => 'now_money',
444
+                'type' => 'commission',
445
+                'number' => $money,
446
+                'balance' => 0,
447
+                'mark' => '共富万人团分红',
448
+                'create_time' => date('Y-m-d H:i:s'),
449
+                'status' => 1,
450
+                'commission_type' => CommonEnum::COMMISSION_TYPE['SHARED_PROSPERITY_GROUP_COMMISSION']['code'],
451
+                'order_sn' => 0,
452
+                'tripartite' => 0,
453
+                'type_shop' => 0,
454
+                'mer_id' => 0,
455
+                'source' => 0,
456
+                'order_type' => 1,
457
+                'is_red_brokerage' => 0,
458
+                'gzc' => 3,
459
+                'take_time' => time(),
460
+                'district_id' => '',
461
+                'street_id' => '',
462
+                'month' => '',
463
+            ];
464
+            $a = Db::name('user_bill')->insert($bill);
465
+
466
+            $b = Db::name('user')->where('uid',$uid)->inc('brokerage_price',$money)->update();
467
+        }
468
+
469
+    }
431 470
 }

+ 3 - 0
route/api.php

@@ -1387,5 +1387,8 @@ Route::get('share_prosperity_thank', 'api.shareProsperity.Task/thankProfits');
1387 1387
 Route::get('share_prosperity_group', 'api.shareProsperity.Task/groupProfits');
1388 1388
 Route::get('share_prosperity_test', 'api.shareProsperity.Task/testProfits');
1389 1389
 
1390
+// 分红(万人团)
1391
+Route::get('share_prosperity_test_group', 'api.shareProsperity.Task/share_prosperity_test_group');
1392
+
1390 1393
 // 测试接口
1391 1394
 Route::get('/test', 'api.Test/test');