limu 9 months ago
parent f563d159df
commit 4428c6f3ee
  1. 18
      app/controller/api/Auth.php

@ -382,12 +382,16 @@ class Auth extends BaseController
if (!$sms_code) return app('json')->fail('验证码不正确'); if (!$sms_code) return app('json')->fail('验证码不正确');
$user = $repository->accountByUser($data['phone']); $user = $repository->accountByUser($data['phone']);
$auth = $this->parseAuthToken($data['auth_token']); $auth = $this->parseAuthToken($data['auth_token']);
if (!$user) $user = $repository->registr($data['phone'], null, $data['user_type']); $is_new = false;
if (!$user) {
$is_new = 1;
$user = $repository->registr($data['phone'], null, $data['user_type']);
}
if ($auth && !$user['wechat_user_id']) { if ($auth && !$user['wechat_user_id']) {
$repository->syncBaseAuth($auth, $user); $repository->syncBaseAuth($auth, $user);
} }
$user = $repository->mainUser($user); $user = $repository->mainUser($user);
$repository->bindSpread($user, intval($data['spread']), 1); $repository->bindSpread($user, intval($data['spread']), $is_new);
$tokenInfo = $repository->createToken($user); $tokenInfo = $repository->createToken($user);
$repository->loginAfter($user); $repository->loginAfter($user);
@ -854,11 +858,15 @@ class Auth extends BaseController
$visited[] = $parentId; // 将当前节点标记为已访问 $visited[] = $parentId; // 将当前节点标记为已访问
foreach ($nodes as $node) { foreach ($nodes as $node) {
if($node['uid'] == $parentId && $node[$field] > 0){ // if($node['uid'] == $parentId && $node['pay_price'] > 0){
// file_put_contents("/tmp/fensi",$node['uid'].PHP_EOL,8);
// $count += 1;
// }
if ($node['sid'] == $parentId) {
if ($node['pay_price'] > 0) {
file_put_contents("/tmp/fensi", $node['uid'], 8);
$count += 1; $count += 1;
} }
if ($node['sid'] == $parentId && $node[$field] > 0) {
$count += 1;
$count += $this->countSpReferrals($nodes, $node['uid'], $field, $visited); $count += $this->countSpReferrals($nodes, $node['uid'], $field, $visited);
} }
} }

Loading…
Cancel
Save