- 按 docs/renew-code-comment.md 将 PHP 文件头改为带边框的 Author 注释\n- 注释中的 crmeb.com 替换为 uj345.cn(代码字符串中的外链未改)\n- 新增 docs/renew-code-comment.md 说明 Made-with: Cursor
97 lines
3.4 KiB
PHP
97 lines
3.4 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Author: ScottPan Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\controller\admin\v1\order;
|
|
|
|
use app\controller\admin\AuthController;
|
|
use app\services\order\OtherOrderServices;
|
|
use app\services\other\QrcodeServices;
|
|
use crmeb\utils\Canvas;
|
|
use think\annotation\Inject;
|
|
|
|
/**
|
|
* Class OtherOrder
|
|
* @package app\controller\admin\v1\order
|
|
*/
|
|
class OtherOrder extends AuthController
|
|
{
|
|
|
|
/**
|
|
* @var OtherOrderServices
|
|
*/
|
|
#[Inject]
|
|
protected OtherOrderServices $services;
|
|
|
|
/**
|
|
* 线下收银
|
|
* @return mixed
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function scan_list()
|
|
{
|
|
$where = $this->request->getMore([
|
|
['order_id', ''],
|
|
['add_time', ''],
|
|
['name', ''],
|
|
['page', 1],
|
|
['limit', 20],
|
|
]);
|
|
$data = $this->services->getScanOrderList($where);
|
|
return $this->success($data);
|
|
}
|
|
|
|
/**
|
|
* 获取线下二维码
|
|
* @return mixed
|
|
* @throws \Exception
|
|
*/
|
|
public function offline_scan()
|
|
{
|
|
[$type] = $this->request->getMore([
|
|
['type', 1]
|
|
], true);
|
|
//生成h5地址
|
|
$weixinPage = "/pages/annex/offline_pay/index";
|
|
$weixinFileName = "wechat_offline_scan.png";
|
|
/** @var QrcodeServices $QrcodeService */
|
|
$QrcodeService = app()->make(QrcodeServices::class);
|
|
$wechatQrcode = $QrcodeService->getWechatQrcodePath($weixinFileName, $weixinPage, false, false);
|
|
//生成小程序地址
|
|
$routineQrcode = $QrcodeService->getRoutineQrcodePath(4, 6, 103, $weixinFileName, false);
|
|
$qrcod = ['wechat' => $wechatQrcode, 'routine' => $routineQrcode];
|
|
if ($type) {
|
|
//生成画布
|
|
$canvas = Canvas::instance();
|
|
$path = 'uploads/offline/';
|
|
$imageType = 'jpg';
|
|
$siteUrl = sys_config('site_url');
|
|
$canvas->setImageUrl(public_path() . 'statics/qrcode/offlines.jpg')->setImageHeight(730)->setImageWidth(500)->pushImageValue();
|
|
foreach ($qrcod as $k => $v) {
|
|
if ($v) {
|
|
$name = 'offline_' . $k;
|
|
//再本地接去掉http使用本地绝对路径获取
|
|
if (strstr($v, $this->request->host(true)) !== false) {
|
|
$v = str_replace([
|
|
'https://' . $this->request->host(true) . '/',
|
|
'http://' . $this->request->host(true) . '/'
|
|
], public_path(), $v);
|
|
}
|
|
$canvas->setImageUrl($v)->setImageHeight(344)->setImageWidth(344)->setImageLeft(76)->setImageTop(120)->pushImageValue();
|
|
$image = $canvas->setFileName($name)->setImageType($imageType)->setPath($path)->setBackgroundWidth(500)->setBackgroundHeight(720)->starDrawChart();
|
|
$data[$k] = $image ? $siteUrl . '/' . $image : '';
|
|
} else {
|
|
$data[$k] = "";
|
|
}
|
|
|
|
}
|
|
} else {
|
|
$data = ['wechat' => $wechatQrcode, 'routine' => $routineQrcode];
|
|
}
|
|
return $this->success($data);
|
|
}
|
|
}
|