request->param(); $validate = new GoodsValidate(); if (!$validate->scene('base')->check($params)) { return $this->json(4001, $validate->getError()); } $data = GoodsRepository::getInstance()->list(); return $this->json(0, 'success', $data); } /** * 获取分类列表 * * @return Json * @throws Exception */ public function category() { $params = $this->request->param(); $validate = new GoodsValidate(); if (!$validate->scene('base')->check($params)) { return $this->json(4001, $validate->getError()); } $data = GoodsRepository::getInstance()->categoryList(); return $this->json(0, 'success', $data); } public function testApiClassMethod() { $header = $this->request->header(); $all = $this->request->param(); $get = input('get.'); $post = input('post.'); return $this->json(0, 'success', ['cost'=>$cost ?? 0]); } }