123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <?php
- namespace JinDouYun\Controller\Price;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\Price\MSupplierOfferPriceSheet;
- use Mall\Framework\Core\ErrorCode;
- /**
- * @copyright Copyright (c) https://www.qianniaovip.com All rights reserved
- * Description: 供应商报价单
- * Class SupplierOfferPrice
- * @package JinDouYun\Controller\Price
- */
- class SupplierOfferPrice extends BaseController
- {
- /**
- * @var MSupplierOfferPriceSheet
- */
- private $objMSupplierOfferPriceSheet;
- /**
- * SupplierOfferPrice constructor.
- * @param bool $isCheckAcl
- * @param bool $isMustLogin
- * @param bool $checkToken
- * @param false $getAreaCode
- * @param false $checkShopToken
- * @throws \Exception
- */
- public function __construct($isCheckAcl = true, $isMustLogin = true, $checkToken = true, $getAreaCode = false, $checkShopToken = false)
- {
- parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode, $checkShopToken);
- $this->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());
- }
- }
|