+
+
+
+
企业打款、企业红包、订单退款等操作需要使用双向证书,可在微信商户平台下载证书!
@@ -52,66 +79,57 @@
-
+{/block}
+
+{block name="script"}
+
{/block}
diff --git a/extend/service/FileService.php b/extend/service/FileService.php
index 120a64ddc..c647abb60 100644
--- a/extend/service/FileService.php
+++ b/extend/service/FileService.php
@@ -117,8 +117,9 @@ class FileService {
static public function readFile($filename, $storage = null) {
switch (empty($storage) ? sysconf('storage_type') : $storage) {
case 'local':
- if (file_exists(ROOT_PATH . 'public/upload/' . $filename)) {
- return file_get_contents(ROOT_PATH . 'public/upload/' . $filename);
+ $filepath = ROOT_PATH . 'public/upload/' . $filename;
+ if (file_exists($filepath)) {
+ return file_get_contents($filepath);
}
case 'qiniu':
$auth = new Auth(sysconf('storage_qiniu_access_key'), sysconf('storage_qiniu_secret_key'));
@@ -133,13 +134,13 @@ class FileService {
* @param string $filename
* @param string $bodycontent
* @param string|null $file_storage
- * @return array|null
+ * @return array|false
*/
static public function save($filename, $bodycontent, $file_storage = null) {
$type = empty($file_storage) ? sysconf('storage_type') : $file_storage;
if (!method_exists(__CLASS__, $type)) {
Log::error("保存存储失败,调用{$type}存储引擎不存在!");
- return null;
+ return false;
}
return self::$type($filename, $bodycontent);
}
@@ -153,7 +154,7 @@ class FileService {
static public function local($filename, $bodycontent) {
$filepath = ROOT_PATH . 'public/upload/' . $filename;
try {
- !is_dir(dirname($filepath)) && mkdir(dirname($filepath), '0755', true);
+ !file_exists(dirname($filepath)) && mkdir(dirname($filepath), '0755', true);
if (file_put_contents($filepath, $bodycontent)) {
return [
'file' => $filepath,
diff --git a/extend/service/PayService.php b/extend/service/PayService.php
index 41afd9b9a..ea0093c80 100644
--- a/extend/service/PayService.php
+++ b/extend/service/PayService.php
@@ -46,22 +46,22 @@ class PayService {
* @param int $fee 支付金额
* @param string $title 订单标题
* @param string $from 订单来源
- * @return bool
+ * @return false|string
*/
public static function createWechatPayQrc(WechatPay $pay, $order_no, $fee, $title, $from = 'wechat') {
$prepayid = self::_createWechatPrepayid($pay, null, $order_no, $fee, $title, 'NATIVE', $from);
if ($prepayid === false) {
return false;
}
- $filename = 'wechat/payqrc/' . join('/', str_split(md5($prepayid), 16)) . '.png';
- if (!FileService::hasFile($filename)) {
+ $filename = 'wechat/qrc/' . join('/', str_split(md5($prepayid), 16)) . '.png';
+ if (!FileService::hasFile($filename, 'local')) {
$qrCode = new QrCode();
$qrCode->setText($prepayid);
- FileService::save($filename, $qrCode->get());
+ if (null === FileService::save($filename, $qrCode->get(), 'local')) {
+ return false;
+ }
}
- ob_clean();
- header("Content-type: image/png");
- return FileService::readFile($filename);
+ return FileService::getFileUrl($filename, 'local');
}