1
0
Files
helper/application/common/model/Help.php
2020-08-06 14:58:51 +08:00

37 lines
987 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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);
}
}