<?php namespace app\model\app; use support\Model; /** * @property integer $id ID (主键) * @property string $username 用户名 * @property string $invite_code 邀请码 * @property integer $is_active 是否激活 * @property string $login_ip 登录 IP * @property string $join_ip 加入 IP * @property integer $login_time 登录时间 * @property integer $prev_time 上次登录时间 * @property integer $status 状态 0正常 1禁用 * @property float $money 账户余额 * @property float $admin_money 管理员余额 * @property float $all_team_money 总团队余额 * @property float $task_income_money 任务收入 * @property integer $task_status 任务状态 * @property float $today_task_income 今日任务收入 * @property float $today_team_income 今日团队收入 * @property integer $growth_value 成长值 * @property integer $vip_id VIP ID * @property float $withdraw_money 提现金额 * @property integer $f_id 上级ID * @property integer $ff_id 二级上级ID * @property integer $fff_id 三级上级ID * @property integer $top_id 顶级ID * @property string $path 路径 * @property string $remark 备注 * @property integer $createtime 创建时间 * @property integer $updatetime 更新时间 */ class User extends Model { /** * The table associated with the model. * * @var string */ protected $table = 'user_info'; // 表名 /** * The primary key associated with the table. * * @var string */ protected $primaryKey = 'id'; // 主键 /** * Indicates if the model should be timestamped. * * @var bool */ public $timestamps = true; // 如果不需要自动维护创建和更新时间,可以将此设置为 false /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'username', 'invite_code', 'is_active', 'login_ip', 'join_ip', 'login_time', 'prev_time', 'status', 'money', 'admin_money', 'all_team_money', 'task_income_money', 'task_status', 'today_task_income', 'today_team_income', 'growth_value', 'vip_id', 'withdraw_money', 'f_id', 'ff_id', 'fff_id', 'top_id', 'path', 'remark', 'createtime', 'updatetime', ]; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'money' => 'float', 'admin_money' => 'float', 'all_team_money' => 'float', 'task_income_money' => 'float', 'today_task_income' => 'float', 'today_team_income' => 'float', 'growth_value' => 'integer', 'withdraw_money' => 'float', 'createtime' => 'integer', 'updatetime' => 'integer', 'status' => 'integer', ]; /** * 获取登录时间的格式化值 * * @param mixed $value * @return string */ public function getLoginTimeAttribute($value) { return date('Y-m-d H:i:s', $value); } /** * 获取创建时间的格式化值 * * @param mixed $value * @return string */ public function getCreatetimeAttribute($value) { return date('Y-m-d H:i:s', $value); } /** * 获取更新时间的格式化值 * * @param mixed $value * @return string */ public function getUpdatetimeAttribute($value) { return date('Y-m-d H:i:s', $value); } } /** * CREATE TABLE `users` ( `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID', `username` VARCHAR(255) NOT NULL COMMENT '用户名', `invite_code` VARCHAR(255) NOT NULL COMMENT '邀请码', `is_active` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否激活 (0:未激活, 1:已激活)', `login_ip` VARCHAR(45) NOT NULL COMMENT '最后登录IP', `join_ip` VARCHAR(45) NOT NULL COMMENT '注册IP', `login_time` INT(11) NOT NULL COMMENT '最后登录时间 (Unix时间戳)', `prev_time` INT(11) NOT NULL COMMENT '上次活动时间 (Unix时间戳)', `status` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '状态 (1: 正常, 0: 禁用)', `money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '账户余额', `admin_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '管理员账户余额', `all_team_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '团队总金额', `task_income_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '任务收入金额', `task_status` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '任务状态 (0: 未完成, 1: 完成)', `today_task_income` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '今天的任务收入', `today_team_income` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '今天的团队收入', `growth_value` INT(11) NOT NULL DEFAULT 0 COMMENT '成长值', `vip_id` INT(11) NOT NULL DEFAULT 0 COMMENT 'VIP等级ID', `withdraw_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '可提现金额', `f_id` INT(11) NOT NULL DEFAULT 0 COMMENT '上一级用户ID', `ff_id` INT(11) NOT NULL DEFAULT 0 COMMENT '上上级用户ID', `fff_id` INT(11) NOT NULL DEFAULT 0 COMMENT '上上上级用户ID', `top_id` INT(11) NOT NULL DEFAULT 0 COMMENT '最高层级ID', `path` TEXT NOT NULL COMMENT '用户路径', `remark` TEXT DEFAULT NULL COMMENT '备注', `createtime` INT(11) NOT NULL COMMENT '创建时间 (Unix时间戳)', `updatetime` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间 (Unix时间戳)', PRIMARY KEY (`id`), UNIQUE KEY `invite_code` (`invite_code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户信息表'; */