Skip to content

Commit 4512bec

Browse files
committed
update v5.2.0
1 parent 7cdb986 commit 4512bec

File tree

5 files changed

+90
-15
lines changed

5 files changed

+90
-15
lines changed

crmeb/README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CRMEB v4.5 后端程序目录
1+
CRMEB v5 后端程序目录
22
===============
33

44
> 运行环境要求PHP7.1-7.4。
@@ -8,12 +8,10 @@ CRMEB v4.5 后端程序目录
88
## 一键安装
99
上传你的代码,站点入口目录设置/public
1010
在浏览器中输入你的域名或IP(例如:www.yourdomain.com),
11-
安装程序会自动执行安装。期间系统会提醒你输入数据库信息以完成安装,安装完成后建议删除install目录下index.php文件或将其改名
11+
安装程序会自动执行安装。期间系统会提醒你输入数据库信息以完成安装,安装完成后建议删除install目录
1212

1313
后台访问地址:
1414
1.域名/admin
15-
2.域名/index.php/admin
16-
3.域名/index.php?s=/admin
1715
公众号和H5首页访问地址:
1816
1.域名/
1917

@@ -37,32 +35,39 @@ DEFAULT_TIMEZONE = Asia/Shanghai
3735
[DATABASE]
3836
TYPE = mysql
3937
HOSTNAME = 127.0.0.1 #数据库连接地址
38+
HOSTPORT = 3306 #数据库端口
4039
DATABASE = test #数据库名称
4140
USERNAME = username #数据库登录账号
4241
PASSWORD = password #数据库登录密码
43-
HOSTPORT = 3306 #数据库端口
44-
CHARSET = utf8
42+
PREFIX = eb_
43+
CHARSET = utf8mb4
4544
DEBUG = true
4645
4746
[LANG]
4847
default_lang = zh-cn
4948
49+
[CACHE]
50+
DRIVER = file #缓存类型,redis/file
51+
CACHE_PREFIX = cache_xxxx: #缓存前缀
52+
CACHE_TAG_PREFIX = cache_tag_xxxx: #缓存类型前缀
53+
5054
[REDIS]
51-
REDIS_HOSTNAME = 127.0.0.1 # redis链接地址
55+
REDIS_HOSTNAME = 127.0.0.1 #redis链接地址
5256
PORT = 6379 #端口号
5357
REDIS_PASSWORD = 123456 #密码
5458
SELECT = 0 #数据库
59+
60+
[QUEUE]
61+
QUEUE_NAME = xxxx #队列前缀
5562
~~~
5663
3.修改目录权限(linux系统)777
57-
/public
58-
/runtime
64+
/crmeb
65+
/template
66+
5967
4.后台登录:
6068
http://域名/admin
6169
默认账号:admin 密码:crmeb.com
62-
## 消息队列
63-
```sh
64-
php think queue:listen --queue
65-
```
70+
6671

