| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace app\api\model\service;
- use app\api\model\BaseModel;
- use redis\RedisClient;
- class Service extends BaseModel
- {
- // 表名
- protected $name = 'service';
- public function fetchServices($type, $params, $page = 1, $size = 10, $user = null)
- {
- $where = [
- 'type' => $type,
- 'status' => \E_BASE_STATUS::Normal,
- ];
- if(isset($params['p_code']) && $params['p_code'] > 0) {
- $where['p_code'] = $params['p_code'];
- }
- if (isset($params['category_id']) && $params['category_id'] > 0)
- $where['category_id'] = $params['category_id'];
- if (isset($params['hot']) && $params['hot'])
- $where['hot'] = 1;
- if (isset($params['store_id']) && $params['store_id'] > 0)
- $where['store_id'] = $params['store_id'];
- if (isset($params["sift"]) && $params['sift'])
- $where['sift'] = 1;
- if (!isset($params["is_add_clock"]) || $params["is_add_clock"] != 1) {
- $where['is_add_clock'] = 0;
- }
- return $this->where($where)
- ->order('sort', 'desc')
- ->order('real_price', 'ASC')
- ->page($page)
- ->paginate($size);
- }
- }
|