mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]代码巡检优化修复
This commit is contained in:
parent
c11064ef7b
commit
d9cc3f3dce
@ -151,9 +151,9 @@ class FileService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件相对名称
|
* 获取文件相对名称
|
||||||
* @param 文件标识 $source
|
* @param string $source 文件标识
|
||||||
* @param 文件后缀 $ext
|
* @param string $ext 文件后缀
|
||||||
* @param 文件前缀 $pre
|
* @param string $pre 文件前缀
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getFileName($source, $ext = '', $pre = '') {
|
public static function getFileName($source, $ext = '', $pre = '') {
|
||||||
@ -295,7 +295,7 @@ class FileService {
|
|||||||
return self::local($filename, file_get_contents($url));
|
return self::local($filename, file_get_contents($url));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error("FileService 文件下载失败 [ {$url} ] . {$e->getMessage()}");
|
Log::error("FileService 文件下载失败 [ {$url} ] . {$e->getMessage()}");
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ class NodeService {
|
|||||||
session('user', Db::name('SystemUser')->where('id', $userid)->find());
|
session('user', Db::name('SystemUser')->where('id', $userid)->find());
|
||||||
}
|
}
|
||||||
if (($authorize = session('user.authorize'))) {
|
if (($authorize = session('user.authorize'))) {
|
||||||
$authorizeids = Db::name('SystemAuth')->where('id', 'in', explode(',', $authorize))->where('status', '1')->column('id');
|
$where = ['id' => ['in', explode(',', $authorize)], 'status' => '1'];
|
||||||
|
$authorizeids = Db::name('SystemAuth')->where($where)->column('id');
|
||||||
if (empty($authorizeids)) {
|
if (empty($authorizeids)) {
|
||||||
return session('user.nodes', []);
|
return session('user.nodes', []);
|
||||||
}
|
}
|
||||||
@ -72,7 +73,7 @@ class NodeService {
|
|||||||
if (!in_array($auth_node, self::getAuthNode())) {
|
if (!in_array($auth_node, self::getAuthNode())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return in_array($auth_node, (array) session('user.nodes'));
|
return in_array($auth_node, (array)session('user.nodes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,8 +62,8 @@ class WechatService {
|
|||||||
# 下载临时文件到本地
|
# 下载临时文件到本地
|
||||||
$filename = 'wechat/image/' . join('/', str_split(md5($local_url), 16)) . '.' . strtolower(pathinfo($local_url, 4));
|
$filename = 'wechat/image/' . join('/', str_split(md5($local_url), 16)) . '.' . strtolower(pathinfo($local_url, 4));
|
||||||
$result = FileService::local($filename, file_get_contents($local_url));
|
$result = FileService::local($filename, file_get_contents($local_url));
|
||||||
|
# 上传图片到微信服务器
|
||||||
if ($result && isset($result['file'])) {
|
if ($result && isset($result['file'])) {
|
||||||
# 上传图片到微信服务器
|
|
||||||
$wechat = &load_wechat('media');
|
$wechat = &load_wechat('media');
|
||||||
$mediainfo = $wechat->uploadImg(['media' => "@{$result['file']}"]);
|
$mediainfo = $wechat->uploadImg(['media' => "@{$result['file']}"]);
|
||||||
if (!empty($mediainfo)) {
|
if (!empty($mediainfo)) {
|
||||||
@ -71,8 +71,8 @@ class WechatService {
|
|||||||
Db::name('WechatNewsImage')->insert($data);
|
Db::name('WechatNewsImage')->insert($data);
|
||||||
return $mediainfo['url'];
|
return $mediainfo['url'];
|
||||||
}
|
}
|
||||||
|
Log::error("图片上传失败,请稍后再试!{$wechat->errMsg}[{$wechat->errCode}]");
|
||||||
}
|
}
|
||||||
Log::error("图片上传失败,请稍后再试!{$wechat->errMsg}[{$wechat->errCode}]");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user