objMSupplierOfferPriceSheet = new MSupplierOfferPriceSheet($this->onlineUserId,$this->onlineEnterpriseId); } /** * Doc: (des="") * User: XMing * Date: 2020/12/16 * Time: 6:48 下午 * @return array */ public function commonFieldFilter() { $params = $this->request->getRawJson(); if( empty($params) ){ self::sendOutput('参数为空', ErrorCode::$paramError ); } $data = [ 'details' => getArrayItem($params,'details',null), 'materielNum' => getArrayItem($params,'materielNum',0), 'supplierName' => getArrayItem($params,'supplierName',''), 'supplierId' => $this->supplierId, ]; foreach($data as $key => $value){ if(is_null($value)){ self::sendOutput($key.'参数错误', ErrorCode::$paramError ); } } return $data; } /** * Doc: (des="供应商报价单添加") * User: XMing * Date: 2020/12/16 * Time: 6:46 下午 * @throws \Exception */ public function add() { $data = $this->commonFieldFilter(); $result = $this->objMSupplierOfferPriceSheet->add($data,$this->supplierId); if($result->isSuccess()){ parent::sendOutput($result->getData()); } parent::sendOutput($result->getData(), $result->getErrorCode()); } /** * Doc: (des="编辑报价单") * User: XMing * Date: 2020/12/17 * Time: 11:53 上午 */ public function edit() { $id = $this->request->param('request_id'); if (empty($id)) { parent::sendOutput('id参数错误', ErrorCode::$paramError); } $data = $this->commonFieldFilter(); $result = $this->objMSupplierOfferPriceSheet->edit($data,$id,$this->supplierId); if($result->isSuccess()){ parent::sendOutput($result->getData()); } parent::sendOutput($result->getData(), $result->getErrorCode()); } /** * Doc: (des="报价单列表") * User: XMing * Date: 2020/12/17 * Time: 10:14 上午 */ public function getAll() { $params = $this->request->getRawJson(); $page = getArrayItem($params,'page',1); $pageSize = getArrayItem($params,'pageSize',10); $pageParams = pageToOffset($page, $pageSize); $params['limit'] = $pageParams['limit']; $params['offset'] = $pageParams['offset']; $result = $this->objMSupplierOfferPriceSheet->getAll($params); if ($result->isSuccess()) { $returnData = $result->getData(); $pageData = [ 'pageIndex' => $page, 'pageSize' => $pageSize, 'pageTotal' => $returnData['total'], ]; parent::sendOutput($returnData['data'], 0, $pageData); } parent::sendOutput($result->getData(), $result->getErrorCode()); } /** * Doc: (des="报价单详情") * User: XMing * Date: 2020/12/17 * Time: 11:35 上午 * @throws \Exception */ public function get() { $id = $this->request->param('request_id'); if (empty($id)) { parent::sendOutput('id参数错误', ErrorCode::$paramError); } $result = $this->objMSupplierOfferPriceSheet->get($id); if (!$result->isSuccess()) { parent::sendOutput($result->getData(), $result->getErrorCode()); } parent::sendOutput($result->getData()); } /** * Doc: (des="删除") * User: XMing * Date: 2020/12/17 * Time: 11:45 上午 */ public function del() { $id = $this->request->param('request_id'); if (empty($id)) { parent::sendOutput('id参数错误', ErrorCode::$paramError); } $result = $this->objMSupplierOfferPriceSheet->del($id); if (!$result->isSuccess()) { parent::sendOutput($result->getData(), $result->getErrorCode()); } parent::sendOutput($result->getData()); } /** * Doc: (des="报价单-审核") * User: XMing * Date: 2020/12/21 * Time: 4:23 下午 */ public function audit() { $id = $this->request->param('request_id'); if (empty($id)) { parent::sendOutput('id参数错误', ErrorCode::$paramError); } $result = $this->objMSupplierOfferPriceSheet->audit($id); if (!$result->isSuccess()) { parent::sendOutput($result->getData(), $result->getErrorCode()); } parent::sendOutput($result->getData()); } }