public static function insertLine($category, $reference, $val) { $model = new Dictionary(); $model->dic_id = $category . ":" . $reference; $model->category = $category; $model->val = $val; $model->save(); }
/** * start MPDF */ protected function createMpdf($view, $isfac = false) { $data = Yii::$app->request->get(); if (isset($data['order_id'])) { $order_id = $data['order_id']; $connection = \Yii::$app->db; $command = $connection->createCommand('SELECT * FROM orders WHERE order_id=' . $order_id); $order = $command->queryOne(); $user = $connection->createCommand('SELECT * FROM customer WHERE id =' . $order['action_user'])->queryOne(); $ordergoods = $connection->createCommand('SELECT * FROM order_goods WHERE order_id =' . $order_id)->queryAll(); if ($isfac && $order['fac_no'] == 0) { Dictionary::handleData("system", "factory_no"); $dic = Dictionary::findOne("system:factory_no"); $fac_no = $dic->auto; $order_model = Orders::findOne($order_id); $order_model->fac_no = $fac_no; $order_model->save(); $order['fac_no'] = $fac_no; } $mpdf = new Pdf(); $header = $this->renderPartial('mpdf/header', ['title' => 'nagoya']); $footer = $this->renderPartial('mpdf/footer'); $mpdf->setHeader($header); //设置PDF页眉内容 $mpdf->setFooter($footer); //设置PDF页脚内容 $content = $this->renderPartial($view, ['order' => $order, 'ordergoods' => $ordergoods, 'user' => $user]); $mpdf->Output($content); exit; } else { echo "缺少参数"; exit; } }