123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\common\basics;
-
-
- use think\App;
-
-
-
- abstract class ShopApi
- {
-
-
- protected $request;
-
-
-
- protected $app;
-
-
-
- protected $shop;
-
-
-
- protected $shop_id;
-
-
-
- protected $admin_id;
-
-
-
-
- protected $admin_name;
-
-
-
- public $admin_info = [];
-
- public $shop_info = [];
-
-
-
- public $client = null;
-
-
-
- public $page_no = 1;
-
-
-
- public $page_size = 15;
-
-
-
- public $like_not_need_login = [];
-
-
-
- public function __construct(App $app)
- {
- $this->app = app();
- $this->request = request();
-
-
-
- $this->initialize();
- }
-
-
-
- protected function initialize()
- {
-
- $this->admin_info = $this->request->admin_info ?? [];
- if(boolval($this->admin_info)) {
- $this->shop = $this->admin_info ?? null;
- $this->shop_id = $this->admin_info['shop_id'] ?? null;
- $this->shop_name = $this->admin_info['shop_name'] ?? null;
- $this->admin_id = $this->admin_info['id'] ?? null;
- $this->admin_name = $this->admin_info['name'] ?? null;
- $this->client = $this->admin_info['client'] ?? null;
- }
-
-
- $page_no = (int)$this->request->get('page_no');
- $this->page_no = $page_no && is_numeric($page_no) ? $page_no : $this->page_no;
- $page_size = (int)$this->request->get('page_size');
- $this->page_size = $page_size && is_numeric($page_size) ? $page_size : $this->page_size;
- $this->page_size = min($this->page_size, 100);
- }
- }
|