Common.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 用户公共调用模块
  7. */
  8. namespace app\system\controller\passport;
  9. use app\common\controller\Manage;
  10. use app\common\facade\Upload;
  11. class Common extends Manage{
  12. /**
  13. * 图片文件上传与管理
  14. */
  15. public function upload(){
  16. $userpath = strtolower(create_code($this->user->id));
  17. if(request()->isPost()){
  18. return json(Upload::index($userpath));
  19. }else{
  20. $view['input'] = $this->request->param('input');
  21. $view['close'] = $this->request->param('close/d',0);
  22. $view['path'] = $this->request->param('path','/');
  23. $view['tab'] = $this->request->param('tab');
  24. $view['lists'] = Upload::directoryResource($view['path'],false,$userpath);
  25. return view()->assign($view);
  26. }
  27. }
  28. /**
  29. * 证书上传
  30. */
  31. public function cert($miniapp_id){
  32. if(request()->isPost()){
  33. if($this->member_miniapp_id != $miniapp_id){
  34. return json(['error'=>1,'message'=>'应用不存在']);
  35. }
  36. return json(Upload::cert($miniapp_id));
  37. }else{
  38. $view['input'] = $this->request->param('input');
  39. $view['miniapp_id'] = $miniapp_id;
  40. return view()->assign($view);
  41. }
  42. }
  43. }