User.php
619 字节
<?php
namespace app\web\model;
use think\Config;
use think\Model;
class User extends Model
{
    /*
     *  添加一条用户数据
     * */
    public $autoWriteTimestamp = false;
    protected $hidden = ['password'];
    public function store($data)
    {
        $time_now = time();
        $base_data = [
            'create_time' => $time_now,
            'modify_time' => $time_now,
            'invalid_flag' => 1,
        ];
        $data['password'] = md5(Config::get('password_salt'). $data['password']);
        $data = array_merge($data, $base_data);
        return $this->create($data);
    }
}