This commit is contained in:
2025-03-17 18:01:53 +08:00
parent e3e9d990bb
commit 43897af989
13 changed files with 210 additions and 59 deletions
+1 -3
View File
@@ -5,8 +5,6 @@ namespace app\model;
use support\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class CarType extends Model
{
/**
@@ -32,7 +30,7 @@ class CarType extends Model
public static function getAll()
{
$list = CarType::get()->select('id','name','status')->where('status',0)->toArray();
$list = self::get()->select('id','name','status')->where('status',0)->toArray();
return $list;
}
}
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace app\model;
use support\Model;
class Channel extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'channel';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'id';
//设置黑名单
protected $guarded = ['id','created_at','updated_at'];
// 指定日期字段存储格式为时间戳
protected $dateFormat = 'U';
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = true;
protected $casts = [
// 'updated_at' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
// 'created_at' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
'updated_at' => 'timestamp', // 指定序列化格式
'created_at' => 'timestamp', // 指定序列化格式
];
public static function getAll()
{
$list = self::get()->select('id','name','status')->where('status',0)->toArray();
return $list;
}
}
+2 -1
View File
@@ -43,9 +43,10 @@ class Follow extends Model
'created_at' => 'timestamp', // 指定序列化格式
];
public static function getFollow($follow)
public static function getFollow($follow,$domain)
{
$follow['type_txt'] = Constants::FOLLOW[$follow['type']];
$follow['oss_picture'] = $domain.'/'.$follow['picture'];
return $follow;
}
}
+13
View File
@@ -30,6 +30,19 @@ class User extends Model
*/
public $timestamps = true;
// 指定日期字段存储格式为时间戳
protected $dateFormat = 'U';
//设置黑名单
protected $guarded = ['id','created_at','updated_at'];
protected $casts = [
// 'updated_at' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
// 'created_at' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
'updated_at' => 'timestamp', // 指定序列化格式
'created_at' => 'timestamp', // 指定序列化格式
];
public static function getUser($userId)
{
$user = User::first()->select(['id','name','sex','role','avatar','email','password'])