mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-11-11 13:13:44 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4eef7f0797 | ||
|
|
dfb8edff22 | ||
|
|
05c1b08e95 | ||
|
|
de848ab32b |
@@ -22,7 +22,6 @@ class IndexController
|
|||||||
}
|
}
|
||||||
public function test()
|
public function test()
|
||||||
{
|
{
|
||||||
|
return View::fetch();
|
||||||
return app()->getBasePath();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,6 +279,8 @@ class PayController
|
|||||||
$action = isset($info['action']) ? $info['action'] : '';
|
$action = isset($info['action']) ? $info['action'] : '';
|
||||||
if ($action === 'mpay') {
|
if ($action === 'mpay') {
|
||||||
$data = json_decode($info['data'], true);
|
$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']);
|
$config = PayAccount::getAccountConfig($data['aid'], $data['pid']);
|
||||||
$payclient_path = "\\payclient\\{$config['payclass']}";
|
$payclient_path = "\\payclient\\{$config['payclass']}";
|
||||||
$Payclient = new $payclient_path($info, $config);
|
$Payclient = new $payclient_path($info, $config);
|
||||||
|
|||||||
@@ -125,14 +125,27 @@ class PayManageController extends BaseController
|
|||||||
public function uploadQrcode()
|
public function uploadQrcode()
|
||||||
{
|
{
|
||||||
$img = $this->request->file('codeimg');
|
$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/';
|
$path = public_path() . '/files/qrcode/';
|
||||||
if (!is_dir($path)) {
|
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) {
|
if ($info) {
|
||||||
$imgpath = '/files/qrcode/';
|
$imgpath = '/files/qrcode/' . $filename;
|
||||||
return json(backMsg(0, '上传成功', ['imgpath' => $imgpath . $info->getFilename()]));
|
return json(backMsg(0, '上传成功', ['imgpath' => $imgpath]));
|
||||||
} else {
|
} else {
|
||||||
return json(backMsg(1, '上传失败'));
|
return json(backMsg(1, '上传失败'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,14 +28,14 @@
|
|||||||
<select class="type" lay-filter="select-type">
|
<select class="type" lay-filter="select-type">
|
||||||
<option value="">请选择</option>
|
<option value="">请选择</option>
|
||||||
<!-- <?php if ($platform == 'wxpay') { ?> -->
|
<!-- <?php if ($platform == 'wxpay') { ?> -->
|
||||||
<option value="wxpay1">个人码</option>
|
<option value="wxpay1">个人码/经营码</option>
|
||||||
<option value="wxpay2">赞赏码</option>
|
<option value="wxpay2">赞赏码</option>
|
||||||
<!-- <option value="wxpay3">经营码</option> -->
|
<option value="wxpay3" disabled >经营码</option>
|
||||||
<option value="wxpay4">商家码</option>
|
<option value="wxpay4">商家码</option>
|
||||||
<!-- <?php } ?> -->
|
<!-- <?php } ?> -->
|
||||||
<!-- <?php if ($platform == 'alipay') { ?> -->
|
<!-- <?php if ($platform == 'alipay') { ?> -->
|
||||||
<option value="alipay1">收钱码</option>
|
<option value="alipay1">收钱码/经营码</option>
|
||||||
<!-- <option value="alipay2">经营码</option> -->
|
<option value="alipay2" disabled>经营码</option>
|
||||||
<!-- <?php } ?> -->
|
<!-- <?php } ?> -->
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user