|
|
|
|
@ -32,6 +32,8 @@ use Illuminate\Support\Facades\Log;
|
|
|
|
|
use Intervention\Image\Facades\Image;
|
|
|
|
|
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
|
|
|
|
use function GuzzleHttp\Psr7\str;
|
|
|
|
|
use Kkokk\Poster\Facades\Html;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OrdersController extends CommonController
|
|
|
|
|
{
|
|
|
|
|
@ -1930,4 +1932,39 @@ class OrdersController extends CommonController
|
|
|
|
|
return response()->json($orderAgreement->toArray());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Post(
|
|
|
|
|
* path="/manager/html-to-image",
|
|
|
|
|
* tags={"管理端订单处理"},
|
|
|
|
|
* summary="html生成图片",
|
|
|
|
|
* description="html生成图片",
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
* @OA\Parameter(name="html", in="query", @OA\Schema(type="string"), required=true, description="html内容"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="html生成图片"
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function htmlToImage()
|
|
|
|
|
{
|
|
|
|
|
$html = \request('html');
|
|
|
|
|
if (empty($html)) {
|
|
|
|
|
return response()->json([
|
|
|
|
|
"errorcode" => "4001",
|
|
|
|
|
"errormsg" => "html内容不能为空"
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
$htmlObj = Html::load($html)->render();
|
|
|
|
|
// 返回base64格式图片
|
|
|
|
|
$base64 = base64_encode($htmlObj);
|
|
|
|
|
return response()->json([
|
|
|
|
|
"errorcode" => "200",
|
|
|
|
|
"errormsg" => "html生成图片成功",
|
|
|
|
|
"data" => [
|
|
|
|
|
"image_base64" => $base64
|
|
|
|
|
]
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|