request->get('orderId'); $type = Yii::$app->request->get('type') ?: '1'; if (!$orderId) { return $this->result(2, '订单ID不能为空!!!'); } if ($type == 1) { Printing::takeoutOrderPrint($orderId); } return $this->result(1, '成功'); } public function actionGetPrintList(){ $request = Yii::$app->request; if ($request->isGet){ $result=axios_request(); $table= (new \yii\db\Query()) ->from('{{%ybwm_core_category}}'); if($result['id']){ $re=$table->where(['id'=>$result['id']])->one(); }else{ $re=$table->where(['deleteAt'=>0,'uniacid'=>$this->wqData['uniacid'],'storeId'=>$this->wqData['storeId'],'item'=>7])->all(); } return $this->result(1,'成功',$re); } } public function actionPrintSave(){ $request = Yii::$app->request; if ($request->isPost){ $shop_id=$this->wqData['storeId']; if(!$shop_id){ return $this->result(3,'无效的门店,请先添加商店');die; } $result=axios_request(); $storeId=$result['storeId']?:$this->wqData['storeId']; $data=array( 'sort'=>trim($result['sort']), 'name'=>trim($result['name']),//商品分类名称 'display'=>$result['display']?$result['display']:1, 'uniacid'=>$this->wqData['uniacid'], 'storeId'=>$storeId, 'item'=>7 ); if($result['id']){ $res=YII::$app->db->createCommand()->update('{{%ybwm_core_category}}',$data, 'id=:id', ['id' =>$result['id']])->execute(); }else{ $data['createdAt']=time(); $row= (new \yii\db\Query()) ->from('{{%ybwm_core_label}}') ->where(['uniacid'=>$this->wqData['uniacid'],'storeId'=>$storeId,'name'=>trim($result['name'])]) ->one(); if($row){ return $this->result(2,'打印机标签已存在'); } $res=Yii::$app->db->createCommand()->insert('{{%ybwm_core_category}}', $data)->execute(); } if($res!==false){ return $this->result(1,'成功'); }else{ return $this->result(2,'网络异常,请稍后再试'); } } } public function actionChangePrint(){ $request = Yii::$app->request; if ($request->isPost){ $result=axios_request(); $re = YII::$app->db->createCommand()->update('{{%ybwm_core_category}}', ['display'=>$result['display']],'id=:id', ['id' =>$result['id']])->execute(); if($re){ return $this->result(1,'成功'); }else{ return $this->result(2,'网络异常,请稍后再试'); } } } public function actionPrintDel(){ $request = Yii::$app->request; if ($request->isPost){ $result=axios_request(); if(is_array($result['id'])){ $re=YII::$app->db->createCommand()->update('{{%ybwm_core_category}}',['deleteAt'=>time()], ['in','id',$result['id']])->execute(); }else { $re = YII::$app->db->createCommand()->update('{{%ybwm_core_category}}', ['deleteAt' => time()], 'id=:id', ['id' => $result['id']])->execute(); } if($re!==false){ return $this->result(1,'成功'); }else{ return $this->result(2,'网络异常,请稍后再试'); } } } }