zm
2021-04-09 93652ca875fc904a25a7f214adc548745573950a
commit | author | age
90c639 1 <?php
Z 2 /**
3  * Created by PhpStorm.
4  * User: 风哀伤
5  * Date: 2020/4/8
6  * Time: 9:20
7  * @copyright: ©2019 浙江禾匠信息科技
8  * @link: http://www.zjhejiang.com
9  */
10
11 namespace app\jobs;
12
13
14 use app\forms\common\prints\PrintOrder;
15 use app\models\Mall;
16 use app\models\Order;
17 use yii\base\BaseObject;
18 use yii\queue\JobInterface;
19
20 /**
21  * Class PrintJob
22  * @package app\jobs
23  * @property Order $order
24  * @property Mall $mall
25  */
26 class PrintJob extends BaseJob implements JobInterface
27 {
28     public $order;
29     public $mall;
30     public $orderType;
31
32     public function execute($queue)
33     {
34         try {
35             $this->setRequest();
36             \Yii::$app->setMall($this->mall);
37
38             $printer = new PrintOrder();
39             $printer->print($this->order, $this->order->id, $this->orderType);
40         } catch (\Exception $exception) {
41             \Yii::error('小票打印机打印:' . $exception->getMessage());
42             \Yii::warning($exception);
43         }
44     }
45 }