verify($param); //参数验证 if ($verifyResult['status'] != 1) { return $verifyResult; } $where = $this->Term($param); $fields = $param['fields'] ? $param['fields'] : '*'; switch ($param['user_type']) { case 3: //商户 break; case 4: //门店 $PurchaseWarehouseModel = new SPurchaseWarehouseModel(); break; } try { $list = $PurchaseWarehouseModel->getSelect($where, '', '', $fields, 'default_state desc'); return $list ? $list : []; } catch (\Exception $e) { return []; } } /** * 查询条件 * @param $param * [ * user_type 3商户 4门店 * merchant_id * store_id * ] * @return mixed */ public function Term($param) { $where = [ 'merchant_id' => $param['merchant_id'], 'store_id' => $param['store_id'], 'status' => 1 ]; return $where; } /** * 参数验证 * @param $param * [ * user_type 3商户 4门店 * merchant_id * store_id * ] * @return mixed */ public function verify($param) { if (!in_array($param['user_type'], ['3', '4']) || empty($param['merchant_id']) || ($param['user_type'] == 4 && empty($p ['store_id']))) { return callBack(statusCode()['error'], "登录超时"); } return callBack(statusCode()['success'], "验证成功"); } }