登录
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace app\common\controller;
|
||||
|
||||
use app\common\model\User;
|
||||
use app\common\traits\crud\CrudControllerTrait;
|
||||
use app\admin\service\VehColorService;
|
||||
|
||||
class VehColorController extends BaseController
|
||||
{
|
||||
use CrudControllerTrait;
|
||||
|
||||
protected $service;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->service = new VehColorService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (isset($data['created_by']) && $data['created_by'])
|
||||
$data['created_by_name'] = User::where('id', $data['created_by'])->value('name');
|
||||
if (isset($data['updated_by']) && $data['updated_by'])
|
||||
$data['updated_by_name'] = User::where('id', $data['updated_by'])->value('name');
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据格式化
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function showFormat($data)
|
||||
{
|
||||
if (isset($data['created_at']))
|
||||
$data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
if (isset($data['updated_at']))
|
||||
$data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
if (isset($data['created_by']) && $data['created_by'])
|
||||
$data['created_by_name'] = User::where('id', $data['created_by'])->value('name');
|
||||
if (isset($data['updated_by']) && $data['updated_by'])
|
||||
$data['updated_by_name'] = User::where('id', $data['updated_by'])->value('name');
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user