Files
ProxyPanel/app/Http/Models/User.php
兔姬桑 0e2e5f61dd 2.3 版本 功能添加与优化
加入新支付方式 PayJS ← 未实装,后续版本实装。目前本人还卡在他们的账号注册上面,没法测试代码o(╥﹏╥)o
用户注册等地方添加新字段: 昵称; 用于后续邮件,页面显示;还需要更多优化与应用;
用户头像获取与昵称获取; 前提是用户有填写QQ信息或者注册邮箱为正常的QQ邮箱;
添加 维护模式; 模式开启后,用户界面将自动导到维护界面,管理后台正常运行。哀悼日网站可以添加大厂一样的哀悼维护了 3.1 维护模式定时关闭功能; 3.2 维护模式自定义提示语;
Ping检测与定时记录; 4.1 添加Ping记录界面; 4.2 节点界面添加检测独立Ping按钮; 4.3 针对用户界面添加Ping参考信息;
余额充值自定义功能
部分界面js显示优化
模块化页面;
2020-08-05 03:20:25 +08:00

160 lines
8.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Http\Models;
use Auth;
use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Notifications\DatabaseNotificationCollection;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Carbon;
/**
* 用户信息
* Class User
*
* @package App\Http\Models
* @mixin Eloquent
* @property int $id
* @property string $email 邮箱
* @property string $username 用户名
* @property string $password 密码
* @property int $port 代理端口
* @property string $passwd 代理密码
* @property string $vmess_id V2Ray用户ID
* @property int $transfer_enable 可用流量单位字节默认1TiB
* @property int $u 已上传流量,单位字节
* @property int $d 已下载流量,单位字节
* @property int $t 最后使用时间
* @property string|null $ip 最后连接IP
* @property int $enable 代理状态
* @property string $method 加密方式
* @property string $protocol 协议
* @property string|null $protocol_param 协议参数
* @property string $obfs 混淆
* @property string|null $obfs_param 混淆参数
* @property int $speed_limit_per_con 单连接限速默认10G为0表示不限速单位Byte
* @property int $speed_limit_per_user 单用户限速默认10G为0表示不限速单位Byte
* @property string|null $wechat 微信
* @property string|null $qq QQ
* @property string $usage 用途1-手机、2-电脑、3-路由器、4-其他
* @property int $pay_way 付费方式0-免费、1-季付、2-月付、3-半年付、4-年付
* @property int $balance 余额,单位分
* @property string|null $enable_time 开通日期
* @property string $expire_time 过期时间
* @property int $ban_time 封禁到期时间
* @property string|null $remark 备注
* @property int $level 等级:可定义名称
* @property int $is_admin 是否管理员0-否、1-是
* @property string $reg_ip 注册IP
* @property int $last_login 最后登录时间
* @property int $referral_uid 邀请人
* @property string|null $reset_time 流量重置日期NULL表示不重置
* @property int $invite_num 可生成邀请码数
* @property int $status 状态:-1-禁用、0-未激活、1-正常
* @property string|null $remember_token
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property-read Collection|UserLabel[] $label
* @property-read int|null $label_count
* @property-read Level $levelList
* @property-read DatabaseNotificationCollection|DatabaseNotification[] $notifications
* @property-read int|null $notifications_count
* @property-read Collection|Payment[] $payment
* @property-read int|null $payment_count
* @property-read User $referral
* @property-read UserSubscribe $subscribe
* @method static Builder|User newModelQuery()
* @method static Builder|User newQuery()
* @method static Builder|User query()
* @method static Builder|User uid()
* @method static Builder|User whereEmail($value)
* @method static Builder|User whereBalance($value)
* @method static Builder|User whereBanTime($value)
* @method static Builder|User whereCreatedAt($value)
* @method static Builder|User whereD($value)
* @method static Builder|User whereEnable($value)
* @method static Builder|User whereEnableTime($value)
* @method static Builder|User whereExpireTime($value)
* @method static Builder|User whereId($value)
* @method static Builder|User whereInviteNum($value)
* @method static Builder|User whereIp($value)
* @method static Builder|User whereIsAdmin($value)
* @method static Builder|User whereLastLogin($value)
* @method static Builder|User whereLevel($value)
* @method static Builder|User whereMethod($value)
* @method static Builder|User whereObfs($value)
* @method static Builder|User whereObfsParam($value)
* @method static Builder|User wherePasswd($value)
* @method static Builder|User wherePassword($value)
* @method static Builder|User wherePayWay($value)
* @method static Builder|User wherePort($value)
* @method static Builder|User whereProtocol($value)
* @method static Builder|User whereProtocolParam($value)
* @method static Builder|User whereQq($value)
* @method static Builder|User whereReferralUid($value)
* @method static Builder|User whereRegIp($value)
* @method static Builder|User whereRemark($value)
* @method static Builder|User whereRememberToken($value)
* @method static Builder|User whereResetTime($value)
* @method static Builder|User whereSpeedLimitPerCon($value)
* @method static Builder|User whereSpeedLimitPerUser($value)
* @method static Builder|User whereStatus($value)
* @method static Builder|User whereT($value)
* @method static Builder|User whereTransferEnable($value)
* @method static Builder|User whereU($value)
* @method static Builder|User whereUpdatedAt($value)
* @method static Builder|User whereUsage($value)
* @method static Builder|User whereUsername($value)
* @method static Builder|User whereVmessId($value)
* @method static Builder|User whereWechat($value)
*/
class User extends Authenticatable
{
use Notifiable;
protected $table = 'user';
protected $primaryKey = 'id';
function scopeUid($query)
{
return $query->where('id', Auth::user()->id);
}
function levelList()
{
return $this->hasOne(Level::class, 'level', 'level');
}
function payment()
{
return $this->hasMany(Payment::class, 'user_id', 'id');
}
function label()
{
return $this->hasMany(UserLabel::class, 'user_id', 'id');
}
function subscribe()
{
return $this->hasOne(UserSubscribe::class, 'user_id', 'id');
}
function referral()
{
return $this->hasOne(User::class, 'id', 'referral_uid');
}
function getBalanceAttribute($value)
{
return $value/100;
}
function setBalanceAttribute($value)
{
return $this->attributes['balance'] = $value*100;
}
}