This commit is contained in:
2023-03-18 11:43:27 +08:00
parent 88a04aa4e8
commit 516a2ace66
3 changed files with 9 additions and 14 deletions
+72
View File
@@ -0,0 +1,72 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $code_log_id 主键id
* @property int $type 类型(1:短信 2:邮件)
* @property int $status 状态(1:发送成功 2:发送失败)
* @property int $scene 场景(1:登陆)
* @property string $phone 手机号
* @property string $code 验证码
* @property string $third_code 第三方编码
* @property string $remarks 备注
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class LogCode extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'log_code';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['log_id', 'type', 'status', 'scene', 'phone', 'code', 'third_code', 'remarks', '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
* @param string $order
* @param string $direction
* @return object|null
*/
public static function getList(array $params, array $fields = ['*']): object|null
{
return self::where($params)->get($fields);
}
/**
* 新增-批量
* @param array $data
* @return \Hyperf\Database\Model\Model|LogCode
*/
public static function addCodeLog(array $data): \Hyperf\Database\Model\Model|LogCode
{
return self::create($data);
}
}