新增品宣判断

main
limu 9 months ago
parent ad84b6e930
commit ebea857792
  1. 6
      app/controller/api/Auth.php
  2. 11
      app/controller/api/user/User.php

@ -775,6 +775,7 @@ class Auth extends BaseController
$userInfo = $this->request->userInfo(); $userInfo = $this->request->userInfo();
$users = userModel::getDB()->order("uid asc") $users = userModel::getDB()->order("uid asc")
->field("uid,spread_uid as sid,spread_uid2 as tid,spread_count,pay_price") ->field("uid,spread_uid as sid,spread_uid2 as tid,spread_count,pay_price")
->where('uid', '<>', $userInfo->uid)
->select() ->select()
->toArray(); ->toArray();
@ -813,7 +814,7 @@ class Auth extends BaseController
foreach ($data as &$item) { foreach ($data as &$item) {
$item['community_level'] = $level[$item['community_level']] ?? ''; $item['community_level'] = $level[$item['community_level']] ?? '';
$item['invites'] = $this->countSpInvites($users, $item['uid']); $item['invites'] = $this->countSpInvites($users, $item['uid']);
$item['referrals'] = $this->countSpReferrals($users, $item['tid'], 'pay_price'); $item['referrals'] = $this->countSpReferrals($users, $item['uid'], 'pay_price');
if($item['pay_price'] > 0){ if($item['pay_price'] > 0){
$item['referrals'] += 1; $item['referrals'] += 1;
} }
@ -853,6 +854,9 @@ class Auth extends BaseController
$visited[] = $parentId; // 将当前节点标记为已访问 $visited[] = $parentId; // 将当前节点标记为已访问
foreach ($nodes as $node) { foreach ($nodes as $node) {
if($node['uid'] == $parentId && $node[$field] > 0){
$count += 1;
}
if ($node['sid'] == $parentId && $node[$field] > 0) { if ($node['sid'] == $parentId && $node[$field] > 0) {
$count += 1; $count += 1;
$count += $this->countSpReferrals($nodes, $node['uid'], $field, $visited); $count += $this->countSpReferrals($nodes, $node['uid'], $field, $visited);

@ -414,6 +414,17 @@ class User extends BaseController
$end = date('Y-m-d') . ' 23:59:59'; $end = date('Y-m-d') . ' 23:59:59';
if($shareId > 0) { if($shareId > 0) {
//用户每天同type只能邀请10个人 多了就不加了
$count = ValueContributionLog::getDB()
->where('type', $type)
->where('user_id', $shareId)
->where('ctime', '>=', $start)
->where('ctime', '<=', $end)
->count();
if (!empty($count) && $count > 10) {
return app('json')->fail('达到上限');
}
//加100分 //加100分
$userModel = userModel::getDB()->where('uid',$shareId)->find(); $userModel = userModel::getDB()->where('uid',$shareId)->find();
if ($userModel) { if ($userModel) {

Loading…
Cancel
Save