Exemplo n.º 1
0
 /**
  * 获取(搜索)经销商
  * @param string $keywords
  */
 public function actionGetstores()
 {
     $request = \Yii::$app->request;
     $keywords = intval($request->get('keywords', ''));
     if (!$keywords) {
         return ['code' => 1, 'msg' => '数据非法', 'data' => []];
     }
     $res = Store::getStores($keywords);
     if ($res !== false) {
         return ['code' => 0, 'msg' => '操作成功', 'data' => $res];
     } else {
         return ['code' => 2, 'msg' => '操作失败,请重试', 'data' => []];
     }
 }
Exemplo n.º 2
0
 /**
  * Finds the Store model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Store the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Store::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }