UserRule.php 467 B

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