初始化本地仓库
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: http://www.madong.tech
|
||||
*/
|
||||
|
||||
namespace app\adminapi\event;
|
||||
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* 登录日志事件
|
||||
*/
|
||||
class LoginLogEvent
|
||||
{
|
||||
/**
|
||||
* 操作名称
|
||||
*/
|
||||
public string $name;
|
||||
|
||||
/**
|
||||
* 应用名称
|
||||
*/
|
||||
public string $app;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
public string $ip;
|
||||
|
||||
/**
|
||||
* IP归属地
|
||||
*/
|
||||
public string $ipLocation;
|
||||
|
||||
/**
|
||||
* 浏览器
|
||||
*/
|
||||
public string $browser;
|
||||
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
public string $os;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
public int $status;
|
||||
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
public string $message;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
public string $userName;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
public string|null|int $userId;
|
||||
|
||||
/**
|
||||
* 登录时间
|
||||
*/
|
||||
public int $loginTime;
|
||||
|
||||
/**
|
||||
* 访问令牌
|
||||
*/
|
||||
public string $accessToken;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
public int $expiresAt;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct(
|
||||
string $name,
|
||||
string $app,
|
||||
string $ip,
|
||||
string $ipLocation,
|
||||
string $browser,
|
||||
string $os,
|
||||
int $status,
|
||||
string $message,
|
||||
string $userName,
|
||||
string|null|int $userId,
|
||||
int $loginTime,
|
||||
string $accessToken,
|
||||
int $expiresAt
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->app = $app;
|
||||
$this->ip = $ip;
|
||||
$this->ipLocation = $ipLocation;
|
||||
$this->browser = $browser;
|
||||
$this->os = $os;
|
||||
$this->status = $status;
|
||||
$this->message = $message;
|
||||
$this->userName = $userName;
|
||||
$this->userId = $userId;
|
||||
$this->loginTime = $loginTime;
|
||||
$this->accessToken = $accessToken;
|
||||
$this->expiresAt = $expiresAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发事件
|
||||
*/
|
||||
public function dispatch(): void
|
||||
{
|
||||
Event::emit('adminapi.login.log', $this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: http://www.madong.tech
|
||||
*/
|
||||
|
||||
namespace app\adminapi\event;
|
||||
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* 会员等级更新事件
|
||||
*
|
||||
* 用于处理会员等级变动的场景:
|
||||
* - 积分增加导致等级提升
|
||||
* - 积分扣减导致等级下降
|
||||
* - 手动调整会员等级
|
||||
*/
|
||||
class MemberLevelUpdatedEvent
|
||||
{
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
public int|string $memberId;
|
||||
|
||||
/**
|
||||
* 变动前等级ID
|
||||
*/
|
||||
public int|string|null $oldLevelId;
|
||||
|
||||
/**
|
||||
* 变动后等级ID
|
||||
*/
|
||||
public int|string|null $newLevelId;
|
||||
|
||||
/**
|
||||
* 变动前等级名称
|
||||
*/
|
||||
public ?string $oldLevelName;
|
||||
|
||||
/**
|
||||
* 变动后等级名称
|
||||
*/
|
||||
public ?string $newLevelName;
|
||||
|
||||
/**
|
||||
* 触发原因(points_increase=积分增加, points_deducted=积分扣减, admin=后台调整, other=其他)
|
||||
*/
|
||||
public string $reason;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
public string $remark;
|
||||
|
||||
/**
|
||||
* 额外数据(可选,用于存储其他相关信息)
|
||||
*/
|
||||
public ?array $extra;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct(
|
||||
int|string $memberId,
|
||||
int|string|null $oldLevelId,
|
||||
int|string|null $newLevelId,
|
||||
?string $oldLevelName,
|
||||
?string $newLevelName,
|
||||
string $reason,
|
||||
string $remark = '',
|
||||
?array $extra = null
|
||||
) {
|
||||
$this->memberId = $memberId;
|
||||
$this->oldLevelId = $oldLevelId;
|
||||
$this->newLevelId = $newLevelId;
|
||||
$this->oldLevelName = $oldLevelName;
|
||||
$this->newLevelName = $newLevelName;
|
||||
$this->reason = $reason;
|
||||
$this->remark = $remark;
|
||||
$this->extra = $extra;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发事件
|
||||
*/
|
||||
public function dispatch(): void
|
||||
{
|
||||
Event::emit('adminapi.member.level.updated', $this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: http://www.madong.tech
|
||||
*/
|
||||
|
||||
namespace app\adminapi\event;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* 菜单格式化事件
|
||||
*/
|
||||
class MenuFormattingEvent
|
||||
{
|
||||
/**
|
||||
* 菜单数据
|
||||
*/
|
||||
public Collection|null $data;
|
||||
|
||||
/**
|
||||
* 格式化类型
|
||||
*/
|
||||
public string $formatType;
|
||||
|
||||
/**
|
||||
* 结果
|
||||
*/
|
||||
public array $result = [];
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct(
|
||||
Collection|null $data,
|
||||
string $formatType
|
||||
) {
|
||||
$this->data = $data;
|
||||
$this->formatType = $formatType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发事件
|
||||
*/
|
||||
public function dispatch(): array
|
||||
{
|
||||
Event::emit('adminapi.menu.formatting', $this);
|
||||
return $this->result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: http://www.madong.tech
|
||||
*/
|
||||
|
||||
namespace app\adminapi\event;
|
||||
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* 操作日志事件
|
||||
*/
|
||||
class OperationLogEvent
|
||||
{
|
||||
/**
|
||||
* 操作名称
|
||||
*/
|
||||
public string $name;
|
||||
|
||||
/**
|
||||
* OA 标签
|
||||
*/
|
||||
public array $oaTags;
|
||||
|
||||
/**
|
||||
* OA 描述
|
||||
*/
|
||||
public string $oaDescription;
|
||||
|
||||
/**
|
||||
* 应用名称
|
||||
*/
|
||||
public string $app;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*/
|
||||
public string $ip;
|
||||
|
||||
/**
|
||||
* IP归属地
|
||||
*/
|
||||
public string $ipLocation;
|
||||
|
||||
/**
|
||||
* 浏览器
|
||||
*/
|
||||
public string $browser;
|
||||
|
||||
/**
|
||||
* 操作系统
|
||||
*/
|
||||
public string $os;
|
||||
|
||||
/**
|
||||
* 请求URL
|
||||
*/
|
||||
public string $url;
|
||||
|
||||
/**
|
||||
* 控制器类名
|
||||
*/
|
||||
public string $className;
|
||||
|
||||
/**
|
||||
* 操作方法
|
||||
*/
|
||||
public string $action;
|
||||
|
||||
/**
|
||||
* 请求方法
|
||||
*/
|
||||
public string $method;
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
public string $param;
|
||||
|
||||
/**
|
||||
* 响应结果
|
||||
*/
|
||||
public array|string $result;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
public string $userName;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
public int $userId;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct(
|
||||
string $name,
|
||||
array $oaTags,
|
||||
string $oaDescription,
|
||||
string $app,
|
||||
string $ip,
|
||||
string $ipLocation,
|
||||
string $browser,
|
||||
string $os,
|
||||
string $url,
|
||||
string $className,
|
||||
string $action,
|
||||
string $method,
|
||||
string $param,
|
||||
array|string $result,
|
||||
string $userName,
|
||||
int $userId
|
||||
) {
|
||||
$this->name = $name;
|
||||
$this->oaTags = $oaTags;
|
||||
$this->oaDescription = $oaDescription;
|
||||
$this->app = $app;
|
||||
$this->ip = $ip;
|
||||
$this->ipLocation = $ipLocation;
|
||||
$this->browser = $browser;
|
||||
$this->os = $os;
|
||||
$this->url = $url;
|
||||
$this->className = $className;
|
||||
$this->action = $action;
|
||||
$this->method = $method;
|
||||
$this->param = $param;
|
||||
$this->result = $result;
|
||||
$this->userName = $userName;
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发事件
|
||||
*/
|
||||
public function dispatch(): void
|
||||
{
|
||||
Event::emit('adminapi.operation.log', $this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: http://www.madong.tech
|
||||
*/
|
||||
|
||||
namespace app\adminapi\event;
|
||||
|
||||
use app\enum\member\PointType;
|
||||
use app\enum\member\PointSource;
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* 积分变动事件
|
||||
*
|
||||
* 统一的积分变动事件,用于处理积分的增加和减少
|
||||
*/
|
||||
class PointsChangedEvent
|
||||
{
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
public int|string $memberId;
|
||||
|
||||
/**
|
||||
* 变动类型
|
||||
*/
|
||||
public PointType $type;
|
||||
|
||||
/**
|
||||
* 变动前积分
|
||||
*/
|
||||
public int $oldPoints;
|
||||
|
||||
/**
|
||||
* 变动后积分
|
||||
*/
|
||||
public int $newPoints;
|
||||
|
||||
/**
|
||||
* 变动的积分数量
|
||||
*/
|
||||
public int $points;
|
||||
|
||||
/**
|
||||
* 积分来源
|
||||
*/
|
||||
public PointSource $source;
|
||||
|
||||
/**
|
||||
* 变动原因/备注
|
||||
*/
|
||||
public string $remark;
|
||||
|
||||
/**
|
||||
* 关联ID(如订单ID、活动ID等,可选)
|
||||
*/
|
||||
public int|string|null $relatedId;
|
||||
|
||||
/**
|
||||
* 额外数据(可选,用于存储其他相关信息)
|
||||
*/
|
||||
public ?array $extra;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct(
|
||||
int|string $memberId,
|
||||
int $points,
|
||||
PointSource $source,
|
||||
PointType $type,
|
||||
int $oldPoints,
|
||||
int $newPoints,
|
||||
string $remark = '',
|
||||
int|string|null $relatedId = null,
|
||||
?array $extra = null
|
||||
) {
|
||||
$this->memberId = $memberId;
|
||||
$this->points = $points;
|
||||
$this->source = $source;
|
||||
$this->type = $type;
|
||||
$this->oldPoints = $oldPoints;
|
||||
$this->newPoints = $newPoints;
|
||||
$this->remark = $remark;
|
||||
$this->relatedId = $relatedId;
|
||||
$this->extra = $extra;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发事件
|
||||
*/
|
||||
public function dispatch(): void
|
||||
{
|
||||
Event::emit('adminapi.points.changed', $this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: http://www.madong.tech
|
||||
*/
|
||||
|
||||
namespace app\adminapi\event;
|
||||
|
||||
use app\enum\review\ReviewStatus;
|
||||
use app\model\review\Review;
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* 审核通过事件
|
||||
*/
|
||||
class ReviewApprovedEvent
|
||||
{
|
||||
/**
|
||||
* 审核记录
|
||||
*/
|
||||
public Review $review;
|
||||
|
||||
/**
|
||||
* 额外数据
|
||||
*/
|
||||
public array $data;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct(Review $review, array $data = [])
|
||||
{
|
||||
$this->review = $review;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发事件
|
||||
*/
|
||||
public function dispatch(): void
|
||||
{
|
||||
Event::emit('adminapi.review.approved', $this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: http://www.madong.tech
|
||||
*/
|
||||
|
||||
namespace app\adminapi\event;
|
||||
|
||||
use app\model\review\Review;
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* 审核创建事件
|
||||
*/
|
||||
class ReviewCreatedEvent
|
||||
{
|
||||
/**
|
||||
* 审核记录
|
||||
*/
|
||||
public Review $review;
|
||||
|
||||
/**
|
||||
* 额外数据
|
||||
*/
|
||||
public array $data;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct(Review $review, array $data = [])
|
||||
{
|
||||
$this->review = $review;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发事件
|
||||
*/
|
||||
public function dispatch(): void
|
||||
{
|
||||
Event::emit('adminapi.review.created', $this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
*+------------------
|
||||
* madong
|
||||
*+------------------
|
||||
* Copyright (c) https://gitee.com/motion-code All rights reserved.
|
||||
*+------------------
|
||||
* Author: Mr. April (405784684@qq.com)
|
||||
*+------------------
|
||||
* Official Website: http://www.madong.tech
|
||||
*/
|
||||
|
||||
namespace app\adminapi\event;
|
||||
|
||||
use app\model\review\Review;
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* 审核拒绝事件
|
||||
*/
|
||||
class ReviewRejectedEvent
|
||||
{
|
||||
/**
|
||||
* 审核记录
|
||||
*/
|
||||
public Review $review;
|
||||
|
||||
/**
|
||||
* 额外数据
|
||||
*/
|
||||
public array $data;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*/
|
||||
public function __construct(Review $review, array $data = [])
|
||||
{
|
||||
$this->review = $review;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发事件
|
||||
*/
|
||||
public function dispatch(): void
|
||||
{
|
||||
Event::emit('adminapi.review.rejected', $this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user