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