1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace app\admin\model;
- use think\Model;
- /**
- * Notice
- * @controllerUrl 'routineNotice'
- */
- class Notice extends Model
- {
- // 表名
- protected $name = 'notice';
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- protected $createTime = 'createtime';
- protected $updateTime = 'updatetime';
- protected static function onAfterInsert($model)
- {
- if ($model->weigh == 0) {
- $pk = $model->getPk();
- $model->where($pk, $model[$pk])->update(['weigh' => $model[$pk]]);
- }
- }
- public function getContentAttr($value, $row)
- {
- return !$value ? '' : htmlspecialchars_decode($value);
- }
- }
|