request->isPost()) { $params = (new SupplyDemandValidate())->post()->goCheck('supplyDemandRelease'); $userId = $this->userId; $params['user_id'] = $userId; $result = SupplyDemandLogic::addSupplyDemand($params); if (true === $result) { switch ($params['type']){ case 1 : $type_name = '供应'; break; case 2 : $type_name = '需求'; break ; default : $type_name = ''; break; } return $this->success($type_name.'信息添加成功', [], 1, 1); } }else{ return $this->fail('请求方式错误'); } } public function submitSupplyDemandInfo() { if($this->request->isPost()) { $params = (new SupplyDemandValidate())->post()->goCheck('submitSupplyDemand'); $userId = $this->userId; $params['user_id'] = $userId; $result = SupplyDemandLogic::submitSupplyDemand($params); if (true === $result) { return $this->success('信息提交审核成功', [], 1, 1); } }else{ return $this->fail('请求方式错误'); } } /** * @notes 供需列表 * @return \think\response\Json * @author 段誉 * @date 2022/9/7 15:38 */ public function getSupplyDemandList() { return $this->dataLists(new SupplyDemandLists()); } /** * @notes 查询供需信息 * @return \think\response\Json * @author 段誉 * @date 2022/9/7 15:38 */ public function getSupplyDemandInfo() { $params = (new SupplyDemandValidate())->get()->goCheck('info'); $result = SupplyDemandLogic::getInfo($params,$this->userId); if ($result['code'] === false) { return $this->fail(SupplyDemandLogic::getError()); } return $this->data($result['data']); } //供需分类 public function getCateList() { $params = (new SupplyDemandValidate())->get()->goCheck('cate'); $result = SupplyDemandLogic::getCateList($params,$this->userId); return $this->data($result); } public function delete(){ if($this->request->isPost()) { $params = (new SupplyDemandValidate())->post()->goCheck('delete'); $result = SupplyDemandLogic::delete($params); if (true === $result) { return $this->success('删除成功', [], 1, 1); } }else{ return $this->fail('请求方式错误'); } } }