|
|
@@ -36,9 +36,13 @@ class Taskorderguquan
|
|
36
|
36
|
// 1. 查询用户
|
|
37
|
37
|
$userList = Db::name("user")
|
|
38
|
38
|
->where('is_del', 0)
|
|
|
39
|
+ // ->whereIn('uid', [277, 1593])
|
|
39
|
40
|
->column('uid, spread_uid, contribute, per_contribute, pv', 'uid');
|
|
40
|
41
|
// $userIds = array_keys($userList);
|
|
41
|
42
|
|
|
|
43
|
+ $oldUserList = Db::name("old_user_jbp")
|
|
|
44
|
+ ->column('id, amount');
|
|
|
45
|
+
|
|
42
|
46
|
// 2. 查询老订单
|
|
43
|
47
|
$userOfGoodsListRaw = Db::name("old_user_of_goods")
|
|
44
|
48
|
->where('status', 1)
|
|
|
@@ -62,7 +66,7 @@ class Taskorderguquan
|
|
62
|
66
|
->where('status', '<>', -1)
|
|
63
|
67
|
// 优化: 如果记录非常多,可以分批查询或只查相关用户的
|
|
64
|
68
|
// ->whereIn('uid', array_merge($userIds, array_column($userList, 'spread_uid'))) // 查询购买者和潜在推广者
|
|
65
|
|
- ->field('uid, order_id, number, status')
|
|
|
69
|
+ ->field('uid, order_id, number, status, type')
|
|
66
|
70
|
->select()
|
|
67
|
71
|
->toArray();
|
|
68
|
72
|
|
|
|
@@ -77,11 +81,25 @@ class Taskorderguquan
|
|
77
|
81
|
|
|
78
|
82
|
// --- 数据预处理部分
|
|
79
|
83
|
$existingGongXian = [];
|
|
80
|
|
- foreach ($gongXianListRaw as $gx) $existingGongXian[$gx['uid'] . '_' . $gx['order_id']] = ['number' => $gx['number'], 'status' => $gx['status']];
|
|
|
84
|
+ $existingGongXianByUid = [];
|
|
|
85
|
+ foreach ($gongXianListRaw as $gx) {
|
|
|
86
|
+ $existingGongXian[$gx['uid'] . '_' . $gx['order_id']] = ['number' => $gx['number'], 'status' => $gx['status'], 'type' => $gx['type']];
|
|
|
87
|
+ // TODO 目前老订单id 1-900 新订单ID 4868 - 6255 线下扫码订单 6870 - 8733
|
|
|
88
|
+ if ((1 <= $gx['order_id'] && $gx['order_id'] <= 900) || (4868 <= $gx['order_id'] && $gx['order_id'] <= 6869)) {
|
|
|
89
|
+ $existingGongXianByUid[$gx['uid']][] = $gx['order_id'];
|
|
|
90
|
+ }
|
|
|
91
|
+ }
|
|
81
|
92
|
unset($gongXianListRaw);
|
|
82
|
93
|
|
|
83
|
94
|
$existingPv = [];
|
|
84
|
|
- foreach ($pvListRaw as $pv) $existingPv[$pv['uid'] . '_' . $pv['order_id']] = ['pv' => $pv['pv'], 'status' => $pv['status']];
|
|
|
95
|
+ $existingPvByUid = [];
|
|
|
96
|
+ foreach ($pvListRaw as $pv) {
|
|
|
97
|
+ $existingPv[$pv['uid'] . '_' . $pv['order_id']] = ['pv' => $pv['pv'], 'status' => $pv['status']];
|
|
|
98
|
+ // TODO 目前老订单id 1-900 新订单ID 4868 - 6255 线下扫码订单 6870 - 8733
|
|
|
99
|
+ if ((1 <= $pv['order_id'] && $pv['order_id'] <= 900) || (4868 <= $pv['order_id'] && $pv['order_id'] <= 6869)) {
|
|
|
100
|
+ $existingPvByUid[$pv['uid']][] = $pv['order_id'];
|
|
|
101
|
+ }
|
|
|
102
|
+ }
|
|
85
|
103
|
unset($pvListRaw);
|
|
86
|
104
|
|
|
87
|
105
|
$userOfGoodsByUid = [];
|
|
|
@@ -131,7 +149,8 @@ class Taskorderguquan
|
|
131
|
149
|
// 遍历用户列表进行计算和数据收集
|
|
132
|
150
|
foreach ($userList as $uid => $user) {
|
|
133
|
151
|
$spreadUid = $user['spread_uid'];
|
|
134
|
|
-
|
|
|
152
|
+ $existingGongXianByUid[$uid] = $existingGongXianByUid[$uid] ?? [];
|
|
|
153
|
+ $existingPvByUid[$uid] = $existingPvByUid[$uid] ?? [];
|
|
135
|
154
|
if (isset($userOfGoodsByUid[$uid])) {
|
|
136
|
155
|
foreach ($userOfGoodsByUid[$uid] as $oldOrder) {
|
|
137
|
156
|
switch ($oldOrder['money']) {
|
|
|
@@ -158,35 +177,47 @@ class Taskorderguquan
|
|
158
|
177
|
$settlementTimeOld = $oldOrder['create_time'] ? date('Y-m-d H:i:s', $oldOrder['create_time']) : strtotime($user['create_time']);
|
|
159
|
178
|
// --- 收集贡献值插入数据 ---
|
|
160
|
179
|
$orderKey = $uid . '_' . $oldOrder['order_id'];
|
|
|
180
|
+ // 一个人 同一个订单 可能有多条记录 有问题
|
|
161
|
181
|
if (isset($existingGongXian[$orderKey])) {
|
|
162
|
182
|
$result['oldOrderExistGongXian'][] = ['uid' => $uid, 'order_id' => $oldOrder['order_id']];
|
|
|
183
|
+ $existingGongXianByUid[$uid] = array_diff($existingGongXianByUid[$uid], [$oldOrder['order_id']]);
|
|
163
|
184
|
if ($existingGongXian[$orderKey]['status'] == 1) {
|
|
164
|
|
- $userUpdateData[$uid]['contribute'] += $existingGongXian[$orderKey]['number'];
|
|
|
185
|
+ if ($existingGongXian[$orderKey]['type'] == 1) {
|
|
|
186
|
+ $userUpdateData[$uid]['contribute'] += $existingGongXian[$orderKey]['number'];
|
|
|
187
|
+ } else if ($existingGongXian[$orderKey]['type'] == 2) {
|
|
|
188
|
+ $userUpdateData[$uid]['contribute'] -= $existingGongXian[$orderKey]['number'];
|
|
|
189
|
+ }
|
|
165
|
190
|
}
|
|
166
|
191
|
if (!empty($spreadUid) && isset($userUpdateData[$spreadUid])) {
|
|
|
192
|
+ $existingGongXianByUid[$spreadUid] = array_diff($existingGongXianByUid[$spreadUid], [$oldOrder['order_id']]);
|
|
167
|
193
|
if (isset($existingGongXian[$spreadUid . '_' . $oldOrder['order_id']])) {
|
|
168
|
194
|
if ($existingGongXian[$spreadUid . '_' . $oldOrder['order_id']]['status'] == 1) {
|
|
169
|
|
- $userUpdateData[$spreadUid]['per_contribute'] += $existingGongXian[$spreadUid . '_' . $oldOrder['order_id']]['number'];
|
|
|
195
|
+ if ($existingGongXian[$spreadUid . '_' . $oldOrder['order_id']]['type'] == 1) {
|
|
|
196
|
+ $userUpdateData[$spreadUid]['per_contribute'] += $existingGongXian[$spreadUid . '_' . $oldOrder['order_id']]['number'];
|
|
|
197
|
+ } else if ($existingGongXian[$spreadUid . '_' . $oldOrder['order_id']]['type'] == 2) {
|
|
|
198
|
+ $userUpdateData[$spreadUid]['per_contribute'] -= $existingGongXian[$spreadUid . '_' . $oldOrder['order_id']]['number'];
|
|
|
199
|
+ }
|
|
170
|
200
|
}
|
|
171
|
201
|
}
|
|
172
|
202
|
}
|
|
173
|
203
|
} else {
|
|
174
|
204
|
if ($totalPv > 0) {
|
|
175
|
205
|
$userUpdateData[$uid]['contribute'] += $totalPv;
|
|
176
|
|
-
|
|
177
|
206
|
// --- 收集贡献值插入数据 ---
|
|
178
|
207
|
$gongXianBase = [
|
|
179
|
208
|
"number" => $totalPv, "addtime" => strtotime($settlementTimeOld), "status" => 1,
|
|
180
|
|
- "order_type" => 1, "order_id" => $oldOrder['order_id'],
|
|
|
209
|
+ "order_type" => 21, "order_id" => $oldOrder['order_id'],
|
|
181
|
210
|
"desc" => '', "surplus" => 0, "type" => 1, 'settlement_time' => $settlementTimeOld
|
|
182
|
211
|
];
|
|
183
|
212
|
// 本人
|
|
184
|
|
- $gongXianDataToInsert[] = array_merge(["uid" => $uid, "mark" => "1.0系统购买会员专区商品赠送贡献值"], $gongXianBase);
|
|
|
213
|
+ $gongXianDataToInsert[] = array_merge(["uid" => $uid, "mark" => "购买会员专区商品赠送贡献值(1.0)"], $gongXianBase);
|
|
|
214
|
+ $existingGongXianByUid[$uid] = array_diff($existingGongXianByUid[$uid], [$oldOrder['order_id']]);
|
|
185
|
215
|
// 推广人
|
|
186
|
216
|
if (!empty($user['spread_uid'])) {
|
|
187
|
217
|
if (isset($userUpdateData[$spreadUid])) {
|
|
188
|
218
|
$userUpdateData[$spreadUid]['per_contribute'] += $totalPv;
|
|
189
|
|
- $gongXianDataToInsert[] = array_merge(["uid" => $spreadUid, "mark" => "1.0系统推广会员专区商品赠送贡献值"], $gongXianBase);
|
|
|
219
|
+ $gongXianDataToInsert[] = array_merge(["uid" => $spreadUid, "mark" => "推广会员专区商品赠送贡献值(1.0)"], $gongXianBase);
|
|
|
220
|
+ $existingGongXianByUid[$spreadUid] = array_diff($existingGongXianByUid[$spreadUid], [$oldOrder['order_id']]);
|
|
190
|
221
|
}
|
|
191
|
222
|
}
|
|
192
|
223
|
}
|
|
|
@@ -201,11 +232,13 @@ class Taskorderguquan
|
|
201
|
232
|
$userUpdateData[$uid]['pv'] += $totalPv;
|
|
202
|
233
|
$pvDataToInsert[] = [
|
|
203
|
234
|
"uid" => $uid, "pv" => $totalPv, "addtime" => strtotime($settlementTimeOld), "status" => 1,
|
|
204
|
|
- "order_type" => 0, "order_id" => $oldOrder['order_id'],
|
|
205
|
|
- "mark" => "1.0系统购买会员专区商品赠送PV", 'settlement_time' => $settlementTimeOld
|
|
|
235
|
+ "order_type" => 21, "order_id" => $oldOrder['order_id'],
|
|
|
236
|
+ "mark" => "购买会员专区商品赠送PV(1.0)", 'settlement_time' => $settlementTimeOld
|
|
206
|
237
|
];
|
|
207
|
238
|
}
|
|
208
|
|
-
|
|
|
239
|
+ if (!empty($existingPvByUid[$uid])) {
|
|
|
240
|
+ $existingPvByUid[$uid] = array_diff($existingPvByUid[$uid], [$oldOrder['order_id']]);
|
|
|
241
|
+ }
|
|
209
|
242
|
}
|
|
210
|
243
|
} // end if isset($userOfGoodsByUid[$uid])
|
|
211
|
244
|
|
|
|
@@ -244,35 +277,46 @@ class Taskorderguquan
|
|
244
|
277
|
// --- 收集贡献值插入数据 ---
|
|
245
|
278
|
if (isset($existingGongXian[$orderKey])) {
|
|
246
|
279
|
$result['orderExistGongXian'][] = ['uid' => $uid, 'order_id' => $order['order_id']];
|
|
|
280
|
+ $existingGongXianByUid[$uid] = array_diff($existingGongXianByUid[$uid], [$order['order_id']]);
|
|
247
|
281
|
// 累加计算值
|
|
248
|
282
|
if ($existingGongXian[$orderKey]['status'] == 1) {
|
|
249
|
|
- $userUpdateData[$uid]['contribute'] += $existingGongXian[$orderKey]['number'];
|
|
|
283
|
+ if ($existingGongXian[$orderKey]['type'] == 1) {
|
|
|
284
|
+ $userUpdateData[$uid]['contribute'] += $existingGongXian[$orderKey]['number'];
|
|
|
285
|
+ } else if ($existingGongXian[$orderKey]['type'] == 2) {
|
|
|
286
|
+ $userUpdateData[$uid]['contribute'] -= $existingGongXian[$orderKey]['number'];
|
|
|
287
|
+ }
|
|
250
|
288
|
}
|
|
251
|
289
|
if (!empty($spreadUid) && isset($userUpdateData[$spreadUid])) {
|
|
|
290
|
+ $existingGongXianByUid[$spreadUid] = array_diff($existingGongXianByUid[$spreadUid], [$order['order_id']]);
|
|
252
|
291
|
if (isset($existingGongXian[$spreadUid . '_' . $order['order_id']])) {
|
|
253
|
292
|
if ($existingGongXian[$spreadUid . '_' . $order['order_id']]['status'] == 1) {
|
|
254
|
|
- $userUpdateData[$spreadUid]['per_contribute'] += $existingGongXian[$spreadUid . '_' . $order['order_id']]['number'];
|
|
|
293
|
+ if ($existingGongXian[$spreadUid . '_' . $order['order_id']]['type'] == 1) {
|
|
|
294
|
+ $userUpdateData[$spreadUid]['per_contribute'] += $existingGongXian[$spreadUid . '_' . $order['order_id']]['number'];
|
|
|
295
|
+ } else if ($existingGongXian[$spreadUid . '_' . $order['order_id']]['type'] == 2) {
|
|
|
296
|
+ $userUpdateData[$spreadUid]['per_contribute'] += $existingGongXian[$spreadUid . '_' . $order['order_id']]['number'];
|
|
|
297
|
+ }
|
|
255
|
298
|
}
|
|
256
|
299
|
}
|
|
257
|
300
|
}
|
|
258
|
301
|
|
|
259
|
302
|
} else {
|
|
260
|
303
|
if ($totalPv > 0) {
|
|
261
|
|
- // 累加计算值
|
|
262
|
304
|
$userUpdateData[$uid]['contribute'] += $totalPv;
|
|
263
|
305
|
$gongXianBase = [ // 优化: 提取公共字段
|
|
264
|
306
|
"number" => $totalPv, "addtime" => strtotime($settlementTimeNew), "status" => 1,
|
|
265
|
|
- "order_type" => 1, "order_id" => $order['order_id'],
|
|
|
307
|
+ "order_type" => 22, "order_id" => $order['order_id'],
|
|
266
|
308
|
"desc" => '', "surplus" => 0, "type" => 1, 'settlement_time' => $settlementTimeNew
|
|
267
|
309
|
];
|
|
268
|
310
|
// 本人
|
|
269
|
|
- $gongXianDataToInsert[] = array_merge(["uid" => $uid, "mark" => "2.0系统购买商品赠送贡献值"], $gongXianBase);
|
|
|
311
|
+ $gongXianDataToInsert[] = array_merge(["uid" => $uid, "mark" => "购买商品赠送贡献值(2.0)"], $gongXianBase);
|
|
|
312
|
+ $existingGongXianByUid[$uid] = array_diff($existingGongXianByUid[$uid], [$order['order_id']]);
|
|
270
|
313
|
// 推广人
|
|
271
|
314
|
if (!empty($user['spread_uid'])) {
|
|
272
|
315
|
$spreadUid = $user['spread_uid'];
|
|
273
|
316
|
if (isset($userUpdateData[$spreadUid])) { // 确保推广者存在
|
|
274
|
|
- $gongXianDataToInsert[] = array_merge(["uid" => $spreadUid, "mark" => "2.0系统推广商品赠送贡献值"], $gongXianBase);
|
|
|
317
|
+ $gongXianDataToInsert[] = array_merge(["uid" => $spreadUid, "mark" => "推广商品赠送贡献值(2.0)"], $gongXianBase);
|
|
275
|
318
|
$userUpdateData[$spreadUid]['per_contribute'] += $totalPv; // 累加推广者业绩
|
|
|
319
|
+ $existingGongXianByUid[$spreadUid] = array_diff($existingGongXianByUid[$spreadUid], [$order['order_id']]);
|
|
276
|
320
|
}
|
|
277
|
321
|
}
|
|
278
|
322
|
}
|
|
|
@@ -288,12 +332,15 @@ class Taskorderguquan
|
|
288
|
332
|
$userUpdateData[$uid]['pv'] += $totalPv;
|
|
289
|
333
|
$pvDataToInsert[] = [
|
|
290
|
334
|
"uid" => $uid, "pv" => $totalPv, "addtime" => strtotime($settlementTimeNew), "status" => 1,
|
|
291
|
|
- "order_type" => 0, // 确认 PV log 的 order_type 是否与贡献一致或有区分
|
|
|
335
|
+ "order_type" => 22, // 确认 PV log 的 order_type 是否与贡献一致或有区分
|
|
292
|
336
|
"order_id" => $order['order_id'],
|
|
293
|
|
- "mark" => "2.0系统购买商品赠送PV", // 标记调整为更通用
|
|
|
337
|
+ "mark" => "购买商品赠送PV(2.0)", // 标记调整为更通用
|
|
294
|
338
|
'settlement_time' => $settlementTimeNew
|
|
295
|
339
|
];
|
|
296
|
340
|
}
|
|
|
341
|
+ if (!empty($existingPvByUid[$uid])) {
|
|
|
342
|
+ $existingPvByUid[$uid] = array_diff($existingPvByUid[$uid], [$order['order_id']]);
|
|
|
343
|
+ }
|
|
297
|
344
|
}
|
|
298
|
345
|
}
|
|
299
|
346
|
// end if isset($storeOrdersByUid[$uid])
|
|
|
@@ -324,6 +371,64 @@ class Taskorderguquan
|
|
324
|
371
|
// 使用事务确保数据一致性
|
|
325
|
372
|
Db::startTrans();
|
|
326
|
373
|
try {
|
|
|
374
|
+ $bill = [];
|
|
|
375
|
+ foreach ($oldUserList as $item) {
|
|
|
376
|
+ $bill[] = [
|
|
|
377
|
+ 'uid' => $item['id'],
|
|
|
378
|
+ 'link_id' => 0,//关联订单id
|
|
|
379
|
+ 'pm' => 1,//0:支出,1:获得
|
|
|
380
|
+ 'title' => '佣金',//账单标题
|
|
|
381
|
+ 'category' => 'now_money',//明细种类
|
|
|
382
|
+ 'type' => 'commission',//明细类型
|
|
|
383
|
+ 'number' => $item['amount'],//明细数字
|
|
|
384
|
+ 'balance' => 0,//剩余
|
|
|
385
|
+ 'mark' => '1.0佣金记录',//备注
|
|
|
386
|
+ 'create_time' => '2025-02-04 00:00:00',//添加时间
|
|
|
387
|
+ 'status' => 1,//0待确定,1有效,-1无效
|
|
|
388
|
+ 'commission_type' => 21,//佣金类型 1代理费 2 消费佣金 3直推奖√ 4辖区佣金\r\n5 养老金√ 6 广告费
|
|
|
389
|
+ //7 跨店奖励√ 8平台奖励 9渠道商\r\n10 推荐创客收益√ 11分红奖金√ 12代理区域收益√ 13消费循环佣金
|
|
|
390
|
+ //14-推荐代理收益√ 15邀请小区团长升级√ 16大v分享奖√ 17创客合伙人√ 18积分奖励√ 19创客补贴√’
|
|
|
391
|
+ 'order_sn' => 0,//订单号
|
|
|
392
|
+ 'tripartite' => 0,//
|
|
|
393
|
+ 'type_shop' => 0,//0平台1多多进宝2唯品会3苏宁易购4网易考拉5淘宝客6京东联盟7饿了么8线上
|
|
|
394
|
+ 'mer_id' => 0,//商户id
|
|
|
395
|
+ 'source' => 0,//1线下 0线上
|
|
|
396
|
+ 'order_type' => 1,//1自营 2 第三方 订单类型
|
|
|
397
|
+ 'is_red_brokerage' => 0,//1红积分对冲佣金 0正常佣金
|
|
|
398
|
+ 'gzc' => 3,//养老金是否已进入公证处log表0:未进入。1:已进入
|
|
|
399
|
+ 'take_time' => '',//结算时间
|
|
|
400
|
+ 'district_id' => '',//
|
|
|
401
|
+ 'street_id' => '',//
|
|
|
402
|
+ 'month' => '',//月份
|
|
|
403
|
+
|
|
|
404
|
+
|
|
|
405
|
+ ];
|
|
|
406
|
+ }
|
|
|
407
|
+ $chunkedBill = array_chunk($bill, 500);
|
|
|
408
|
+ foreach ($chunkedBill as $chunk) {
|
|
|
409
|
+ Db::name('user_bill')->insertAll($chunk);
|
|
|
410
|
+ }
|
|
|
411
|
+
|
|
|
412
|
+ if (!empty($existingGongXianByUid)) {
|
|
|
413
|
+ foreach ($existingGongXianByUid as $uid => $orderList) {
|
|
|
414
|
+ if (!empty($orderList)) {
|
|
|
415
|
+ Db::name("user_sign_gongxian")
|
|
|
416
|
+ ->where('uid', $uid)
|
|
|
417
|
+ ->whereIn('order_id', $orderList)
|
|
|
418
|
+ ->update(['status' => 0]);
|
|
|
419
|
+ }
|
|
|
420
|
+ }
|
|
|
421
|
+ }
|
|
|
422
|
+ if (!empty($existingPvByUid)) {
|
|
|
423
|
+ foreach ($existingPvByUid as $uid => $orderList) {
|
|
|
424
|
+ if (!empty($orderList)) {
|
|
|
425
|
+ Db::name("user_pv_log")
|
|
|
426
|
+ ->where('uid', $uid)
|
|
|
427
|
+ ->whereIn('order_id', $orderList)
|
|
|
428
|
+ ->update(['status' => 0]);
|
|
|
429
|
+ }
|
|
|
430
|
+ }
|
|
|
431
|
+ }
|
|
327
|
432
|
// --- 批量插入贡献值 ---
|
|
328
|
433
|
if (!empty($gongXianDataToInsert)) {
|
|
329
|
434
|
// 分块插入,避免单次插入过多数据 (例如一次500条)
|
|
|
@@ -453,109 +558,109 @@ class Taskorderguquan
|
|
453
|
558
|
|
|
454
|
559
|
return json($result);
|
|
455
|
560
|
|
|
456
|
|
- // 计算总业绩
|
|
457
|
|
- $totalPv = [];
|
|
458
|
|
- foreach ($user_team_amount as $order) {
|
|
459
|
|
- if (!isset($totalPv[$order['user_id']])) {
|
|
460
|
|
- $totalPv[$order['user_id']] = 0;
|
|
461
|
|
- }
|
|
462
|
|
- switch ($order['money']) {
|
|
463
|
|
- case 1180:
|
|
464
|
|
- $totalPv[$order['user_id']] += 700;
|
|
465
|
|
- break;
|
|
466
|
|
- case 11800:
|
|
467
|
|
- $totalPv[$order['user_id']] += 7000;
|
|
468
|
|
- break;
|
|
469
|
|
- case 10620:
|
|
470
|
|
- $totalPv[$order['user_id']] += 6300;
|
|
471
|
|
- break;
|
|
472
|
|
- case 2360:
|
|
473
|
|
- $totalPv[$order['user_id']] += 1400;
|
|
474
|
|
- break;
|
|
475
|
|
- case 9440:
|
|
476
|
|
- $totalPv[$order['user_id']] += 5600;
|
|
477
|
|
- break;
|
|
478
|
|
- default:
|
|
479
|
|
- if ($order['money'] == 2344.99) {
|
|
480
|
|
- break;
|
|
481
|
|
- }
|
|
482
|
|
- $totalPv[$order['user_id']] += round($order['money'] * 0.7, 2);
|
|
483
|
|
- break;
|
|
484
|
|
- }
|
|
485
|
|
- }
|
|
486
|
|
- foreach ($totalPv as $uid => $pv) {
|
|
487
|
|
- Db::name("user")->where('is_old', 1)->where("uid", $uid)->update(['pv' => $pv]);
|
|
488
|
|
- }
|
|
489
|
|
-
|
|
490
|
|
- return;
|
|
491
|
|
- /**
|
|
492
|
|
- * 周金花200(13959100621)
|
|
493
|
|
- * 黄金花200(18603401312)
|
|
494
|
|
- * 徐立苹100(13521438652)
|
|
495
|
|
- * 李素红200(13701061395)
|
|
496
|
|
- * 周行体200(13231658486)
|
|
497
|
|
- * 刘银霞100(13161909228)
|
|
498
|
|
- * 李卫东100(13911601230)
|
|
499
|
|
- * 金 波100(13801358713)
|
|
500
|
|
- * 王 玲 150(15810064711)
|
|
501
|
|
- * 侯玉兰150(15232797965)
|
|
502
|
|
- * 吕丽娣100(15960349667)
|
|
503
|
|
- * 张传莲100(15332507711)
|
|
504
|
|
- * 刘春梅100(18760167163)
|
|
505
|
|
- * 付天如100(18863873000)
|
|
506
|
|
- * 付绍先100(15324059286)
|
|
507
|
|
- * 黄桂林100(15960196876)
|
|
508
|
|
- * 温 煌100(18350134089)
|
|
509
|
|
- * 谭英先100(13978627072)
|
|
510
|
|
- * 陈玉珍100(19858353660)
|
|
511
|
|
- * 黄雪云100(18650055445)
|
|
512
|
|
- * 黄 玲100(13877193411)
|
|
513
|
|
- * 邱佳珍100(13960379098)
|
|
514
|
|
- * 隋彩云100(13601071082)
|
|
515
|
|
- */
|
|
516
|
|
- $data = [
|
|
517
|
|
- '13959100621' => 200,
|
|
518
|
|
- '18603401312' => 200,
|
|
519
|
|
- '13521438652' => 100,
|
|
520
|
|
- '13701061395' => 200,
|
|
521
|
|
- '13231658486' => 200,
|
|
522
|
|
- '13161909228' => 100,
|
|
523
|
|
- '13911601230' => 100,
|
|
524
|
|
- '13801358713' => 100,
|
|
525
|
|
- '15810064711' => 150,
|
|
526
|
|
- '15232797965' => 150,
|
|
527
|
|
- '15960349667' => 100,
|
|
528
|
|
- '15332507711' => 100,
|
|
529
|
|
- '18760167163' => 100,
|
|
530
|
|
- '18863873000' => 100,
|
|
531
|
|
- '15324059286' => 100,
|
|
532
|
|
- '15960196876' => 100,
|
|
533
|
|
- '18350134089' => 100,
|
|
534
|
|
- '13978627072' => 100,
|
|
535
|
|
- '19858353660' => 100,
|
|
536
|
|
- '18650055445' => 100,
|
|
537
|
|
- '13877193411' => 100,
|
|
538
|
|
- '13960379098' => 100,
|
|
539
|
|
- '13601071082' => 100,
|
|
540
|
|
- ];
|
|
541
|
|
- $result = Db::name("user")
|
|
542
|
|
- ->whereIn("account", array_keys($data))
|
|
543
|
|
- ->where('is_del', 0)
|
|
544
|
|
- ->field('uid, brokerage_price, account, nickname')
|
|
545
|
|
- ->select();
|
|
546
|
|
- $res = [];
|
|
547
|
|
- foreach ($result as $v) {
|
|
548
|
|
- Db::name("user")->where("uid", $v['uid'])->inc("brokerage_price", $data[$v['account']])->save();
|
|
549
|
|
- $this->bill_user_log111111($v['uid'], "佣金补贴", $data[$v['account']], "佣金补贴", 8);//股权分佣明细2.0系统
|
|
550
|
|
- $res[] = [
|
|
551
|
|
- 'uid' => $v['uid'],
|
|
552
|
|
- 'account' => $v['account'],
|
|
553
|
|
- 'brokerage_price_pre' => $v['brokerage_price'],
|
|
554
|
|
- 'brokerage_price' => $data[$v['account']],
|
|
555
|
|
- 'nickname' => $v['nickname']
|
|
556
|
|
- ];
|
|
557
|
|
- }
|
|
558
|
|
- return json($res);
|
|
|
561
|
+ // // 计算总业绩
|
|
|
562
|
+ // $totalPv = [];
|
|
|
563
|
+ // foreach ($user_team_amount as $order) {
|
|
|
564
|
+ // if (!isset($totalPv[$order['user_id']])) {
|
|
|
565
|
+ // $totalPv[$order['user_id']] = 0;
|
|
|
566
|
+ // }
|
|
|
567
|
+ // switch ($order['money']) {
|
|
|
568
|
+ // case 1180:
|
|
|
569
|
+ // $totalPv[$order['user_id']] += 700;
|
|
|
570
|
+ // break;
|
|
|
571
|
+ // case 11800:
|
|
|
572
|
+ // $totalPv[$order['user_id']] += 7000;
|
|
|
573
|
+ // break;
|
|
|
574
|
+ // case 10620:
|
|
|
575
|
+ // $totalPv[$order['user_id']] += 6300;
|
|
|
576
|
+ // break;
|
|
|
577
|
+ // case 2360:
|
|
|
578
|
+ // $totalPv[$order['user_id']] += 1400;
|
|
|
579
|
+ // break;
|
|
|
580
|
+ // case 9440:
|
|
|
581
|
+ // $totalPv[$order['user_id']] += 5600;
|
|
|
582
|
+ // break;
|
|
|
583
|
+ // default:
|
|
|
584
|
+ // if ($order['money'] == 2344.99) {
|
|
|
585
|
+ // break;
|
|
|
586
|
+ // }
|
|
|
587
|
+ // $totalPv[$order['user_id']] += round($order['money'] * 0.7, 2);
|
|
|
588
|
+ // break;
|
|
|
589
|
+ // }
|
|
|
590
|
+ // }
|
|
|
591
|
+ // foreach ($totalPv as $uid => $pv) {
|
|
|
592
|
+ // Db::name("user")->where('is_old', 1)->where("uid", $uid)->update(['pv' => $pv]);
|
|
|
593
|
+ // }
|
|
|
594
|
+ //
|
|
|
595
|
+ // return;
|
|
|
596
|
+ // /**
|
|
|
597
|
+ // * 周金花200(13959100621)
|
|
|
598
|
+ // * 黄金花200(18603401312)
|
|
|
599
|
+ // * 徐立苹100(13521438652)
|
|
|
600
|
+ // * 李素红200(13701061395)
|
|
|
601
|
+ // * 周行体200(13231658486)
|
|
|
602
|
+ // * 刘银霞100(13161909228)
|
|
|
603
|
+ // * 李卫东100(13911601230)
|
|
|
604
|
+ // * 金 波100(13801358713)
|
|
|
605
|
+ // * 王 玲 150(15810064711)
|
|
|
606
|
+ // * 侯玉兰150(15232797965)
|
|
|
607
|
+ // * 吕丽娣100(15960349667)
|
|
|
608
|
+ // * 张传莲100(15332507711)
|
|
|
609
|
+ // * 刘春梅100(18760167163)
|
|
|
610
|
+ // * 付天如100(18863873000)
|
|
|
611
|
+ // * 付绍先100(15324059286)
|
|
|
612
|
+ // * 黄桂林100(15960196876)
|
|
|
613
|
+ // * 温 煌100(18350134089)
|
|
|
614
|
+ // * 谭英先100(13978627072)
|
|
|
615
|
+ // * 陈玉珍100(19858353660)
|
|
|
616
|
+ // * 黄雪云100(18650055445)
|
|
|
617
|
+ // * 黄 玲100(13877193411)
|
|
|
618
|
+ // * 邱佳珍100(13960379098)
|
|
|
619
|
+ // * 隋彩云100(13601071082)
|
|
|
620
|
+ // */
|
|
|
621
|
+ // $data = [
|
|
|
622
|
+ // '13959100621' => 200,
|
|
|
623
|
+ // '18603401312' => 200,
|
|
|
624
|
+ // '13521438652' => 100,
|
|
|
625
|
+ // '13701061395' => 200,
|
|
|
626
|
+ // '13231658486' => 200,
|
|
|
627
|
+ // '13161909228' => 100,
|
|
|
628
|
+ // '13911601230' => 100,
|
|
|
629
|
+ // '13801358713' => 100,
|
|
|
630
|
+ // '15810064711' => 150,
|
|
|
631
|
+ // '15232797965' => 150,
|
|
|
632
|
+ // '15960349667' => 100,
|
|
|
633
|
+ // '15332507711' => 100,
|
|
|
634
|
+ // '18760167163' => 100,
|
|
|
635
|
+ // '18863873000' => 100,
|
|
|
636
|
+ // '15324059286' => 100,
|
|
|
637
|
+ // '15960196876' => 100,
|
|
|
638
|
+ // '18350134089' => 100,
|
|
|
639
|
+ // '13978627072' => 100,
|
|
|
640
|
+ // '19858353660' => 100,
|
|
|
641
|
+ // '18650055445' => 100,
|
|
|
642
|
+ // '13877193411' => 100,
|
|
|
643
|
+ // '13960379098' => 100,
|
|
|
644
|
+ // '13601071082' => 100,
|
|
|
645
|
+ // ];
|
|
|
646
|
+ // $result = Db::name("user")
|
|
|
647
|
+ // ->whereIn("account", array_keys($data))
|
|
|
648
|
+ // ->where('is_del', 0)
|
|
|
649
|
+ // ->field('uid, brokerage_price, account, nickname')
|
|
|
650
|
+ // ->select();
|
|
|
651
|
+ // $res = [];
|
|
|
652
|
+ // foreach ($result as $v) {
|
|
|
653
|
+ // Db::name("user")->where("uid", $v['uid'])->inc("brokerage_price", $data[$v['account']])->save();
|
|
|
654
|
+ // $this->bill_user_log111111($v['uid'], "佣金补贴", $data[$v['account']], "佣金补贴", 8);//股权分佣明细2.0系统
|
|
|
655
|
+ // $res[] = [
|
|
|
656
|
+ // 'uid' => $v['uid'],
|
|
|
657
|
+ // 'account' => $v['account'],
|
|
|
658
|
+ // 'brokerage_price_pre' => $v['brokerage_price'],
|
|
|
659
|
+ // 'brokerage_price' => $data[$v['account']],
|
|
|
660
|
+ // 'nickname' => $v['nickname']
|
|
|
661
|
+ // ];
|
|
|
662
|
+ // }
|
|
|
663
|
+ // return json($res);
|
|
559
|
664
|
|
|
560
|
665
|
}
|
|
561
|
666
|
|