Save.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php namespace Upload\Api;
  2. use Dever;
  3. class Save
  4. {
  5. public function __construct()
  6. {
  7. $this->id = Dever::input('id', 'is_numeric', '上传规则错误', 1);
  8. $this->file = Dever::input('file', '!empty', '上传文件错误');
  9. $this->cate_id = Dever::input('cate_id', 'is_numeric', '上传分类', 1);
  10. $this->group_id = Dever::load('util', 'upload')->getGroup();
  11. $this->user_id = Dever::load('util', 'upload')->getUser();
  12. }
  13. public function act()
  14. {
  15. return Dever::load('save', 'upload')->init($this->id, $this->cate_id, $this->group_id, $this->user_id)->act($this->file);
  16. }
  17. public function wangEditor()
  18. {
  19. Dever::config('setting', array('output' => array
  20. (
  21. 'status' => array('errno', array('1' => 0, '2' => 1)),
  22. 'msg' => 'message',
  23. )));
  24. return $this->act();
  25. }
  26. public function avatar()
  27. {
  28. $uid = Dever::input('uid', 'is_numeric', '用户ID');
  29. return Dever::load('save', 'upload')->init($this->id, $this->cate_id, $this->group_id, $this->user_id)->act($this->file, 'jpg', $uid);
  30. }
  31. }