Browse Source

feat(api): 添加合伙人分红功能

- 修改万人团分红注释为平均分描述
- 新增合伙人平均分分红路由配置
- 实现share_prosperity_test_partner方法处理合伙人分红逻辑
- 查询合伙人级别用户数据并循环发放分红金额
- 更新用户余额和添加分红记录到账单表
- 设置分红类型为共富一星合伙人佣金类型
shichen 5 months ago
parent
commit
d0119abf52
2 changed files with 44 additions and 1 deletions
  1. 40 0
      app/controller/api/shareProsperity/Task.php
  2. 4 1
      route/api.php

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

@@ -467,4 +467,44 @@ class Task
467 467
         }
468 468
 
469 469
     }
470
+
471
+    public function share_prosperity_test_partner()
472
+    {
473
+        $groupUser = Db::name('shared_prosperity_user')->where('partner_level',1)->select()->toArray();
474
+        $userData = array_column($groupUser,'user_id');
475
+        $money = 7.61;
476
+        foreach ($userData as $key => $uid) {
477
+            $bill = [
478
+                'uid' => $uid,
479
+                'link_id' => 0,
480
+                'pm' => 1,
481
+                'title' => '共富一星合伙人分红',
482
+                'category' => 'now_money',
483
+                'type' => 'commission',
484
+                'number' => $money,
485
+                'balance' => 0,
486
+                'mark' => '共富一星合伙人分红',
487
+                'create_time' => date('Y-m-d H:i:s'),
488
+                'status' => 1,
489
+                'commission_type' => CommonEnum::COMMISSION_TYPE['SHARED_PROSPERITY_PARTNER_COMMISSION']['code'],
490
+                'order_sn' => 0,
491
+                'tripartite' => 0,
492
+                'type_shop' => 0,
493
+                'mer_id' => 0,
494
+                'source' => 0,
495
+                'order_type' => 1,
496
+                'is_red_brokerage' => 0,
497
+                'gzc' => 3,
498
+                'take_time' => time(),
499
+                'district_id' => '',
500
+                'street_id' => '',
501
+                'month' => '',
502
+            ];
503
+            $a = Db::name('user_bill')->insert($bill);
504
+
505
+            $b = Db::name('user')->where('uid',$uid)->inc('brokerage_price',$money)->update();
506
+        }
507
+
508
+    }
509
+
470 510
 }

+ 4 - 1
route/api.php

@@ -1387,8 +1387,11 @@ 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
-// 分红(万人团)
1390
+// 分红(万人团平均分)
1391 1391
 Route::get('share_prosperity_test_group', 'api.shareProsperity.Task/share_prosperity_test_group');
1392
+// 分红(合伙人平均分)
1393
+Route::get('share_prosperity_test_partner', 'api.shareProsperity.Task/share_prosperity_test_partner');
1394
+
1392 1395
 
1393 1396
 // 测试接口
1394 1397
 Route::get('/test', 'api.Test/test');