初始化提交

This commit is contained in:
2023-02-17 17:10:16 +08:00
commit 4ca844f470
152 changed files with 20390 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $module_id 主键ID
* @property string $module_name 模块名称
* @property string $module_img_path 模块图片
* @property int $app_type 应用程序类型(1:小程序 2:app)
* @property int $client_type 类型(1:患者端 2:医生端 3:药师端)
* @property int $module_place 展示位置(1:首页)
* @property int $module_status 状态(0:删除 1:正常 2:禁用)
* @property int $module_sort 排序值(越大排序越靠前)
* @property string $module_link 跳转地址
* @property \Carbon\Carbon $created_at 创建时间
* @property \Carbon\Carbon $updated_at 修改时间
*/
class Module extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'module';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['module_id', 'module_name', 'module_img_path', 'app_type', 'client_type', 'module_place', 'module_status', 'module_sort', 'module_link', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['module_id' => 'integer', 'app_type' => 'integer', 'client_type' => 'integer', 'module_place' => 'integer', 'module_status' => 'integer', 'module_sort' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
protected string $primaryKey = "module_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 = ['*'], string $order = "module_sort", string $direction = 'desc'): object|null
{
return self::where($params)->orderBy($order, $direction)->get($fields);
}
}