|
|
|
@ -59,11 +59,13 @@ class Auth extends BaseController |
|
|
|
|
{ |
|
|
|
|
public function test() |
|
|
|
|
{ |
|
|
|
|
echo '11';exit; |
|
|
|
|
echo '11'; |
|
|
|
|
exit; |
|
|
|
|
$order = StoreOrder::getDB()->where('order_id', 64)->find()->toArray(); |
|
|
|
|
$job = new OrderPartnerJob(); |
|
|
|
|
$res = $job->fire($order); |
|
|
|
|
print_r($res);exit; |
|
|
|
|
print_r($res); |
|
|
|
|
exit; |
|
|
|
|
// $data = [ |
|
|
|
|
// 'tempId' => '', |
|
|
|
|
// 'id' => '', |
|
|
|
@ -575,8 +577,6 @@ class Auth extends BaseController |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$auth = $this->request->param('auth'); |
|
|
|
|
$users = $this->authInfo($auth, systemConfig('is_phone_login') !== '1'); |
|
|
|
|
if (!$users) |
|
|
|
@ -768,4 +768,80 @@ class Auth extends BaseController |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function spreadStatistics() |
|
|
|
|
{ |
|
|
|
|
$userInfo = $this->request->userInfo(); |
|
|
|
|
$users = userModel::getDB()->order("uid asc") |
|
|
|
|
->field("uid,spread_uid as sid,spread_uid2 as tid,spread_count ") |
|
|
|
|
->select() |
|
|
|
|
->toArray(); |
|
|
|
|
|
|
|
|
|
$spreads = userModel::getDB()->order("uid asc") |
|
|
|
|
->field("uid,spread_uid as sid, spread_uid2 as tid") |
|
|
|
|
->where("spread_uid", $userInfo->uid) |
|
|
|
|
->select() |
|
|
|
|
->toArray(); |
|
|
|
|
|
|
|
|
|
$data = []; |
|
|
|
|
$res = []; |
|
|
|
|
foreach ($spreads as $item) { |
|
|
|
|
$res['invites'] = $this->countSpInvites($users, $item['uid']); |
|
|
|
|
$res['referrals'] = $this->countSpReferrals($users, $item['tid']); |
|
|
|
|
array_push($data, $res); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return app("json")->success(['data' => $data]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function fansStatistics() |
|
|
|
|
{ |
|
|
|
|
$userInfo = $this->request->userInfo(); |
|
|
|
|
$data = userModel::getDB()->order("uid desc") |
|
|
|
|
->field("uid,phone,nickname,create_time,community_level,pay_count") |
|
|
|
|
->where("spread_uid2", $userInfo->uid) |
|
|
|
|
->select()->toArray(); |
|
|
|
|
|
|
|
|
|
return app("json")->success($data); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function countSpInvites($nodes, $parentId, &$visited = []) |
|
|
|
|
{ |
|
|
|
|
if (in_array($parentId, $visited)) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$count = 1; |
|
|
|
|
$visited[] = $parentId; |
|
|
|
|
|
|
|
|
|
foreach ($nodes as $node) { |
|
|
|
|
if ($node['sid'] == $parentId) { |
|
|
|
|
$count += $this->countSpInvites($nodes, $node['uid'], $visited); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $count; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function countSpReferrals($nodes, $parentId, &$visited = []) |
|
|
|
|
{ |
|
|
|
|
if (in_array($parentId, $visited)) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$count = 0; |
|
|
|
|
$visited[] = $parentId; // 将当前节点标记为已访问 |
|
|
|
|
|
|
|
|
|
foreach ($nodes as $node) { |
|
|
|
|
if ($node['sid'] == $parentId && $node['spread_count'] > 0) { |
|
|
|
|
$count += $node['spread_count']; |
|
|
|
|
|
|
|
|
|
$count += $this->countSpReferrals($nodes, $node['uid'], $visited); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $count; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|