houde_web_api/app/common/model/AboutUs/CompanyProfile.php
2023-04-30 15:42:13 +08:00

76 lines
2.2 KiB
PHP

<?php
namespace app\common\model\AboutUs;
use app\common\arw\adjfut\src\Validate;
use app\BaseModel;
use think\model\concern\SoftDelete;
use app\common\arw\adjfut\src\Excel;
use app\Request;
use app\common\exception\Tool;
use think\facade\Db;
class CompanyProfile extends BaseModel
{
use SoftDelete;
// 删除字段
protected $deleteTime = 'company_profile_delete_time';
// 设置主键名
protected $pk = 'company_profile_guid';
// 设置废弃字段
protected $disuse = [];
// 设置字段信息
protected $schema = [
"company_profile_id" => "int",
"company_profile_guid" => "string",
"company_profile_img" => "string",
"company_profile_content" => "string",
"company_profile_color" => "string",
"company_profile_order" => "int",
"company_profile_create_time" => "datetime",
"company_profile_create_user_guid" => "string",
"company_profile_update_time" => "datetime",
"company_profile_update_user_guid" => "string",
"company_profile_delete_time" => "datetime",
"company_profile_delete_user_guid" => "string",
];
// 设置json类型字段
protected $json = [''];
// 开启自动写入时间戳字段
protected $autoWriteTimestamp = 'datetime';
// 创建时间
protected $createTime = 'company_profile_create_time';
// 修改时间
protected $updateTime = 'company_profile_update_time';
//排序字段
public $order_field = 'company_profile_order';
/**
* 新增前
*/
public static function onBeforeInsert(self $model): void
{
Tool::sortInsertProc(self::class, $model->company_profile_order);
$model->completeCreateField();
}
/**
* 更新前
*/
public static function onBeforeUpdate(self $model): void
{
Tool::sortEditProc(self::class, $model->company_profile_guid, $model->company_profile_order);
$model->completeUpdateField();
}
/**
* 删除前
*/
public static function onBeforeDelete(self $model): void
{
Tool::sortDeleteProc(self::class, $model->company_profile_guid);
$model->completeDeleteField();
}
}