This commit is contained in:
2023-03-23 14:24:13 +08:00
parent 5492abefb8
commit 2b121804d0
4 changed files with 31 additions and 12 deletions
+12 -5
View File
@@ -6,6 +6,7 @@ namespace App\Model;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
@@ -28,11 +29,6 @@ class BasicJob extends Model
*/
protected array $fillable = ['job_id', 'job_name', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['job_id' => 'string', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "job_id";
/**
@@ -45,4 +41,15 @@ class BasicJob extends Model
{
return self::where($params)->first($fields);
}
/**
* 获取信息-多条
* @param array $params
* @param array $fields
* @return Collection|array
*/
public static function getList(array $params, array $fields = ['*']): Collection|array
{
return self::where($params)->get($fields);
}
}