6772
## 消息队列
6873
```sh

crmeb/app/services/agent/DivisionAgentApplyServices.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use app\services\other\UploadService;
1717
use think\facade\Log;
1818
use think\facade\Route;
19+
use think\facade\Config;
1920

2021
class DivisionAgentApplyServices extends BaseServices
2122
{
@@ -245,6 +246,18 @@ public function getStaffList($userInfo, $where, $field = '*')
245246
public function downloadImage($url = '', $name = '', $type = 0, $timeout = 30, $w = 0, $h = 0)
246247
{
247248
if (!strlen(trim($url))) return '';
249+
if (!strlen(trim($name))) {
250+
//TODO 获取要下载的文件名称
251+
$downloadImageInfo = $this->getImageExtname($url);
252+
$ext = $downloadImageInfo['ext_name'];
253+
$name = $downloadImageInfo['file_name'];
254+
if (!strlen(trim($name))) return '';
255+
} else {
256+
$ext = $this->getImageExtname($name)['ext_name'];
257+
}
258+
if (!in_array($ext, Config::get('upload.fileExt'))) {
259+
throw new AdminException(400558);
260+
}
248261
//TODO 获取远程文件所采用的方法
249262
if ($type) {
250263
$ch = curl_init();
@@ -283,4 +296,25 @@ public function downloadImage($url = '', $name = '', $type = 0, $timeout = 30, $
283296
$data['is_exists'] = false;
284297
return $data;
285298
}
299+
300+
/**
301+
* 获取即将要下载的图片扩展名
302+
* @param string $url
303+
* @param string $ex
304+
* @return array|string[]
305+
*/
306+
public function getImageExtname($url = '', $ex = 'jpg')
307+
{
308+
$_empty = ['file_name' => '', 'ext_name' => $ex];
309+
if (!$url) return $_empty;
310+
if (strpos($url, '?')) {
311+
$_tarr = explode('?', $url);
312+
$url = trim($_tarr[0]);
313+
}
314+
$arr = explode('.', $url);
315+
if (!is_array($arr) || count($arr) <= 1) return $_empty;
316+
$ext_name = trim($arr[count($arr) - 1]);
317+
$ext_name = !$ext_name ? $ex : $ext_name;
318+
return ['file_name' => md5($url) . '.' . $ext_name, 'ext_name' => $ext_name];
319+
}
286320
}

crmeb/app/services/product/product/CopyTaobaoServices.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use app\services\system\attachment\SystemAttachmentServices;
1919
use crmeb\exceptions\AdminException;
2020
use app\services\other\UploadService;
21+
use think\facade\Config;
2122

2223
/**
2324
*
@@ -288,7 +289,7 @@ public function downloadImage($url = '', $name = '', $type = 0, $timeout = 30, $
288289
} else {
289290
$ext = $this->getImageExtname($name)['ext_name'];
290291
}
291-
if (!in_array($ext, ['jpg', 'jpeg', 'png', 'gif', 'JPG', 'JPEG', 'PNG', 'GIF'])) {
292+
if (!in_array($ext, Config::get('upload.fileExt'))) {
292293
throw new AdminException(400558);
293294
}
294295
//TODO 获取远程文件所采用的方法

crmeb/app/services/wechat/WechatQrcodeServices.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use crmeb\exceptions\AdminException;
1515
use app\services\other\UploadService;
1616
use crmeb\services\app\WechatService;
17+
use think\facade\Config;
1718

1819
/**
1920
* Class WechatQrcodeServices
@@ -172,6 +173,18 @@ public function getChannelCode($id = 0)
172173
public function downloadImage($url = '', $name = '', $type = 0, $timeout = 30, $w = 0, $h = 0)
173174
{
174175
if (!strlen(trim($url))) return '';
176+
if (!strlen(trim($name))) {
177+
//TODO 获取要下载的文件名称
178+
$downloadImageInfo = $this->getImageExtname($url);
179+
$ext = $downloadImageInfo['ext_name'];
180+
$name = $downloadImageInfo['file_name'];
181+
if (!strlen(trim($name))) return '';
182+
} else {
183+
$ext = $this->getImageExtname($name)['ext_name'];
184+
}
185+
if (!in_array($ext, Config::get('upload.fileExt'))) {
186+
throw new AdminException(400558);
187+
}
175188
//TODO 获取远程文件所采用的方法
176189
if ($type) {
177190
$ch = curl_init();
@@ -211,6 +224,27 @@ public function downloadImage($url = '', $name = '', $type = 0, $timeout = 30, $
211224
return $data;
212225
}
213226

227+
/**
228+
* 获取即将要下载的图片扩展名
229+
* @param string $url
230+
* @param string $ex
231+
* @return array|string[]
232+
*/
233+
public function getImageExtname($url = '', $ex = 'jpg')
234+
{
235+
$_empty = ['file_name' => '', 'ext_name' => $ex];
236+
if (!$url) return $_empty;
237+
if (strpos($url, '?')) {
238+
$_tarr = explode('?', $url);
239+
$url = trim($_tarr[0]);
240+
}
241+
$arr = explode('.', $url);
242+
if (!is_array($arr) || count($arr) <= 1) return $_empty;
243+
$ext_name = trim($arr[count($arr) - 1]);
244+
$ext_name = !$ext_name ? $ex : $ext_name;
245+
return ['file_name' => md5($url) . '.' . $ext_name, 'ext_name' => $ext_name];
246+
}
247+
214248
/**
215249
* 扫码完成后方法
216250
* @param $qrcodeInfo

crmeb/crmeb/utils/DownloadImage.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use app\services\other\UploadService;
1616
use crmeb\exceptions\AdminException;
1717
use think\Image;
18+
use think\facade\Config;
1819

1920
/**
2021
* 下载图片到本地
@@ -80,7 +81,7 @@ public function downloadImage(string $url, $name = '')
8081
} else {
8182
$ext = $this->getImageExtname($name)['ext_name'];
8283
}
83-
if (!in_array($ext, ['jpg', 'jpeg', 'png', 'gif', 'JPG', 'JPEG', 'PNG', 'GIF'])) {
84+
if (!in_array($ext, Config::get('upload.fileExt'))) {
8485
throw new AdminException(400558);
8586
}
8687
if (strstr($url, 'http://') === false && strstr($url, 'https://') === false) {

0 commit comments

Comments
 (0)