更换model目录

This commit is contained in:
cano
2024-03-04 04:28:48 +08:00
parent f4f61a5f4c
commit bebbee4184
29 changed files with 90 additions and 146 deletions

View File

@ -0,0 +1,63 @@
<?php
namespace App\Models\Api\Customer;
use App\Models\Api\Base\ApiBaseModel;
use Illuminate\Support\Carbon;
class CustomerChangeInfoLogModel extends ApiBaseModel
{
protected $table = 'customer_change_info_log';
protected $primaryKey = 'id';
protected $fillable = [
'id',
'type',
'uid',
'column',
'value',
'before_value',
'after_value',
'pid',
'remark_key',
'remark_desc',
'created_at',
];
const PID_SYSTEM = 0; //系统默认pid
const TYPE_CHANG_USER_ACTIVE_STATUS = 1;
const TYPE = [
self::TYPE_CHANG_USER_ACTIVE_STATUS => '修改用户活跃状态',
];
const REMARK_DAILY_CHECK_USER_ACTIVE_STATUS_YES = 'dailyCheckUserActiveStatusYes';
const REMARK_DAILY_CHECK_USER_ACTIVE_STATUS_NO = 'dailyCheckUserActiveStatusNo';
const REMARK = [
self::REMARK_DAILY_CHECK_USER_ACTIVE_STATUS_YES => '每日检查用户活跃状态-活跃',
self::REMARK_DAILY_CHECK_USER_ACTIVE_STATUS_NO => '每日检查用户活跃状态-不活跃',
];
function addLog($aItem): \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Builder|array|null
{
$sDateTime = Carbon::now()->toDateTimeString();
$aItem['created_at'] = $sDateTime;
return $this->addItem($aItem);
}
function addUserActiveStatusLog($uid,$beforeValue,$value,$remark_key): \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Builder|array|null
{
$aLogInsert = [
'type' => CustomerChangeInfoLogModel::TYPE_CHANG_USER_ACTIVE_STATUS,
'uid' => $uid,
'column' => CustomerUserExtendModel::COL_IS_ACTIVE,
'before_value' => $beforeValue,
'pid' => CustomerChangeInfoLogModel::PID_SYSTEM,
'value' => $value,
'after_value' => $value,
'remark_key' => $remark_key,
'remark_desc' => CustomerChangeInfoLogModel::REMARK[$remark_key],
];
return $this->addLog($aLogInsert);
}
}