mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-11-08 11:43:43 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4eef7f0797 | ||
|
|
dfb8edff22 | ||
|
|
05c1b08e95 | ||
|
|
de848ab32b |
@@ -22,7 +22,6 @@ class IndexController
|
||||
}
|
||||
public function test()
|
||||
{
|
||||
|
||||
return app()->getBasePath();
|
||||
return View::fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,6 +279,8 @@ class PayController
|
||||
$action = isset($info['action']) ? $info['action'] : '';
|
||||
if ($action === 'mpay') {
|
||||
$data = json_decode($info['data'], true);
|
||||
if (!is_array($data)) return 200;
|
||||
if(!isset($data['aid']) || !isset($data['pid'])) return 202;
|
||||
$config = PayAccount::getAccountConfig($data['aid'], $data['pid']);
|
||||
$payclient_path = "\\payclient\\{$config['payclass']}";
|
||||
$Payclient = new $payclient_path($info, $config);
|
||||
|
||||
@@ -125,14 +125,27 @@ class PayManageController extends BaseController
|
||||
public function uploadQrcode()
|
||||
{
|
||||
$img = $this->request->file('codeimg');
|
||||
if (!$img) {
|
||||
return json(backMsg(1, '请选择要上传的文件'));
|
||||
}
|
||||
// 验证文件类型
|
||||
$allowedTypes = ['image/png', 'image/jpeg', 'image/gif'];
|
||||
$fileMimeType = $img->getMime();
|
||||
if (!in_array($fileMimeType, $allowedTypes)) {
|
||||
return json(backMsg(1, '只允许上传PNG、JPEG或GIF格式的图片'));
|
||||
}
|
||||
// 生成唯一文件名
|
||||
$filename = 'img_' . time() . '_' . uniqid() . '.' . $img->getOriginalExtension();
|
||||
// 设置文件保存路径
|
||||
$path = public_path() . '/files/qrcode/';
|
||||
if (!is_dir($path)) {
|
||||
mkdir($path, 0777, true);
|
||||
mkdir($path, 0755, true);
|
||||
}
|
||||
$info = $img->move($path, 'img' . time() . '.' . $img->getOriginalExtension());
|
||||
// 移动文件到指定目录
|
||||
$info = $img->move($path, $filename);
|
||||
if ($info) {
|
||||
$imgpath = '/files/qrcode/';
|
||||
return json(backMsg(0, '上传成功', ['imgpath' => $imgpath . $info->getFilename()]));
|
||||
$imgpath = '/files/qrcode/' . $filename;
|
||||
return json(backMsg(0, '上传成功', ['imgpath' => $imgpath]));
|
||||
} else {
|
||||
return json(backMsg(1, '上传失败'));
|
||||
}
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
<select class="type" lay-filter="select-type">
|
||||
<option value="">请选择</option>
|
||||
<!-- <?php if ($platform == 'wxpay') { ?> -->
|
||||
<option value="wxpay1">个人码</option>
|
||||
<option value="wxpay1">个人码/经营码</option>
|
||||
<option value="wxpay2">赞赏码</option>
|
||||
<!-- <option value="wxpay3">经营码</option> -->
|
||||
<option value="wxpay3" disabled >经营码</option>
|
||||
<option value="wxpay4">商家码</option>
|
||||
<!-- <?php } ?> -->
|
||||
<!-- <?php if ($platform == 'alipay') { ?> -->
|
||||
<option value="alipay1">收钱码</option>
|
||||
<!-- <option value="alipay2">经营码</option> -->
|
||||
<option value="alipay1">收钱码/经营码</option>
|
||||
<option value="alipay2" disabled>经营码</option>
|
||||
<!-- <?php } ?> -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user