2024-05-31 17:54:46 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\common\model\system_store;
|
|
|
|
|
|
|
|
|
|
|
|
use app\common\model\BaseModel;
|
2024-09-02 15:31:07 +08:00
|
|
|
use Illuminate\Support\Facades\Log;
|
2024-05-31 17:54:46 +08:00
|
|
|
use think\model\concern\SoftDelete;
|
2024-09-02 15:31:07 +08:00
|
|
|
use Throwable;
|
2024-05-31 17:54:46 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 门店列表模型
|
|
|
|
* Class SystemStore
|
|
|
|
* @package app\common\model\system_store
|
|
|
|
*/
|
|
|
|
class SystemStore extends BaseModel
|
|
|
|
{
|
|
|
|
use SoftDelete;
|
|
|
|
protected $name = 'system_store';
|
|
|
|
protected $deleteTime = 'delete_time';
|
2025-01-04 10:34:38 +08:00
|
|
|
// 不生成该表的日志
|
|
|
|
public $doNotRecordLog = true;
|
2024-09-28 15:32:31 +08:00
|
|
|
public static function onBeforeWrite($data)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
$where = $data->getWhere();
|
|
|
|
if($data){
|
|
|
|
$find = self::where($where)->field(array_keys($data->toArray()))->find();
|
|
|
|
if($find){
|
|
|
|
channelLog(array_merge($find->toArray(),$where),'system_store','更新前');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Throwable $e) {
|
|
|
|
Log::error('system_store:' . $e->getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-02 15:31:07 +08:00
|
|
|
public static function onAfterWrite($data){
|
|
|
|
try{
|
|
|
|
channelLog($data->toArray(),'system_store','更新后');
|
|
|
|
}catch(Throwable $e){
|
|
|
|
Log::error('system_store:'.$e->getMessage());
|
|
|
|
}
|
|
|
|
}
|
2025-01-18 11:43:40 +08:00
|
|
|
|
|
|
|
public static function isActivityStore($storeId)
|
|
|
|
{
|
|
|
|
return in_array($storeId, [5]);
|
|
|
|
}
|
|
|
|
|
2025-01-21 15:48:03 +08:00
|
|
|
/**
|
|
|
|
* 是否自营门店
|
|
|
|
* @param $storeId
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public static function isSelfOperate($storeId): bool
|
|
|
|
{
|
|
|
|
return !in_array($storeId, [21, 22, 15, 7]);
|
|
|
|
}
|
|
|
|
|
2024-05-31 17:54:46 +08:00
|
|
|
}
|