|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace bizGhs\order\classes;
|
|
|
|
|
|
+use wkhtmltox\Image\Converter;
|
|
|
use biz\shop\classes\ShopAdminClass;
|
|
|
use biz\shop\classes\ShopCapitalClass;
|
|
|
use biz\shop\classes\ShopClass;
|
|
|
@@ -1892,4 +1893,38 @@ class OrderClass extends BaseClass
|
|
|
Yii::$app->redis->executeCommand('LPUSH', [$newOrderKey, $id]);
|
|
|
}
|
|
|
|
|
|
+ public static function createImgOrder($order)
|
|
|
+ {
|
|
|
+ $mainId = $order->mainId ?? 0;
|
|
|
+ $orderSn = $order->orderSn ?? '';
|
|
|
+ $dir = Yii::getAlias('@app/web/html/' . $mainId . '/');
|
|
|
+ if (!file_exists($dir)) {
|
|
|
+ //检查是否有该文件夹,如果没有就创建,并给予最高权限
|
|
|
+ mkdir($dir, 0700, true);
|
|
|
+ }
|
|
|
+ $name = 'shish';
|
|
|
+ $v = '石';
|
|
|
+ $content = <<<XL
|
|
|
+<html lang="en">
|
|
|
+<head>
|
|
|
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+aaaaaaaaaaaaaaaa{$name}aaa{$v}aaaaaaaaaaaaaa
|
|
|
+</body>
|
|
|
+XL;
|
|
|
+ $file = $dir . $orderSn . '.html';
|
|
|
+ $imgFile = $dir . $orderSn . '.png';
|
|
|
+ file_put_contents($file, $content);
|
|
|
+
|
|
|
+ $con = new Converter(null, [
|
|
|
+ "fmt" => "png",
|
|
|
+ "in" => $file,
|
|
|
+ "out" => $imgFile,
|
|
|
+ ]);
|
|
|
+ $con->convert();
|
|
|
+ $url = Yii::$app->params['ghsHost'] . '/html/' . $mainId . '/' . $orderSn . '.png';
|
|
|
+ return ['url' => $url];
|
|
|
+ }
|
|
|
+
|
|
|
}
|