1
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\model;
|
||||
use support\think\Db;
|
||||
|
||||
/**
|
||||
* @property integer $id 主键(主键)
|
||||
* @property string $username 用户名
|
||||
* @property string $nickname 昵称
|
||||
* @property string $password 密码
|
||||
* @property string $sex 性别
|
||||
* @property string $avatar 头像
|
||||
* @property string $email 邮箱
|
||||
* @property string $mobile 手机
|
||||
* @property integer $level 等级
|
||||
* @property string $birthday 生日
|
||||
* @property integer $money 余额
|
||||
* @property integer $score 积分
|
||||
* @property string $last_time 登录时间
|
||||
* @property string $last_ip 登录ip
|
||||
* @property string $join_time 注册时间
|
||||
* @property string $join_ip 注册ip
|
||||
* @property string $token token
|
||||
* @property string $created_at 创建时间
|
||||
* @property string $updated_at 更新时间
|
||||
* @property integer $role_id 角色
|
||||
* @property integer $status 禁用
|
||||
*/
|
||||
class User extends \app\model\User
|
||||
{
|
||||
|
||||
public static function onAfterUpdate($row){
|
||||
$changeData = $row->getChangedData();
|
||||
$orgData = $row->getOrigin();
|
||||
foreach(Config('site.allow_currencys') as $currency){
|
||||
if(isset($changeData[$currency])){
|
||||
$cha = $changeData[$currency] - $orgData[$currency];
|
||||
if($cha!=0){
|
||||
\support\Log::channel('cansnow')->alert('管理员手动修改用户余额:'.$row->id.',货币:'.$currency.',修改金额:'.$cha.',原始数据:'.$orgData[$currency].',修改后的数据:'.$changeData[$currency]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static function onAfterDelete($row)
|
||||
{
|
||||
Db::name('address')->where('user_id',$row->id)->delete();
|
||||
Db::name('recharge')->where('user_id',$row->id)->delete();
|
||||
Db::name('record')->where('user_id',$row->id)->delete();
|
||||
Db::name('withdrawl')->where('user_id',$row->id)->delete();
|
||||
Db::name('user_extend')->where('user_id',$row->id)->delete();
|
||||
Db::name('user_team')->where('descendant_id|ancestor_id','=',$row->id)->delete();
|
||||
Db::name('withdrawl')->where('user_id',$row->id)->delete();
|
||||
(new \app\model\BalanceLog)->setSuffix('_money')->where('user_id',(int)$row->id)->delete();
|
||||
(new \app\model\BalanceLog)->setSuffix('_score')->where('user_id',(int)$row->id)->delete();
|
||||
(new \app\model\BalanceLog)->setSuffix('_currency1')->where('user_id',(int)$row->id)->delete();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user