|
@@ -14,6 +14,7 @@ namespace App\Services\Api;
|
|
|
use App\Helpers\Jwt;
|
|
use App\Helpers\Jwt;
|
|
|
use App\Models\AccountLogModel;
|
|
use App\Models\AccountLogModel;
|
|
|
use App\Models\BalanceLogModel;
|
|
use App\Models\BalanceLogModel;
|
|
|
|
|
+use App\Models\DeveloperModel;
|
|
|
use App\Models\MemberLevelModel;
|
|
use App\Models\MemberLevelModel;
|
|
|
use App\Models\MemberModel;
|
|
use App\Models\MemberModel;
|
|
|
use App\Services\BaseService;
|
|
use App\Services\BaseService;
|
|
@@ -367,7 +368,7 @@ class MemberService extends BaseService
|
|
|
$maxBonusRate = $this->getUpBonusRate($uid, $parentIds);
|
|
$maxBonusRate = $this->getUpBonusRate($uid, $parentIds);
|
|
|
if ($maxBonusRate > 0 && $bonusRate > $maxBonusRate) {
|
|
if ($maxBonusRate > 0 && $bonusRate > $maxBonusRate) {
|
|
|
$this->errorData = ['rate' => $maxBonusRate];
|
|
$this->errorData = ['rate' => $maxBonusRate];
|
|
|
- $this->error = 1043;
|
|
|
|
|
|
|
+ $this->error = 2036;
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -422,6 +423,41 @@ class MemberService extends BaseService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 获取上级团队设置的最近的工作室分红比例
|
|
|
|
|
+ * @param $userId
|
|
|
|
|
+ * @param $parentIds
|
|
|
|
|
+ * @return false|int|mixed
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getUpRoomBonusRate($userId, $parentIds)
|
|
|
|
|
+ {
|
|
|
|
|
+ $cacheKey = "caches:member:upRoomRate_{$userId}";
|
|
|
|
|
+ $data = RedisService::get($cacheKey);
|
|
|
|
|
+ if ($data) {
|
|
|
|
|
+ return isset($data['bonus_rate']) ? $data['bonus_rate'] : 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $parentIds = $parentIds ? explode(',', $parentIds) : [];
|
|
|
|
|
+ $parentIds = array_filter($parentIds);
|
|
|
|
|
+ krsort($parentIds);
|
|
|
|
|
+ if (empty($parentIds) || !is_array($parentIds)) {
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $data = $this->model->whereIn('id', $parentIds)
|
|
|
|
|
+ ->where('room_bonus_rate', '>', 0)
|
|
|
|
|
+ ->where(['mark' => 1])
|
|
|
|
|
+ ->select(['id', 'room_bonus_rate'])
|
|
|
|
|
+ ->orderByRaw('FIELD(id, "' . implode(',', $parentIds) . '")')
|
|
|
|
|
+ ->first();
|
|
|
|
|
+ $data = $data ? $data->toArray() : [];
|
|
|
|
|
+ if ($data) {
|
|
|
|
|
+ RedisService::set($cacheKey, $data, rand(3, 5));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return isset($data['room_bonus_rate']) ? $data['room_bonus_rate'] : 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 设置自动质押状态
|
|
* 设置自动质押状态
|
|
|
* @param int $userId 用户ID
|
|
* @param int $userId 用户ID
|
|
|
* @param array $params 参数,status-状态(1-开启,0-关闭,必选)
|
|
* @param array $params 参数,status-状态(1-开启,0-关闭,必选)
|
|
@@ -1073,4 +1109,27 @@ class MemberService extends BaseService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 有效开发者列表
|
|
|
|
|
+ * @return array|mixed
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getDeveloperList()
|
|
|
|
|
+ {
|
|
|
|
|
+ $cacheKey = "caches:developer:list";
|
|
|
|
|
+ $datas = RedisService::get($cacheKey);
|
|
|
|
|
+ if($datas){
|
|
|
|
|
+ return $datas;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $datas = DeveloperModel::where(['status'=>1])
|
|
|
|
|
+ ->where('last_settle_at','<',date('Y-m-d', time() - 7 * 86400))
|
|
|
|
|
+ ->limit(200)
|
|
|
|
|
+ ->get();
|
|
|
|
|
+ $datas = $datas? $datas->toArray() : [];
|
|
|
|
|
+ if($datas){
|
|
|
|
|
+ RedisService::set($cacheKey, $datas, rand(3600, 7200));
|
|
|
|
|
+ }
|
|
|
|
|
+ return $datas;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|