first commit
This commit is contained in:
36
application/common/model/Help.php
Normal file
36
application/common/model/Help.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
// +------------------------------------------------+
|
||||
// |http://www.cjango.com |
|
||||
// +------------------------------------------------+
|
||||
// | 修复BUG不是一朝一夕的事情,等我喝醉了再说吧! |
|
||||
// +------------------------------------------------+
|
||||
// | Author: 小陈叔叔 <Jason.Chen> |
|
||||
// +------------------------------------------------+
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Config;
|
||||
|
||||
class Help extends _Init
|
||||
{
|
||||
/**
|
||||
* 模型初始化【事件注册】
|
||||
*/
|
||||
protected static function init()
|
||||
{
|
||||
self::beforeInsert(function ($data) {
|
||||
$data->status = 1;
|
||||
});
|
||||
}
|
||||
|
||||
public function getCategoryAttr($value, $data)
|
||||
{
|
||||
$list = Config::get('help_type');
|
||||
return empty($list[$data['category']]) ? '没这个分类' : $list[$data['category']];
|
||||
}
|
||||
|
||||
public function getCreateTimeAttr($value, $data)
|
||||
{
|
||||
return date('Y-m-d', $value);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user