UserRule.php 582 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\admin\model;
  3. use think\model;
  4. /**
  5. * UserRule 模型
  6. * @controllerUrl 'userRule'
  7. */
  8. class UserRule extends model
  9. {
  10. protected $autoWriteTimestamp = 'int';
  11. protected $createTime = 'createtime';
  12. protected $updateTime = 'updatetime';
  13. protected static function onAfterInsert($model)
  14. {
  15. $pk = $model->getPk();
  16. $model->where($pk, $model[$pk])->update(['weigh' => $model[$pk]]);
  17. }
  18. public function setComponentAttr($value)
  19. {
  20. if ($value) $value = str_replace('\\', '/', $value);
  21. return $value;
  22. }
  23. }