mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
add task
This commit is contained in:
@@ -36,6 +36,8 @@ class BonusLogs extends NexusModel
|
|||||||
const BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD = 17;
|
const BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD = 17;
|
||||||
const BUSINESS_TYPE_GIFT_MEDAL = 18;
|
const BUSINESS_TYPE_GIFT_MEDAL = 18;
|
||||||
const BUSINESS_TYPE_BUY_TORRENT = 19;
|
const BUSINESS_TYPE_BUY_TORRENT = 19;
|
||||||
|
const BUSINESS_TYPE_TASK_NOT_PASS_DEDUCT = 20;
|
||||||
|
const BUSINESS_TYPE_TASK_PASS_REWARD = 21;
|
||||||
|
|
||||||
const BUSINESS_TYPE_ROLE_WORK_SALARY = 1000;
|
const BUSINESS_TYPE_ROLE_WORK_SALARY = 1000;
|
||||||
const BUSINESS_TYPE_TORRENT_BE_DOWNLOADED = 1001;
|
const BUSINESS_TYPE_TORRENT_BE_DOWNLOADED = 1001;
|
||||||
|
|||||||
@@ -254,4 +254,32 @@ class Exam extends NexusModel
|
|||||||
throw new \RuntimeException("Invalid recurring: $recurring");
|
throw new \RuntimeException("Invalid recurring: $recurring");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMessageSubjectTransKey(string $result): string
|
||||||
|
{
|
||||||
|
return match ($this->type) {
|
||||||
|
self::TYPE_EXAM => "exam.checkout_{$result}_message_subject_for_exam",
|
||||||
|
self::TYPE_TASK => "exam.checkout_{$result}_message_subject_for_task",
|
||||||
|
default => throw new \RuntimeException("Invalid type: " . $this->type)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMessageContentTransKey(string $result): string
|
||||||
|
{
|
||||||
|
return match ($this->type) {
|
||||||
|
self::TYPE_EXAM => "exam.checkout_{$result}_message_content_for_exam",
|
||||||
|
self::TYPE_TASK => "exam.checkout_{$result}_message_content_for_task",
|
||||||
|
default => throw new \RuntimeException("Invalid type: " . $this->type)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isTypeExam(): bool
|
||||||
|
{
|
||||||
|
return $this->type == self::TYPE_EXAM;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isTypeTask(): bool
|
||||||
|
{
|
||||||
|
return $this->type == self::TYPE_TASK;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -514,6 +514,11 @@ class User extends Authenticatable implements FilamentUser, HasName
|
|||||||
return $this->hasMany(UserPermission::class, 'uid');
|
return $this->hasMany(UserPermission::class, 'uid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function examAndTasks(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Exam::class, "exam_users", "uid", "exam_id");
|
||||||
|
}
|
||||||
|
|
||||||
public function getAvatarAttribute($value)
|
public function getAvatarAttribute($value)
|
||||||
{
|
{
|
||||||
if ($value) {
|
if ($value) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Exceptions\NexusException;
|
use App\Exceptions\NexusException;
|
||||||
|
use App\Models\BonusLogs;
|
||||||
use App\Models\Exam;
|
use App\Models\Exam;
|
||||||
use App\Models\ExamProgress;
|
use App\Models\ExamProgress;
|
||||||
use App\Models\ExamUser;
|
use App\Models\ExamUser;
|
||||||
@@ -1100,11 +1101,13 @@ class ExamRepository extends BaseRepository
|
|||||||
$result += $examUsers->count();
|
$result += $examUsers->count();
|
||||||
$now = Carbon::now()->toDateTimeString();
|
$now = Carbon::now()->toDateTimeString();
|
||||||
$examUserIdArr = $uidToDisable = $messageToSend = $userBanLog = $userModcommentUpdate = [];
|
$examUserIdArr = $uidToDisable = $messageToSend = $userBanLog = $userModcommentUpdate = [];
|
||||||
|
$bonusLog = $userBonusCommentUpdate = $userBonusUpdate = $uidToUpdateBonus = [];
|
||||||
$examUserToInsert = [];
|
$examUserToInsert = [];
|
||||||
foreach ($examUsers as $examUser) {
|
foreach ($examUsers as $examUser) {
|
||||||
$minId = $examUser->id;
|
$minId = $examUser->id;
|
||||||
$examUserIdArr[] = $examUser->id;
|
$examUserIdArr[] = $examUser->id;
|
||||||
$uid = $examUser->uid;
|
$uid = $examUser->uid;
|
||||||
|
clear_inbox_count_cache($uid);
|
||||||
/** @var Exam $exam */
|
/** @var Exam $exam */
|
||||||
$exam = $examUser->exam;
|
$exam = $examUser->exam;
|
||||||
$currentLogPrefix = sprintf("$logPrefix, user: %s, exam: %s, examUser: %s", $uid, $examUser->exam_id, $examUser->id);
|
$currentLogPrefix = sprintf("$logPrefix, user: %s, exam: %s, examUser: %s", $uid, $examUser->exam_id, $examUser->id);
|
||||||
@@ -1119,48 +1122,95 @@ class ExamRepository extends BaseRepository
|
|||||||
$locale = $examUser->user->locale;
|
$locale = $examUser->user->locale;
|
||||||
if ($examUser->is_done) {
|
if ($examUser->is_done) {
|
||||||
do_log("$currentLogPrefix, [is_done]");
|
do_log("$currentLogPrefix, [is_done]");
|
||||||
$subjectTransKey = 'exam.checkout_pass_message_subject';
|
$subjectTransKey = $exam->getMessageSubjectTransKey("pass");
|
||||||
$msgTransKey = 'exam.checkout_pass_message_content';
|
$msgTransKey = $exam->getMessageContentTransKey("pass");
|
||||||
if (!empty($exam->recurring) && $this->isExamMatchUser($exam, $examUser->user)) {
|
if ($exam->isTypeExam()) {
|
||||||
$examUserToInsert[] = [
|
if (!empty($exam->recurring) && $this->isExamMatchUser($exam, $examUser->user)) {
|
||||||
'uid' => $examUser->user->id,
|
$examUserToInsert[] = [
|
||||||
'exam_id' => $exam->id,
|
'uid' => $examUser->user->id,
|
||||||
'begin' => $exam->getBeginForUser(),
|
'exam_id' => $exam->id,
|
||||||
'end' => $exam->getEndForUser(),
|
'begin' => $exam->getBeginForUser(),
|
||||||
'created_at' => $now,
|
'end' => $exam->getEndForUser(),
|
||||||
'updated_at' => $now,
|
'created_at' => $now,
|
||||||
];
|
'updated_at' => $now,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} elseif ($exam->isTypeTask()) {
|
||||||
|
//reward bonus
|
||||||
|
if ($exam->success_reward_bonus > 0) {
|
||||||
|
$uidToUpdateBonus[] = $uid;
|
||||||
|
$bonusLog[] = [
|
||||||
|
"uid" => $uid,
|
||||||
|
"old_total_value" => $examUser->user->seedbonus,
|
||||||
|
"value" => $exam->success_reward_bonus,
|
||||||
|
"new_total_value" => $examUser->user->seedbonus + $exam->success_reward_bonus,
|
||||||
|
"business_type" => BonusLogs::BUSINESS_TYPE_TASK_PASS_REWARD,
|
||||||
|
];
|
||||||
|
$userBonusComment = nexus_trans("exam.reward_bonus_comment", [
|
||||||
|
'exam_name' => $exam->name,
|
||||||
|
'begin' => $examUser->begin,
|
||||||
|
'end' => $examUser->end,
|
||||||
|
'success_reward_bonus' => $exam->success_reward_bonus,
|
||||||
|
], $locale);
|
||||||
|
$userBonusCommentUpdate[] = sprintf("when `id` = %s then concat_ws('\n', '%s', bonuscomment)", $uid, $userBonusComment);
|
||||||
|
$userBonusUpdate[] = sprintf("when `id` = %s then seedbonus + %d", $uid, $exam->success_reward_bonus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
do_log("$currentLogPrefix, [will be banned]");
|
do_log("$currentLogPrefix, [not_done]");
|
||||||
clear_user_cache($examUser->user->id, $examUser->user->passkey);
|
$subjectTransKey = $exam->getMessageSubjectTransKey("not_pass");
|
||||||
$subjectTransKey = 'exam.checkout_not_pass_message_subject';
|
$msgTransKey = $exam->getMessageContentTransKey("not_pass");
|
||||||
$msgTransKey = 'exam.checkout_not_pass_message_content';
|
if ($exam->isTypeExam()) {
|
||||||
//ban user
|
//ban user
|
||||||
$uidToDisable[] = $uid;
|
do_log("$currentLogPrefix, [will be banned]");
|
||||||
$userModcomment = nexus_trans('exam.ban_user_modcomment', [
|
clear_user_cache($examUser->user->id, $examUser->user->passkey);
|
||||||
'exam_name' => $exam->name,
|
$uidToDisable[] = $uid;
|
||||||
'begin' => $examUser->begin,
|
$userModcomment = nexus_trans('exam.ban_user_modcomment', [
|
||||||
'end' => $examUser->end
|
'exam_name' => $exam->name,
|
||||||
], $locale);
|
'begin' => $examUser->begin,
|
||||||
$userModcomment = sprintf('%s - %s', date('Y-m-d'), $userModcomment);
|
'end' => $examUser->end
|
||||||
$userModcommentUpdate[] = sprintf("when `id` = %s then concat_ws('\n', '%s', modcomment)", $uid, $userModcomment);
|
], $locale);
|
||||||
$banLogReason = nexus_trans('exam.ban_log_reason', [
|
$userModcomment = sprintf('%s - %s', date('Y-m-d'), $userModcomment);
|
||||||
'exam_name' => $exam->name,
|
$userModcommentUpdate[] = sprintf("when `id` = %s then concat_ws('\n', '%s', modcomment)", $uid, $userModcomment);
|
||||||
'begin' => $examUser->begin,
|
$banLogReason = nexus_trans('exam.ban_log_reason', [
|
||||||
'end' => $examUser->end,
|
'exam_name' => $exam->name,
|
||||||
], $locale);
|
'begin' => $examUser->begin,
|
||||||
$userBanLog[] = [
|
'end' => $examUser->end,
|
||||||
'uid' => $uid,
|
], $locale);
|
||||||
'username' => $examUser->user->username,
|
$userBanLog[] = [
|
||||||
'reason' => $banLogReason,
|
'uid' => $uid,
|
||||||
];
|
'username' => $examUser->user->username,
|
||||||
|
'reason' => $banLogReason,
|
||||||
|
];
|
||||||
|
} elseif ($exam->isTypeTask()) {
|
||||||
|
//deduct bonus
|
||||||
|
if ($exam->fail_deduct_bonus > 0) {
|
||||||
|
$uidToUpdateBonus[] = $uid;
|
||||||
|
$bonusLog[] = [
|
||||||
|
"uid" => $uid,
|
||||||
|
"old_total_value" => $examUser->user->seedbonus,
|
||||||
|
"value" => -1*$exam->fail_deduct_bonus,
|
||||||
|
"new_total_value" => $examUser->user->seedbonus - $exam->fail_deduct_bonus,
|
||||||
|
"business_type" => BonusLogs::BUSINESS_TYPE_TASK_NOT_PASS_DEDUCT,
|
||||||
|
];
|
||||||
|
$userBonusComment = nexus_trans("exam.deduct_bonus_comment", [
|
||||||
|
'exam_name' => $exam->name,
|
||||||
|
'begin' => $examUser->begin,
|
||||||
|
'end' => $examUser->end,
|
||||||
|
'fail_deduct_bonus' => $exam->fail_deduct_bonus,
|
||||||
|
], $locale);
|
||||||
|
$userBonusCommentUpdate[] = sprintf("when `id` = %s then concat_ws('\n', '%s', bonuscomment)", $uid, $userBonusComment);
|
||||||
|
$userBonusUpdate[] = sprintf("when `id` = %s then seedbonus - %d", $uid, $exam->fail_deduct_bonus);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$subject = nexus_trans($subjectTransKey, [], $locale);
|
$subject = nexus_trans($subjectTransKey, [], $locale);
|
||||||
$msg = nexus_trans($msgTransKey, [
|
$msg = nexus_trans($msgTransKey, [
|
||||||
'exam_name' => $exam->name,
|
'exam_name' => $exam->name,
|
||||||
'begin' => $examUser->begin,
|
'begin' => $examUser->begin,
|
||||||
'end' => $examUser->end
|
'end' => $examUser->end,
|
||||||
|
'success_reward_bonus' => $exam->success_reward_bonus,
|
||||||
|
'fail_deduct_bonus' => $exam->fail_deduct_bonus,
|
||||||
], $locale);
|
], $locale);
|
||||||
$messageToSend[] = [
|
$messageToSend[] = [
|
||||||
'receiver' => $uid,
|
'receiver' => $uid,
|
||||||
@@ -1169,7 +1219,7 @@ class ExamRepository extends BaseRepository
|
|||||||
'msg' => $msg
|
'msg' => $msg
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
DB::transaction(function () use ($uidToDisable, $messageToSend, $examUserIdArr, $examUserToInsert, $userBanLog, $userModcommentUpdate, $userTable, $logPrefix) {
|
DB::transaction(function () use ($uidToDisable, $messageToSend, $examUserIdArr, $examUserToInsert, $userBanLog, $userModcommentUpdate, $userBonusUpdate, $userBonusCommentUpdate, $bonusLog, $uidToUpdateBonus, $userTable, $logPrefix) {
|
||||||
ExamUser::query()->whereIn('id', $examUserIdArr)->update(['status' => ExamUser::STATUS_FINISHED]);
|
ExamUser::query()->whereIn('id', $examUserIdArr)->update(['status' => ExamUser::STATUS_FINISHED]);
|
||||||
do {
|
do {
|
||||||
$deleted = ExamProgress::query()->whereIn('exam_user_id', $examUserIdArr)->limit(10000)->delete();
|
$deleted = ExamProgress::query()->whereIn('exam_user_id', $examUserIdArr)->limit(10000)->delete();
|
||||||
@@ -1191,6 +1241,18 @@ class ExamRepository extends BaseRepository
|
|||||||
if (!empty($examUserToInsert)) {
|
if (!empty($examUserToInsert)) {
|
||||||
ExamUser::query()->insert($examUserToInsert);
|
ExamUser::query()->insert($examUserToInsert);
|
||||||
}
|
}
|
||||||
|
if (!empty($userBonusUpdate)) {
|
||||||
|
$uidStr = implode(', ', $uidToUpdateBonus);
|
||||||
|
$sql = sprintf(
|
||||||
|
"update %s set seedbonus = case %s, bonuscomment = case %s end where id in (%s)",
|
||||||
|
$userTable, implode(' ', $userBonusUpdate), implode(",", $userBonusCommentUpdate), $uidStr
|
||||||
|
);
|
||||||
|
$updateResult = DB::update($sql);
|
||||||
|
do_log(sprintf("$logPrefix, update %s users: %s seedbonus, sql: %s, updateResult: %s", count($uidToUpdateBonus), $uidStr, $sql, $updateResult));
|
||||||
|
}
|
||||||
|
if (!empty($bonusLog)) {
|
||||||
|
BonusLogs::query()->insert($bonusLog);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -2670,6 +2670,7 @@ else {
|
|||||||
<font class = 'color_bonus'><?php echo $lang_functions['text_bonus'] ?></font>[<a href="mybonus.php"><?php echo $lang_functions['text_use'] ?></a>]: <?php echo number_format($CURUSER['seedbonus'], 1)?>
|
<font class = 'color_bonus'><?php echo $lang_functions['text_bonus'] ?></font>[<a href="mybonus.php"><?php echo $lang_functions['text_use'] ?></a>]: <?php echo number_format($CURUSER['seedbonus'], 1)?>
|
||||||
<?php if($attendance){ printf(' <a href="attendance.php" class="">'.$lang_functions['text_attended'].'</a>', $attendance->points, $CURUSER['attendance_card']); }else{ printf(' <a href="attendance.php" class="faqlink">%s</a>', $lang_functions['text_attendance']);}?>
|
<?php if($attendance){ printf(' <a href="attendance.php" class="">'.$lang_functions['text_attended'].'</a>', $attendance->points, $CURUSER['attendance_card']); }else{ printf(' <a href="attendance.php" class="faqlink">%s</a>', $lang_functions['text_attendance']);}?>
|
||||||
<a href="medal.php">[<?php echo nexus_trans('medal.label')?>]</a>
|
<a href="medal.php">[<?php echo nexus_trans('medal.label')?>]</a>
|
||||||
|
<a href="task.php">[<?php echo nexus_trans('exam.type_task')?>]</a>
|
||||||
<font class = 'color_invite'><?php echo $lang_functions['text_invite'] ?></font>[<a href="invite.php?id=<?php echo $CURUSER['id']?>"><?php echo $lang_functions['text_send'] ?></a>]: <?php echo sprintf('%s(%s)', $CURUSER['invites'], \App\Models\Invite::query()->where('inviter', $CURUSER['id'])->where('invitee', '')->where('expired_at', '>', now())->count())?>
|
<font class = 'color_invite'><?php echo $lang_functions['text_invite'] ?></font>[<a href="invite.php?id=<?php echo $CURUSER['id']?>"><?php echo $lang_functions['text_send'] ?></a>]: <?php echo sprintf('%s(%s)', $CURUSER['invites'], \App\Models\Invite::query()->where('inviter', $CURUSER['id'])->where('invitee', '')->where('expired_at', '>', now())->count())?>
|
||||||
<?php if(get_user_class() >= \App\Models\User::getAccessAdminClassMin()) printf('[<a href="%s" target="_blank">%s</a>]', nexus_env('FILAMENT_PATH', 'nexusphp'), $lang_functions['text_management_system'])?>
|
<?php if(get_user_class() >= \App\Models\User::getAccessAdminClassMin()) printf('[<a href="%s" target="_blank">%s</a>]', nexus_env('FILAMENT_PATH', 'nexusphp'), $lang_functions['text_management_system'])?>
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
+125
@@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
require "../include/bittorrent.php";
|
||||||
|
dbconn();
|
||||||
|
loggedinorreturn();
|
||||||
|
$query = \App\Models\Exam::query()->where('type', \App\Models\Exam::TYPE_TASK)->where("status", \App\Models\Exam::STATUS_ENABLED);
|
||||||
|
$total = (clone $query)->count();
|
||||||
|
$perPage = 20;
|
||||||
|
list($paginationTop, $paginationBottom, $limit, $offset) = pager($perPage, $total, "?");
|
||||||
|
$rows = (clone $query)->offset($offset)->take($perPage)->orderBy('id', 'desc')->get();
|
||||||
|
$title = nexus_trans('exam.type_task');
|
||||||
|
$columnNameLabel = nexus_trans('label.name');
|
||||||
|
$columnIndexLabel = nexus_trans('exam.index');
|
||||||
|
$columnBeginTimeLabel = nexus_trans('label.begin');
|
||||||
|
$columnEndTimeLabel = nexus_trans('label.end');
|
||||||
|
$columnDurationLabel = nexus_trans('label.duration');
|
||||||
|
$columnRecurringLabel = nexus_trans('exam.recurring');
|
||||||
|
$columnTargetUserLabel = nexus_trans('label.exam.filter_formatted');
|
||||||
|
$columnDescLabel = nexus_trans('label.description');
|
||||||
|
$columnSuccessRewardLabel = nexus_trans('exam.success_reward_bonus');
|
||||||
|
$columnFailDeductLabel = nexus_trans('exam.fail_deduct_bonus');
|
||||||
|
$columnDescriptionDeductLabel = nexus_trans('label.description');
|
||||||
|
$columnClaimLabel = nexus_trans('exam.action_claim_task');
|
||||||
|
|
||||||
|
$header = '<h1 style="text-align: center">'.$title.'</h1>';
|
||||||
|
stdhead($title);
|
||||||
|
begin_main_frame();
|
||||||
|
$table = <<<TABLE
|
||||||
|
<table border="1" cellspacing="0" cellpadding="5" width="100%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td class="colhead">$columnNameLabel</td>
|
||||||
|
<td class="colhead">$columnIndexLabel</td>
|
||||||
|
<td class="colhead">$columnBeginTimeLabel</td>
|
||||||
|
<td class="colhead">$columnEndTimeLabel</td>
|
||||||
|
<td class="colhead">$columnTargetUserLabel</td>
|
||||||
|
<td class="colhead">$columnSuccessRewardLabel</td>
|
||||||
|
<td class="colhead">$columnFailDeductLabel</td>
|
||||||
|
<td class="colhead">$columnDescriptionDeductLabel</td>
|
||||||
|
<td class="colhead">$columnClaimLabel</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
TABLE;
|
||||||
|
$now = now();
|
||||||
|
$table .= '<tbody>';
|
||||||
|
$userInfo = \App\Models\User::query()->findOrFail($CURUSER['id'], \App\Models\User::$commonFields);
|
||||||
|
$userTasks = $userInfo->examAndTasks()->where("type", \App\Models\Exam::TYPE_TASK)
|
||||||
|
->orderBy('id', 'desc')
|
||||||
|
->get()
|
||||||
|
->keyBy('id')
|
||||||
|
;
|
||||||
|
//dd($userTasks);
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$claimDisabled = $claimClass = '';
|
||||||
|
$claimBtnText = "认领";
|
||||||
|
if ($userTasks->has($row->id)) {
|
||||||
|
$claimDisabled = " disabled";
|
||||||
|
$claimBtnText = "已认领";
|
||||||
|
}
|
||||||
|
$claimAction = sprintf(
|
||||||
|
'<input type="button" class="%s" data-id="%s" value="%s"%s>',
|
||||||
|
$claimClass, $row->id, $claimBtnText, $claimDisabled
|
||||||
|
);
|
||||||
|
$columns = [];
|
||||||
|
$columns[] = sprintf('<td><strong>%s</strong></td>', $row->name);
|
||||||
|
$columns[] = sprintf('<td>%s</td>', $row->indexFormatted);
|
||||||
|
$columns[] = sprintf('<td>%s</td>', $row->getBeginForUser());
|
||||||
|
$columns[] = sprintf('<td>%s</td>', $row->getEndForUser());
|
||||||
|
$columns[] = sprintf('<td>%s</td>', $row->filterFormatted);
|
||||||
|
$columns[] = sprintf('<td>%s</td>', number_format($row->success_reward_bonus));
|
||||||
|
$columns[] = sprintf('<td>%s</td>', number_format($row->fail_deduct_bonus));
|
||||||
|
$columns[] = sprintf('<td>%s</td>', $row->description);
|
||||||
|
$columns[] = sprintf('<td>%s</td>', $claimAction);
|
||||||
|
$table .= sprintf('<tr>%s</tr>', implode("", $columns));
|
||||||
|
}
|
||||||
|
$table .= '</tbody></table>';
|
||||||
|
echo $header . $table . $paginationBottom;
|
||||||
|
end_main_frame();
|
||||||
|
$confirmBuyMsg = nexus_trans('medal.confirm_to_buy');
|
||||||
|
$confirmGiftMsg = nexus_trans('medal.confirm_to_gift');
|
||||||
|
$js = <<<JS
|
||||||
|
jQuery('.buy').on('click', function (e) {
|
||||||
|
let medalId = jQuery(this).attr('data-id')
|
||||||
|
layer.confirm("{$confirmBuyMsg}", function (index) {
|
||||||
|
let params = {
|
||||||
|
action: "buyMedal",
|
||||||
|
params: {medal_id: medalId}
|
||||||
|
}
|
||||||
|
console.log(params)
|
||||||
|
jQuery.post('ajax.php', params, function(response) {
|
||||||
|
console.log(response)
|
||||||
|
if (response.ret != 0) {
|
||||||
|
layer.alert(response.msg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.location.reload()
|
||||||
|
}, 'json')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
jQuery('.gift').on('click', function (e) {
|
||||||
|
let medalId = jQuery(this).attr('data-id')
|
||||||
|
let uid = jQuery(this).prev().val()
|
||||||
|
if (!uid) {
|
||||||
|
layer.alert('Require UID')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
layer.confirm("{$confirmGiftMsg}" + uid + " ?", function (index) {
|
||||||
|
let params = {
|
||||||
|
action: "giftMedal",
|
||||||
|
params: {medal_id: medalId, uid: uid}
|
||||||
|
}
|
||||||
|
console.log(params)
|
||||||
|
jQuery.post('ajax.php', params, function(response) {
|
||||||
|
console.log(response)
|
||||||
|
if (response.ret != 0) {
|
||||||
|
layer.alert(response.msg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.location.reload()
|
||||||
|
}, 'json')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
JS;
|
||||||
|
\Nexus\Nexus::js($js, 'footer', false);
|
||||||
|
stdfoot();
|
||||||
|
|
||||||
@@ -21,6 +21,8 @@ return [
|
|||||||
\App\Models\BonusLogs::BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD => '购买改名卡',
|
\App\Models\BonusLogs::BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD => '购买改名卡',
|
||||||
\App\Models\BonusLogs::BUSINESS_TYPE_GIFT_MEDAL => '赠送勋章',
|
\App\Models\BonusLogs::BUSINESS_TYPE_GIFT_MEDAL => '赠送勋章',
|
||||||
\App\Models\BonusLogs::BUSINESS_TYPE_BUY_TORRENT => '购买种子',
|
\App\Models\BonusLogs::BUSINESS_TYPE_BUY_TORRENT => '购买种子',
|
||||||
|
\App\Models\BonusLogs::BUSINESS_TYPE_TASK_PASS_REWARD => '任务完成奖励',
|
||||||
|
\App\Models\BonusLogs::BUSINESS_TYPE_TASK_NOT_PASS_DEDUCT => '任务未完成扣除',
|
||||||
|
|
||||||
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作组工资',
|
\App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作组工资',
|
||||||
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => '种子被下载',
|
\App\Models\BonusLogs::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => '种子被下载',
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'label' => '考核',
|
'label' => '考核',
|
||||||
'name' => '考核名称',
|
'name' => '名称',
|
||||||
'index' => '考核指标',
|
'index' => '指标',
|
||||||
'time_range' => '考核时间',
|
'time_range' => '时间',
|
||||||
'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 => '下载增量',
|
||||||
@@ -20,14 +20,25 @@ return [
|
|||||||
'require_value' => '要求',
|
'require_value' => '要求',
|
||||||
'current_value' => '当前',
|
'current_value' => '当前',
|
||||||
'result' => '结果',
|
'result' => '结果',
|
||||||
'result_pass' => '通过!',
|
'result_pass_for_exam' => '通过!',
|
||||||
'result_not_pass' => '<span style="color: red">未通过!</span>',
|
'result_pass_for_task' => '完成!',
|
||||||
'checkout_pass_message_subject' => '考核通过!',
|
'result_not_pass_for_exam' => '<span style="color: red">未通过!</span>',
|
||||||
'checkout_pass_message_content' => '恭喜!你在规定时间内(:begin ~ :end)顺利完成了考核::exam_name。',
|
'result_not_pass_for_task' => '<span style="color: red">未完成!</span>',
|
||||||
'checkout_not_pass_message_subject' => '考核未通过,账号被禁用!',
|
'checkout_pass_message_subject_for_exam' => '考核通过!',
|
||||||
'checkout_not_pass_message_content' => '你在规定时间内(:begin ~ :end)未完成考核::exam_name,账号已被禁用。',
|
'checkout_pass_message_content_for_exam' => '恭喜!你在规定时间内(:begin ~ :end)顺利完成了考核::exam_name。',
|
||||||
|
'checkout_not_pass_message_subject_for_exam' => '考核未通过,账号被禁用!',
|
||||||
|
'checkout_not_pass_message_content_for_exam' => '你在规定时间内(:begin ~ :end)未完成考核::exam_name,账号已被禁用。',
|
||||||
|
|
||||||
|
'checkout_pass_message_subject_for_task' => '任务完成!',
|
||||||
|
'checkout_pass_message_content_for_task' => '恭喜!你在规定时间内(:begin ~ :end)顺利完成了任务::exam_name,获得奖励魔力::success_reward_bonus',
|
||||||
|
'checkout_not_pass_message_subject_for_task' => '任务未完成!',
|
||||||
|
'checkout_not_pass_message_content_for_task' => '你在规定时间内(:begin ~ :end)未完成任务::exam_name,扣除魔力::fail_deduct_bonus。',
|
||||||
|
|
||||||
'ban_log_reason' => '未完成考核::exam_name(:begin ~ :end)',
|
'ban_log_reason' => '未完成考核::exam_name(:begin ~ :end)',
|
||||||
'ban_user_modcomment' => '未完成考核: :exam_name(:begin ~ :end), 被系统禁用.',
|
'ban_user_modcomment' => '未完成考核: :exam_name(:begin ~ :end), 被系统禁用.',
|
||||||
|
'deduct_bonus_comment' => '未完成任务: :exam_name(:begin ~ :end), 扣除魔力::fail_deduct_bonus.',
|
||||||
|
'reward_bonus_comment' => '完成任务: :exam_name(:begin ~ :end), 奖励魔力::success_reward_bonus.',
|
||||||
|
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'list' => [
|
'list' => [
|
||||||
'page_title' => '考核列表'
|
'page_title' => '考核列表'
|
||||||
@@ -49,4 +60,6 @@ return [
|
|||||||
'fail_deduct_bonus' => '任务失败扣除魔力',
|
'fail_deduct_bonus' => '任务失败扣除魔力',
|
||||||
'success_reward_bonus' => '任务完成奖励魔力',
|
'success_reward_bonus' => '任务完成奖励魔力',
|
||||||
|
|
||||||
|
'action_claim_task' => '领取',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user