84 lines
2.0 KiB
PHP
84 lines
2.0 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Model;
|
||
|
||
|
||
|
||
use Carbon\Carbon;
|
||
use Hyperf\Database\Model\Collection;
|
||
use Hyperf\Snowflake\Concern\Snowflake;
|
||
|
||
/**
|
||
* @property int $log_id 主键id
|
||
* @property string $name 姓名
|
||
* @property string $card_no 身份证号
|
||
* @property int $status 认证结果,1-通过 2-不通过(原因见reasonType) 0-待定
|
||
* @property string $data_id 用户侧唯一标识
|
||
* @property string $task_id 服务侧唯一标识
|
||
* @property string $content 返回内容,json格式
|
||
* @property \Carbon\Carbon $created_at 创建时间
|
||
* @property \Carbon\Carbon $updated_at 修改时间
|
||
*/
|
||
class LogIdCard extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'log_id_card';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['log_id', 'name', 'card_no', 'status', 'data_id', 'task_id', 'content', 'created_at', 'updated_at'];
|
||
|
||
protected string $primaryKey = "log_id";
|
||
|
||
/**
|
||
* 获取数据-单
|
||
* @param array $params
|
||
* @param array $fields
|
||
* @return object|null
|
||
*/
|
||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||
{
|
||
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);
|
||
}
|
||
|
||
/**
|
||
* 修改
|
||
* @param array $params
|
||
* @param array $data
|
||
* @return int
|
||
*/
|
||
public static function edit(array $params = [], array $data = []): int
|
||
{
|
||
return self::where($params)->update($data);
|
||
}
|
||
|
||
/**
|
||
* 新增
|
||
* @param array $data
|
||
* @return LogIdCard|\Hyperf\Database\Model\Model
|
||
*/
|
||
public static function addLogIdCard(array $data): LogIdCard|\Hyperf\Database\Model\Model
|
||
{
|
||
return self::create($data);
|
||
}
|
||
|
||
}
|