|
|
@@ -4,8 +4,11 @@ namespace app\controller\api;
|
|
4
|
4
|
|
|
5
|
5
|
use app\common\dao\shared\SharedProsperityUserDao;
|
|
6
|
6
|
use app\common\enum\CommonEnum;
|
|
|
7
|
+use app\common\enum\shared\SharedProsperityRewardRecordEnum;
|
|
7
|
8
|
use app\common\model\shared\SharedProsperityUser;
|
|
8
|
9
|
use app\common\repositories\shared\SharedProsperityUserRepository;
|
|
|
10
|
+use app\common\repositories\store\order\StoreGroupOrderRepository;
|
|
|
11
|
+use app\common\repositories\store\order\StoreOrderRepository;
|
|
9
|
12
|
use app\common\repositories\user\UserRepository;
|
|
10
|
13
|
use app\traits\GzcApiRequest;
|
|
11
|
14
|
use think\facade\Db;
|
|
|
@@ -16,46 +19,91 @@ class Test
|
|
16
|
19
|
{
|
|
17
|
20
|
|
|
18
|
21
|
|
|
19
|
|
- $title = '系统补贴';
|
|
20
|
|
- $map = [
|
|
21
|
|
- 294 => 165,
|
|
22
|
|
- 186 => 860
|
|
23
|
|
- ];
|
|
|
22
|
+ // // 1、获取订单数据
|
|
|
23
|
+ // /** @var StoreGroupOrderRepository $storeGroupOrderRepository */
|
|
|
24
|
+ // $storeGroupOrderRepository = app()->make(StoreGroupOrderRepository::class);
|
|
|
25
|
+ // // 获取订单组数据
|
|
|
26
|
+ // $groupOrderSn = 'wx177442719463317087';
|
|
|
27
|
+ // $storeGroupOrderEntity = $storeGroupOrderRepository->getStoreGroupOrderEntityByGroupOrderSn($groupOrderSn);
|
|
|
28
|
+ // /** @var StoreOrderRepository $storeOrderRepository */
|
|
|
29
|
+ // $storeOrderRepository = app()->make(StoreOrderRepository::class);
|
|
|
30
|
+ // // 获取订单集合
|
|
|
31
|
+ // $storeOrderEntityList = $storeOrderRepository->getStoreOrderEntityListByGroupOrderId($storeGroupOrderEntity->getGroupOrderId());
|
|
|
32
|
+ // try {
|
|
|
33
|
+ // Db::transaction(function () use (
|
|
|
34
|
+ // $storeGroupOrderRepository,
|
|
|
35
|
+ // $storeGroupOrderEntity
|
|
|
36
|
+ // ) {
|
|
|
37
|
+ // $storeGroupOrderRepository->storeGroupOrderPaySuccess($storeGroupOrderEntity->getGroupOrderId());
|
|
|
38
|
+ // });
|
|
|
39
|
+ // } catch (\Throwable $e) {
|
|
|
40
|
+ // Db::name("log")
|
|
|
41
|
+ // ->insert([
|
|
|
42
|
+ // 'data' => '【订单支付回调】【结算订单失败】:时间:' . date('Y-m-d H:i:s', time()) . ';订单编号:1111订单失败原因:' . json_encode([
|
|
|
43
|
+ // 'error_message' => $e->getMessage(),
|
|
|
44
|
+ // 'error_file' => $e->getFile(),
|
|
|
45
|
+ // 'error_line' => $e->getLine(),
|
|
|
46
|
+ // 'error_code' => $e->getCode(),
|
|
|
47
|
+ // 'exception_class' => get_class($e),
|
|
|
48
|
+ // 'trace' => $e->getTraceAsString()
|
|
|
49
|
+ // ], JSON_UNESCAPED_UNICODE)
|
|
|
50
|
+ // ]);
|
|
|
51
|
+ // dd($e->getMessage());
|
|
|
52
|
+ // }
|
|
|
53
|
+ //
|
|
|
54
|
+ //
|
|
|
55
|
+ // die;
|
|
|
56
|
+
|
|
|
57
|
+ //
|
|
|
58
|
+ // $title = '系统补贴';
|
|
|
59
|
+ // $map = [
|
|
|
60
|
+ // 294 => 165,
|
|
|
61
|
+ // 186 => 860
|
|
|
62
|
+ // ];
|
|
|
63
|
+ //
|
|
|
64
|
+ // foreach ($map as $uid => $money) {
|
|
|
65
|
+ // $bill = [
|
|
|
66
|
+ // 'uid' => $uid,
|
|
|
67
|
+ // 'link_id' => 0,
|
|
|
68
|
+ // 'pm' => 1,
|
|
|
69
|
+ // 'title' => $title,
|
|
|
70
|
+ // 'category' => 'now_money',
|
|
|
71
|
+ // 'type' => 'commission',
|
|
|
72
|
+ // 'number' => $money,
|
|
|
73
|
+ // 'balance' => 0,
|
|
|
74
|
+ // 'mark' => $title,
|
|
|
75
|
+ // 'create_time' => date('Y-m-d H:i:s'),
|
|
|
76
|
+ // 'status' => 1,
|
|
|
77
|
+ // 'commission_type' => CommonEnum::COMMISSION_TYPE['SYSTEM_SUBSIDY_COMMISSION']['code'],
|
|
|
78
|
+ // 'order_sn' => 0,
|
|
|
79
|
+ // 'tripartite' => 0,
|
|
|
80
|
+ // 'type_shop' => 0,
|
|
|
81
|
+ // 'mer_id' => 0,
|
|
|
82
|
+ // 'source' => 0,
|
|
|
83
|
+ // 'order_type' => 1,
|
|
|
84
|
+ // 'is_red_brokerage' => 0,
|
|
|
85
|
+ // 'gzc' => 3,
|
|
|
86
|
+ // 'take_time' => time(),
|
|
|
87
|
+ // 'district_id' => '',
|
|
|
88
|
+ // 'street_id' => '',
|
|
|
89
|
+ // 'month' => '',
|
|
|
90
|
+ // ];
|
|
|
91
|
+ // $a = Db::name('user_bill')->insert($bill);
|
|
|
92
|
+ //
|
|
|
93
|
+ // $b = Db::name('user')->where('uid', $uid)->inc('brokerage_price', $money)->update();
|
|
|
94
|
+ // }
|
|
|
95
|
+ // die;
|
|
24
|
96
|
|
|
25
|
|
- foreach ($map as $uid => $money) {
|
|
26
|
|
- $bill = [
|
|
27
|
|
- 'uid' => $uid,
|
|
28
|
|
- 'link_id' => 0,
|
|
29
|
|
- 'pm' => 1,
|
|
30
|
|
- 'title' => $title,
|
|
31
|
|
- 'category' => 'now_money',
|
|
32
|
|
- 'type' => 'commission',
|
|
33
|
|
- 'number' => $money,
|
|
34
|
|
- 'balance' => 0,
|
|
35
|
|
- 'mark' => $title,
|
|
36
|
|
- 'create_time' => date('Y-m-d H:i:s'),
|
|
37
|
|
- 'status' => 1,
|
|
38
|
|
- 'commission_type' => CommonEnum::COMMISSION_TYPE['SYSTEM_SUBSIDY_COMMISSION']['code'],
|
|
39
|
|
- 'order_sn' => 0,
|
|
40
|
|
- 'tripartite' => 0,
|
|
41
|
|
- 'type_shop' => 0,
|
|
42
|
|
- 'mer_id' => 0,
|
|
43
|
|
- 'source' => 0,
|
|
44
|
|
- 'order_type' => 1,
|
|
45
|
|
- 'is_red_brokerage' => 0,
|
|
46
|
|
- 'gzc' => 3,
|
|
47
|
|
- 'take_time' => time(),
|
|
48
|
|
- 'district_id' => '',
|
|
49
|
|
- 'street_id' => '',
|
|
50
|
|
- 'month' => '',
|
|
51
|
|
- ];
|
|
52
|
|
- $a = Db::name('user_bill')->insert($bill);
|
|
53
|
97
|
|
|
54
|
|
- $b = Db::name('user')->where('uid', $uid)->inc('brokerage_price', $money)->update();
|
|
55
|
|
- }
|
|
56
|
|
- die;
|
|
|
98
|
+ // $sharedUserPvCount = Db::name('shared_prosperity_reward_record')
|
|
|
99
|
+ // ->where(['type' => SharedProsperityRewardRecordEnum::TYPE['PV']['code'], 'status' => SharedProsperityRewardRecordEnum::STATUS['VALID']['code'], 'pm' => SharedProsperityRewardRecordEnum::PM['INCOME']['code']])
|
|
|
100
|
+ // ->whereNotIn('user_id',$testUids)
|
|
|
101
|
+ // ->sum('number'); // 共富会员专区总业绩
|
|
|
102
|
+ // dd($sharedUserPvCount);
|
|
|
103
|
+ // die;
|
|
57
|
104
|
|
|
58
|
|
- $total = 8497.13;
|
|
|
105
|
+ //
|
|
|
106
|
+ $total = 2756.48;
|
|
59
|
107
|
$map = [
|
|
60
|
108
|
1 => 0.3,
|
|
61
|
109
|
2 => 0.15,
|
|
|
@@ -66,8 +114,9 @@ class Test
|
|
66
|
114
|
1 => 0.05,
|
|
67
|
115
|
2 => 0.1
|
|
68
|
116
|
];
|
|
|
117
|
+ $testUids = Db::name('user')->where('test_user', '1')->column('uid');
|
|
69
|
118
|
|
|
70
|
|
- $users = Db::name('shared_prosperity_user')->group('partner_level')->field('partner_level,count(*) as num')->select()->toArray();
|
|
|
119
|
+ $users = Db::name('shared_prosperity_user')->whereNotIn('user_id',$testUids)->group('partner_level')->field('partner_level,count(*) as num')->select()->toArray();
|
|
71
|
120
|
|
|
72
|
121
|
$res = [];
|
|
73
|
122
|
foreach ($users as $user) {
|
|
|
@@ -81,7 +130,7 @@ class Test
|
|
81
|
130
|
}
|
|
82
|
131
|
|
|
83
|
132
|
$groupRes = [];
|
|
84
|
|
- $groupUsers = Db::name('shared_prosperity_group_user')->group('group_id')->field('group_id,count(*)as num')->select()->toArray();
|
|
|
133
|
+ $groupUsers = Db::name('shared_prosperity_group_user')->whereNotIn('user_id',$testUids)->group('group_id')->field('group_id,count(*)as num')->select()->toArray();
|
|
85
|
134
|
foreach ($groupUsers as $groupUser) {
|
|
86
|
135
|
$groupRes[$groupUser['group_id']] = [
|
|
87
|
136
|
'num' => $groupUser['num'],
|
|
|
@@ -120,14 +169,14 @@ class Test
|
|
120
|
169
|
// dd($res);
|
|
121
|
170
|
|
|
122
|
171
|
|
|
123
|
|
- // /** @var SharedProsperityUserRepository $userRepository */
|
|
124
|
|
- // $userRepository = app()->make(SharedProsperityUserRepository::class);
|
|
125
|
|
- // $list = $userRepository->getUserTree(2393);
|
|
|
172
|
+ /** @var SharedProsperityUserRepository $userRepository */
|
|
|
173
|
+ $userRepository = app()->make(SharedProsperityUserRepository::class);
|
|
|
174
|
+ $list = $userRepository->getUserTree(294);
|
|
126
|
175
|
// var_dump(json_encode($list));
|
|
127
|
|
- $field = request()->param('field');
|
|
128
|
|
- /** @var UserRepository $userRepository */
|
|
129
|
|
- $userRepository = app()->make(UserRepository::class);
|
|
130
|
|
- $list = $userRepository->getUserForTree($field, 0);
|
|
|
176
|
+ // $field = request()->param('field');
|
|
|
177
|
+ // /** @var UserRepository $userRepository */
|
|
|
178
|
+ // $userRepository = app()->make(UserRepository::class);
|
|
|
179
|
+ // $list = $userRepository->getUserForTree($field, 0);
|
|
131
|
180
|
var_dump(json_encode($list));
|
|
132
|
181
|
// return app('json')->success($list);
|
|
133
|
182
|
}
|