exam index seed bonus => seed points

This commit is contained in:
xiaomlove
2022-02-20 21:50:03 +08:00
parent 27c7bd47f8
commit 3a357f1534
7 changed files with 25 additions and 19 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ class Exam extends NexusModel
self::INDEX_UPLOADED => ['name' => 'Uploaded', 'unit' => 'GB', 'source_user_field' => 'uploaded'], self::INDEX_UPLOADED => ['name' => 'Uploaded', 'unit' => 'GB', 'source_user_field' => 'uploaded'],
self::INDEX_SEED_TIME_AVERAGE => ['name' => 'Seed time average', 'unit' => 'Hour', 'source_user_field' => 'seedtime'], self::INDEX_SEED_TIME_AVERAGE => ['name' => 'Seed time average', 'unit' => 'Hour', 'source_user_field' => 'seedtime'],
self::INDEX_DOWNLOADED => ['name' => 'Downloaded', 'unit' => 'GB', 'source_user_field' => 'downloaded'], self::INDEX_DOWNLOADED => ['name' => 'Downloaded', 'unit' => 'GB', 'source_user_field' => 'downloaded'],
self::INDEX_SEED_BONUS => ['name' => 'Seed bonus', 'unit' => '', 'source_user_field' => 'seed_points'], self::INDEX_SEED_BONUS => ['name' => 'Seed points', 'unit' => '', 'source_user_field' => 'seed_points'],
]; ];
const FILTER_USER_CLASS = 'classes'; const FILTER_USER_CLASS = 'classes';
+1 -1
View File
@@ -482,7 +482,7 @@ class ExamRepository extends BaseRepository
$attributes['index'] = $index['index']; $attributes['index'] = $index['index'];
$attributes['created_at'] = $now; $attributes['created_at'] = $now;
$attributes['updated_at'] = $now; $attributes['updated_at'] = $now;
$attributes['value'] = $user->{Exam::$indexes[$index['index']]['source_user_field']}; $attributes['value'] = $user->{Exam::$indexes[$index['index']]['source_user_field']} ?? 0;
do_log("[GET_TOTAL_VALUE]: " . $attributes['value']); do_log("[GET_TOTAL_VALUE]: " . $attributes['value']);
$newVersionProgress = ExamProgress::query() $newVersionProgress = ExamProgress::query()
->where('exam_user_id', $examUser->id) ->where('exam_user_id', $examUser->id)
+9 -3
View File
@@ -5242,7 +5242,6 @@ function get_ip_location_from_geoip($ip)
if (is_null($reader)) { if (is_null($reader)) {
$reader = new \GeoIp2\Database\Reader($database); $reader = new \GeoIp2\Database\Reader($database);
} }
$record = $reader->city($ip);
$lang = get_langfolder_cookie(); $lang = get_langfolder_cookie();
$langMap = [ $langMap = [
'chs' => 'zh-CN', 'chs' => 'zh-CN',
@@ -5250,8 +5249,15 @@ function get_ip_location_from_geoip($ip)
'en' => 'en', 'en' => 'en',
]; ];
$locale = $langMap[$lang] ?? $lang; $locale = $langMap[$lang] ?? $lang;
$countryName = $record->country->names[$locale] ?? $record->country->names['en']; try {
$cityName = $record->city->names[$locale] ?? $record->city->names['en'] ?? ''; $record = $reader->city($ip);
$countryName = $record->country->names[$locale] ?? $record->country->names['en'];
$cityName = $record->city->names[$locale] ?? $record->city->names['en'] ?? '';
} catch (\Exception $exception) {
do_log($exception->getMessage() . "\n" . $exception->getTraceAsString(), 'error');
$countryName = '';
$cityName = '';
}
do_log("ip: $ip, locale: $locale, city: $cityName, country: $countryName"); do_log("ip: $ip, locale: $locale, city: $cityName, country: $countryName");
return [ return [
'name' => sprintf('%s·%s', $cityName, $countryName), 'name' => sprintf('%s·%s', $cityName, $countryName),
+1 -1
View File
@@ -377,7 +377,7 @@ if(get_user_class() >= UC_PEASANT)
{ {
// the number $start_subid is just for legacy support of prevoiusly uploaded subs, if the site is completely new, it should be 0 or just remove it // the number $start_subid is just for legacy support of prevoiusly uploaded subs, if the site is completely new, it should be 0 or just remove it
$lang = "<td class=rowfollow align=center valign=middle>" . "<img border=\"0\" src=\"pic/flag/". $arr["flagpic"] . "\" alt=\"" . $arr["lang_name"] . "\" title=\"" . $arr["lang_name"] . "\"/>" . "</td>\n"; $lang = "<td class=rowfollow align=center valign=middle>" . "<img border=\"0\" src=\"pic/flag/". $arr["flagpic"] . "\" alt=\"" . $arr["lang_name"] . "\" title=\"" . $arr["lang_name"] . "\"/>" . "</td>\n";
$title = "<td class=rowfollow align=left><a href=\"" . ($arr['id'] <= $start_subid ? "downloadsubs_legacy.php/" . $arr['filename'] : "downloadsubs.php?torrentid=" . $arr['torrent_id'] ."&subid=" .$arr['id']) . "\"<b>" . htmlspecialchars($arr["title"]) . "</b></a>" . $title = "<td class=rowfollow align=left><a href=\"" . (isset($start_subid) && $arr['id'] <= $start_subid ? "downloadsubs_legacy.php/" . $arr['filename'] : "downloadsubs.php?torrentid=" . $arr['torrent_id'] ."&subid=" .$arr['id']) . "\"<b>" . htmlspecialchars($arr["title"]) . "</b></a>" .
($mod || ($pu && $arr["uppedby"] == $CURUSER["id"]) ? " <font class=small><a href=?delete=$arr[id]>".$lang_subtitles['text_delete']."</a></font>" : "") ."</td>\n"; ($mod || ($pu && $arr["uppedby"] == $CURUSER["id"]) ? " <font class=small><a href=?delete=$arr[id]>".$lang_subtitles['text_delete']."</a></font>" : "") ."</td>\n";
$addtime = gettime($arr["added"],false,false); $addtime = gettime($arr["added"],false,false);
$added = "<td class=rowfollow align=center><nobr>" . $addtime . "</nobr></td>\n"; $added = "<td class=rowfollow align=center><nobr>" . $addtime . "</nobr></td>\n";
+1 -1
View File
@@ -7,7 +7,7 @@ return [
'index_text_' . \App\Models\Exam::INDEX_UPLOADED => 'Uploaded', 'index_text_' . \App\Models\Exam::INDEX_UPLOADED => 'Uploaded',
'index_text_' . \App\Models\Exam::INDEX_SEED_TIME_AVERAGE => 'Seed time average', 'index_text_' . \App\Models\Exam::INDEX_SEED_TIME_AVERAGE => 'Seed time average',
'index_text_' . \App\Models\Exam::INDEX_DOWNLOADED => 'Downloaded', 'index_text_' . \App\Models\Exam::INDEX_DOWNLOADED => 'Downloaded',
'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => 'Seed bonus', 'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => 'Seed points',
'require_value' => 'Require', 'require_value' => 'Require',
'current_value' => 'Current', 'current_value' => 'Current',
'result' => 'Result', 'result' => 'Result',
+1 -1
View File
@@ -7,7 +7,7 @@ return [
'index_text_' . \App\Models\Exam::INDEX_UPLOADED => '上传量', 'index_text_' . \App\Models\Exam::INDEX_UPLOADED => '上传量',
'index_text_' . \App\Models\Exam::INDEX_SEED_TIME_AVERAGE => '平均做种时间', 'index_text_' . \App\Models\Exam::INDEX_SEED_TIME_AVERAGE => '平均做种时间',
'index_text_' . \App\Models\Exam::INDEX_DOWNLOADED => '下载量', 'index_text_' . \App\Models\Exam::INDEX_DOWNLOADED => '下载量',
'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => '做种魔力', 'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => '做种积分',
'require_value' => '要求', 'require_value' => '要求',
'current_value' => '当前', 'current_value' => '当前',
'result' => '结果', 'result' => '结果',
+1 -1
View File
@@ -7,7 +7,7 @@ return [
'index_text_' . \App\Models\Exam::INDEX_UPLOADED => '上傳量', 'index_text_' . \App\Models\Exam::INDEX_UPLOADED => '上傳量',
'index_text_' . \App\Models\Exam::INDEX_SEED_TIME_AVERAGE => '平均做種時間', 'index_text_' . \App\Models\Exam::INDEX_SEED_TIME_AVERAGE => '平均做種時間',
'index_text_' . \App\Models\Exam::INDEX_DOWNLOADED => '下載量', 'index_text_' . \App\Models\Exam::INDEX_DOWNLOADED => '下載量',
'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => '做種魔力', 'index_text_' . \App\Models\Exam::INDEX_SEED_BONUS => '做種積分',
'require_value' => '要求', 'require_value' => '要求',
'current_value' => '當前', 'current_value' => '當前',
'result' => '結果', 'result' => '結果',