123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\admin\model;
- use support\Model;
- /**
- * 悦享家会员套餐包记录模型
- * Class SystemPermLog
- * @package app\admin\model
- */
- class SystemPermLog extends Model
- {
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'system_perm_log';
- /**
- * Notes:获取日志列表
- * @param string $keywords
- * @param int $page
- * @param int $limit
- * @return array
- * User: YCP
- * Date: 2022/11/22
- */
- public static function getLogList(int $page, int $limit,$keywords)
- {
- $list = static::select('*')
- ->when($keywords != '', function ($query) use ($keywords){
- $query->where('log_name', 'like', '%' . $keywords . '%');
- })
- ->orderBy('log_create_time','DESC')
- ->forPage($page, $limit)
- ->get();
- $count = static::when($keywords != '', function ($query) use ($keywords){
- $query->where('log_name', 'like', '%' . $keywords . '%');
- })
- ->count();
- return [$list, $count];
- }
- //时间格式
- public function getLogCreateTimeAttribute($value)
- {
- if($value == 0 || $value == ''){
- return 0;
- }else{
- return date('Y-m-d H:i:s', $value);
- }
- }
- }
|