CompositeAuth::className(), 'authMethods' => [ # 下面是三种验证access_token方式 //HttpBasicAuth::className(), //HttpBearerAuth::className(), # 这是GET参数验证的方式 # http://10.10.10.252:600/user/index/index?access-token=xxxxxxxxxxxxxxxxxxxx QueryParamAuth::className(), ], ]; #定义返回格式是:JSON $behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_JSON; return $behaviors; } public function actionViewbydate($begin_datetime,$end_datetime){ # 分页参数处理 $numPerPage = Request::param('numPerPage'); if(!$numPerPage || $numPerPage <1 || $numPerPage > 800 ){ $numPerPage = 100; }else{ $numPerPage = (int)$numPerPage; } # where条件处理 $where = ''; if($begin_datetime){ $where .= " last_updated >= '".$begin_datetime."' "; } if($end_datetime){ if($where){ $where .= " AND last_updated < '".$end_datetime."' "; }else{ $where .= " last_updated < '".$end_datetime."' "; } } //echo $where;exit; if(!$where){ throw new \yii\web\HttpException(404, 'You Must Add Where Filter By DateTime'); } $query = WishOrder::find()->where($where); if($query->count() <1){ throw new \yii\web\HttpException(404, 'No entries found with this query string'); } $provider = new ActiveDataProvider([ 'query' => $query, 'pagination' => [ 'pageSize' => $numPerPage, ], ]); return $provider; } }