123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace app\admin\controller\shopro;
- use app\common\controller\Backend;
- use fast\Http;
- class Upload extends Backend
- {
- protected $noNeedRight = ['proxyImg'];
-
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\shopro\Upload;
- }
-
-
-
-
- public function index()
- {
-
- $this->relationSearch = false;
-
- $this->request->filter(['strip_tags', 'trim']);
- if ($this->request->isAjax())
- {
-
- if ($this->request->request('keyField'))
- {
- return $this->selectpage();
- }
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- $total = $this->model
-
- ->where($where)
- ->order($sort, $order)
- ->count();
- $list = $this->model
-
- ->where($where)
- ->order($sort, $order)
- ->limit($offset, $limit)
- ->select();
- foreach ($list as $row) {
- $row->visible(['id','name']);
-
- }
- $list = collection($list)->toArray();
- $result = array("total" => $total, "rows" => $list);
- return json($result);
- }
- return $this->view->fetch();
- }
- public function select()
- {
- return $this->view->fetch();
- }
-
- public function proxyImg()
- {
- $url = $this->request->get('url', '');
- $url = urldecode($url);
-
- $result = Http::get($url);
- return response($result, 200, ['Content-Length' => strlen($result)])->contentType('image/png');
- }
- }
|