|
|
@@ -7,6 +7,7 @@ use app\models\user\WechatUser;
|
|
|
use think\facade\Cookie;
|
|
|
use app\admin\model\system\SystemAttachment;
|
|
|
use app\models\user\UserLevel;
|
|
|
+use think\facade\Log;
|
|
|
|
|
|
/**
|
|
|
* 用户事件
|
|
|
@@ -22,18 +23,18 @@ class UserSubscribe
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 管理员后台给用户添加金额
|
|
|
+ * 管理员后台给用户添加金额 AdminAddMoney
|
|
|
* @param $event
|
|
|
*/
|
|
|
public function onAdminAddMoney($event)
|
|
|
{
|
|
|
list($user, $money) = $event;
|
|
|
- //$user 用户信息
|
|
|
- //$money 添加的金额
|
|
|
+
|
|
|
+ Log::warning('EVENT admin add money ' . $money . ' to ' . $user['uid']);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 微信授权成功后
|
|
|
+ * 微信授权成功后 WechatOauthAfter
|
|
|
* @param $event
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
@@ -91,63 +92,96 @@ class UserSubscribe
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 用户访问记录
|
|
|
+ * 用户登录成功 UserLogin
|
|
|
* @param $event
|
|
|
*/
|
|
|
- public function onInitLogin($event)
|
|
|
+ public function onUserLogin($event)
|
|
|
{
|
|
|
list($userInfo) = $event;
|
|
|
$request = app('request');
|
|
|
User::edit(['last_time' => time(), 'last_ip' => $request->ip()], $userInfo->uid, 'uid');
|
|
|
+
|
|
|
+ Log::debug('EVENT user ' . $userInfo->uid . ' login.');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 检查是否能成为会员
|
|
|
+ * 检查是否能成为会员 UserLevelAfter
|
|
|
* @param $event
|
|
|
*/
|
|
|
public function onUserLevelAfter($event)
|
|
|
{
|
|
|
list($userUid) = $event;
|
|
|
- UserLevel::setLevelComplete($userUid);
|
|
|
+ try {
|
|
|
+ if(UserLevel::setLevelComplete($userUid)) {
|
|
|
+ event('UserLevelUp', $event);
|
|
|
+ }
|
|
|
+ } catch (\Exception $e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户升级成功 UserLevelUp
|
|
|
+ */
|
|
|
+ public function onUserLevelUp($event)
|
|
|
+ {
|
|
|
+ list($userUid) = $event;
|
|
|
+ $userinfo = User::get($userUid);
|
|
|
+
|
|
|
+ Log::debug("EVENT user " . $userUid . ' update to level ' . $userinfo['level']);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 新用戶注冊
|
|
|
+ * 新用戶注冊 UserRegistered
|
|
|
*/
|
|
|
public function onUserRegistered($event)
|
|
|
{
|
|
|
- echo 'onUserRegistered?';
|
|
|
+ list($user) = $event;
|
|
|
+
|
|
|
+ Log::debug('EVENT new user registered:' . $user['uid']);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 首次下訂單
|
|
|
+ * 首次下訂單 UserFirstOrder
|
|
|
*/
|
|
|
public function onUserFirstOrder($event)
|
|
|
{
|
|
|
+ list($order) = $event;
|
|
|
|
|
|
+ Log::debug('EVENT user ' . $order['uid'] . ' first order:' . $order['id']);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 首次挖礦得到弊
|
|
|
+ * 用戶提現 UserRequestWithdrawal
|
|
|
*/
|
|
|
- public function onUserFirstDig($event)
|
|
|
+ public function onUserRequestWithdrawal($event)
|
|
|
{
|
|
|
+ list($user, $info) = $event;
|
|
|
|
|
|
+ Log::debug('EVENT user ' . $user['uid'] . ' withdraw ' . mapped_implode(',', $info));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 用戶提現
|
|
|
+ * 首次挖礦得到弊 UserFirstDig
|
|
|
*/
|
|
|
- public function onUserWithdrawal($event)
|
|
|
+ public function onUserFirstDig($event)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 用户提币
|
|
|
+ * 用户提币 UserWithdrawalCoin
|
|
|
*/
|
|
|
public function onUserWithdrawalCoin($event)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户参加活动 UserActivity
|
|
|
+ */
|
|
|
+ public function onUserActivity($event)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
}
|