mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-20 07:03:00 +08:00
修正SiteVisit积分问题
This commit is contained in:
parent
fec1171d6b
commit
a37c88359a
@ -6,7 +6,7 @@
|
|||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<table class="layui-table">
|
<table class="layui-table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="100">
|
<col width="25%">
|
||||||
<col>
|
<col>
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<div class="layui-card layui-text" xmlns="http://www.w3.org/1999/html">
|
<div class="layui-card layui-text">
|
||||||
<div class="layui-card-header">服务器信息</div>
|
<div class="layui-card-header">服务器信息</div>
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<table class="layui-table">
|
<table class="layui-table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="100">
|
<col width="25%">
|
||||||
<col>
|
<col>
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<table class="layui-table">
|
<table class="layui-table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="100">
|
<col width="25%">
|
||||||
<col>
|
<col>
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -20,7 +20,7 @@ class PointHistory extends Model
|
|||||||
const EVENT_SITE_VISIT = 5; // 站点访问
|
const EVENT_SITE_VISIT = 5; // 站点访问
|
||||||
const EVENT_CHAPTER_STUDY = 6; // 课时学习
|
const EVENT_CHAPTER_STUDY = 6; // 课时学习
|
||||||
const EVENT_COURSE_REVIEW = 7; // 课程评价
|
const EVENT_COURSE_REVIEW = 7; // 课程评价
|
||||||
const EVENT_IM_DISCUSS = 8; // 微聊讨论
|
const EVENT_IM_DISCUSS = 8; // 微聊讨论(已弃用)
|
||||||
const EVENT_COMMENT_POST = 9; // 发布评论
|
const EVENT_COMMENT_POST = 9; // 发布评论
|
||||||
const EVENT_ARTICLE_POST = 10; // 发布文章
|
const EVENT_ARTICLE_POST = 10; // 发布文章
|
||||||
const EVENT_QUESTION_POST = 11; // 发布问题
|
const EVENT_QUESTION_POST = 11; // 发布问题
|
||||||
@ -132,7 +132,6 @@ class PointHistory extends Model
|
|||||||
self::EVENT_SITE_VISIT => '用户登录',
|
self::EVENT_SITE_VISIT => '用户登录',
|
||||||
self::EVENT_CHAPTER_STUDY => '课时学习',
|
self::EVENT_CHAPTER_STUDY => '课时学习',
|
||||||
self::EVENT_COURSE_REVIEW => '课程评价',
|
self::EVENT_COURSE_REVIEW => '课程评价',
|
||||||
self::EVENT_IM_DISCUSS => '微聊讨论',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
|
||||||
* @license https://opensource.org/licenses/GPL-2.0
|
|
||||||
* @link https://www.koogua.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Services\Logic\Point\History;
|
|
||||||
|
|
||||||
use App\Models\ImMessage as ImMessageModel;
|
|
||||||
use App\Models\PointHistory as PointHistoryModel;
|
|
||||||
use App\Repos\PointHistory as PointHistoryRepo;
|
|
||||||
use App\Repos\User as UserRepo;
|
|
||||||
use App\Services\Logic\Point\PointHistory;
|
|
||||||
|
|
||||||
class ImDiscuss extends PointHistory
|
|
||||||
{
|
|
||||||
|
|
||||||
public function handle(ImMessageModel $message)
|
|
||||||
{
|
|
||||||
$setting = $this->getSettings('point');
|
|
||||||
|
|
||||||
$pointEnabled = $setting['enabled'] ?? 0;
|
|
||||||
|
|
||||||
if ($pointEnabled == 0) return;
|
|
||||||
|
|
||||||
$eventRule = json_decode($setting['event_rule'], true);
|
|
||||||
|
|
||||||
$eventEnabled = $eventRule['im_discuss']['enabled'] ?? 0;
|
|
||||||
|
|
||||||
if ($eventEnabled == 0) return;
|
|
||||||
|
|
||||||
$eventPoint = $eventRule['im_discuss']['point'] ?? 0;
|
|
||||||
|
|
||||||
if ($eventPoint <= 0) return;
|
|
||||||
|
|
||||||
$eventId = $message->sender_id;
|
|
||||||
$eventType = PointHistoryModel::EVENT_IM_DISCUSS;
|
|
||||||
$eventInfo = new \stdClass();
|
|
||||||
|
|
||||||
$historyRepo = new PointHistoryRepo();
|
|
||||||
|
|
||||||
$history = $historyRepo->findDailyEventHistory($eventId, $eventType, date('Ymd'));
|
|
||||||
|
|
||||||
if ($history) return;
|
|
||||||
|
|
||||||
$userRepo = new UserRepo();
|
|
||||||
|
|
||||||
$user = $userRepo->findById($message->sender_id);
|
|
||||||
|
|
||||||
$history = new PointHistoryModel();
|
|
||||||
|
|
||||||
$history->user_id = $user->id;
|
|
||||||
$history->user_name = $user->name;
|
|
||||||
$history->event_id = $eventId;
|
|
||||||
$history->event_type = $eventType;
|
|
||||||
$history->event_info = $eventInfo;
|
|
||||||
$history->event_point = $eventPoint;
|
|
||||||
|
|
||||||
$this->handlePointHistory($history);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -35,7 +35,7 @@ class SiteVisit extends PointHistory
|
|||||||
|
|
||||||
$eventId = $user->id;
|
$eventId = $user->id;
|
||||||
$eventType = PointHistoryModel::EVENT_SITE_VISIT;
|
$eventType = PointHistoryModel::EVENT_SITE_VISIT;
|
||||||
$eventInfo = new \stdClass();
|
$eventInfo = [];
|
||||||
|
|
||||||
$historyRepo = new PointHistoryRepo();
|
$historyRepo = new PointHistoryRepo();
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ abstract class ErrorHandler extends Injectable
|
|||||||
{
|
{
|
||||||
$error = error_get_last();
|
$error = error_get_last();
|
||||||
|
|
||||||
if ($error !== NULL && in_array($error['type'], [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR])) {
|
if ($error !== null && in_array($error['type'], [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR])) {
|
||||||
|
|
||||||
$logger = $this->getLogger();
|
$logger = $this->getLogger();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user