request->post(); $post['merchantId'] = $this->ghsId; $post['shopId'] = $this->shopId; $post['adminId'] = $this->adminId; $ghsItemInfo = $post['itemInfo']??''; if(empty($ghsItemInfo)){ util::fail('请选择花材'); } $ghsItemInfo = json_decode($ghsItemInfo,true); if(!is_array($ghsItemInfo)){ util::fail('花材格式不正确'); } //判断花材里的信息 foreach ($ghsItemInfo as $v){ $itemId = $v['itemId']??0; $bigNum = $v['bigNum']??0; $smallNum = $v['smallNum']??0; $itemPrice = $v['itemPrice']??0; if(!$itemId){ util::fail('花材不存在'); } if($bigNum <=0 && $smallNum <=0){ util::fail('花材数量不能为0'); } } $post['itemInfo'] = $ghsItemInfo; $order = PurchaseOrderClass::addOrder($post); if($order){ util::success($order); }else{ util::fail(); } } //订单列表 public function actionList() { $get = Yii::$app->request->get(); $orderStatus = $get['orderStatus']??''; if($orderStatus){ $where['orderStatus'] = $orderStatus; } $where['merchantId'] = $this->ghsId; $where['shopId'] = $this->shopId; $data = PurchaseOrderClass::getOrderList($where); $data['list'] = PurchaseOrderClass::groupGhsInfo($data['list']); util::success($data); } //订单详情 public function actionDetail() { $orderSn = Yii::$app->request->get('orderSn',''); $orderData = PurchaseOrderClass::getOrderDetail($orderSn,$this->shopId); util::success($orderData); } }