|
@@ -59,7 +59,7 @@ class Taskorderguquan
|
|
59
|
|
59
|
|
|
60
|
// 4. 查询已存在的贡献值记录
|
60
|
// 4. 查询已存在的贡献值记录
|
|
61
|
$gongXianListRaw = Db::name("user_sign_gongxian")
|
61
|
$gongXianListRaw = Db::name("user_sign_gongxian")
|
|
62
|
- ->where('status', '!=', -1)
|
|
|
|
|
|
62
|
+ ->where('status', '<>', -1)
|
|
63
|
// 优化: 如果记录非常多,可以分批查询或只查相关用户的
|
63
|
// 优化: 如果记录非常多,可以分批查询或只查相关用户的
|
|
64
|
// ->whereIn('uid', array_merge($userIds, array_column($userList, 'spread_uid'))) // 查询购买者和潜在推广者
|
64
|
// ->whereIn('uid', array_merge($userIds, array_column($userList, 'spread_uid'))) // 查询购买者和潜在推广者
|
|
65
|
->field('uid, order_id, number, status')
|
65
|
->field('uid, order_id, number, status')
|
|
@@ -68,7 +68,7 @@ class Taskorderguquan
|
|
68
|
|
68
|
|
|
69
|
// 5. 查询已存在的PV记录
|
69
|
// 5. 查询已存在的PV记录
|
|
70
|
$pvListRaw = Db::name("user_pv_log")
|
70
|
$pvListRaw = Db::name("user_pv_log")
|
|
71
|
- ->where('status', '!=', -1)
|
|
|
|
|
|
71
|
+ ->where('status', '<>', -1)
|
|
72
|
// 优化: 同上
|
72
|
// 优化: 同上
|
|
73
|
// ->whereIn('uid', $userIds)
|
73
|
// ->whereIn('uid', $userIds)
|
|
74
|
->field('uid, order_id, pv, status')
|
74
|
->field('uid, order_id, pv, status')
|
|
@@ -246,12 +246,12 @@ class Taskorderguquan
|
|
246
|
$result['orderExistGongXian'][] = ['uid' => $uid, 'order_id' => $order['order_id']];
|
246
|
$result['orderExistGongXian'][] = ['uid' => $uid, 'order_id' => $order['order_id']];
|
|
247
|
// 累加计算值
|
247
|
// 累加计算值
|
|
248
|
if ($existingGongXian[$orderKey]['status'] == 1) {
|
248
|
if ($existingGongXian[$orderKey]['status'] == 1) {
|
|
249
|
- $userUpdateData[$uid]['contribute'] += $existingGongXian[$orderKey]['member'];
|
|
|
|
|
|
249
|
+ $userUpdateData[$uid]['contribute'] += $existingGongXian[$orderKey]['number'];
|
|
250
|
}
|
250
|
}
|
|
251
|
if (!empty($spreadUid) && isset($userUpdateData[$spreadUid])) {
|
251
|
if (!empty($spreadUid) && isset($userUpdateData[$spreadUid])) {
|
|
252
|
if (isset($existingGongXian[$spreadUid . '_' . $order['order_id']])) {
|
252
|
if (isset($existingGongXian[$spreadUid . '_' . $order['order_id']])) {
|
|
253
|
if ($existingGongXian[$spreadUid . '_' . $order['order_id']]['status'] == 1) {
|
253
|
if ($existingGongXian[$spreadUid . '_' . $order['order_id']]['status'] == 1) {
|
|
254
|
- $userUpdateData[$spreadUid]['per_contribute'] += $existingGongXian[$spreadUid . '_' . $order['order_id']]['member'];
|
|
|
|
|
|
254
|
+ $userUpdateData[$spreadUid]['per_contribute'] += $existingGongXian[$spreadUid . '_' . $order['order_id']]['number'];
|
|
255
|
}
|
255
|
}
|
|
256
|
}
|
256
|
}
|
|
257
|
}
|
257
|
}
|