Skip to content

Commit bfec09d

Browse files
committed
更新前端文件
1 parent b8b8514 commit bfec09d

File tree

935 files changed

+2400
-2163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

935 files changed

+2400
-2163
lines changed

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/.git
2+
/.idea
3+
/crmeb/.constant
4+
/crmeb/runtime
5+
/crmeb/public/uploads
6+
*.log
7+
/crmeb/public/install/install.lock
8+
/crmeb/.env
9+
/crmeb/timer.pid
10+
/crmeb/workerman.pid
11+
/docker-compose/mysql/data/
12+
/docker-compose/mysql/log/
13+
/docker-compose/nginx/log/

crmeb/LICENSE.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
5、如果您未能遵守本协议的条款,您的授权将被终止,所被许可的权利将被收回,并承担相应法律责任。
1818

1919
三、有限担保和免责声明
20-
1、本软件及所附带的文件是作为不提供任何明确的或隐含的赔偿或担保的形式提供的。
20+
1、本软件及所附带的文件是作为不提供任何明确的或隐含的赔偿或担保的形式提供的。
2121
2、用户出于自愿而使用本软件,您必须了解使用本软件的风险,在尚未购买产品技术服务之前,我们不承诺对免费用户提供任何形式的技术支持、使用担保,也不承担任何因使用本软件而产生问题的相关责任。
2222
3、电子文本形式的授权协议如同双方书面签署的协议一样,具有完全的和等同的法律效力。您一旦开始确认本协议并安装 CRMEB,即被视为完全理解并接受本协议的各项条款,在享有上述条款授予的权力的同时,受到相关的约束和限制。协议许可范围以外的行为,将直接违反本授权协议并构成侵权,我们有权随时终止授权,责令停止损害,并保留追究相关责任的权力。
2323

2424
协议发布时间: 2017年8月01日
25-
版本最新更新: 2022年3月15日 By CRMEB
25+
版本最新更新: 2022年3月28日 By CRMEB
2626

2727
CRMEB官方网站:http://www.crmeb.com
2828
CRMEB演示站:http://demo.crmeb.com
2929
-----------------------------------------------------
3030
运营团队: 众邦科技
3131
电 话: 400-8888-794
3232
33-
网 址: http://www.xazbkj.com
33+
网 址: http://www.xazbkj.com

crmeb/app/adminapi/AdminApiExceptionHandle.php

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,61 @@
1515
use crmeb\exceptions\AdminException;
1616
use crmeb\exceptions\ApiException;
1717
use crmeb\exceptions\AuthException;
18-
use think\exception\DbException;
18+
use think\db\exception\DbException;
1919
use think\exception\Handle;
2020
use think\exception\ValidateException;
2121
use think\facade\Env;
22+
use think\facade\Log;
2223
use think\Response;
2324
use Throwable;
2425

2526
class AdminApiExceptionHandle extends Handle
2627
{
28+
/**
29+
* 不需要记录信息(日志)的异常类列表
30+
* @var array
31+
*/
32+
protected $ignoreReport = [
33+
ValidateException::class,
34+
AuthException::class,
35+
AdminException::class,
36+
ApiException::class,
37+
];
2738

2839
/**
2940
* 记录异常信息(包括日志或者其它方式记录)
30-
*
3141
* @access public
3242
* @param Throwable $exception
3343
* @return void
3444
*/
3545
public function report(Throwable $exception): void
3646
{
37-
// 使用内置的方式记录异常日志
38-
parent::report($exception);
47+
if (!$this->isIgnoreReport($exception)) {
48+
$data = [
49+
'file' => $exception->getFile(),
50+
'line' => $exception->getLine(),
51+
'message' => $this->getMessage($exception),
52+
'code' => $this->getCode($exception),
53+
];
54+
55+
//日志内容
56+
$log = [
57+
request()->adminId(), //管理员ID
58+
request()->ip(), //客户ip
59+
ceil(msectime() - (request()->time(true) * 1000)), //耗时(毫秒)
60+
request()->rule()->getMethod(), //请求类型
61+
str_replace("/", "", request()->rootUrl()), //应用
62+
request()->baseUrl(), //路由
63+
json_encode(request()->param(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //请求参数
64+
json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //报错数据
65+
66+
];
67+
Log::write(implode("|", $log), "error");
68+
}
3969
}
4070

4171
/**
4272
* Render an exception into an HTTP response.
43-
*
4473
* @access public
4574
* @param \think\Request $request
4675
* @param Throwable $e
@@ -58,7 +87,7 @@ public function render($request, Throwable $e): Response
5887
if ($e instanceof DbException) {
5988
return app('json')->fail('数据获取失败', $massageData);
6089
} elseif ($e instanceof AuthException || $e instanceof ValidateException || $e instanceof ApiException) {
61-
return app('json')->make($e->getCode() ?: 400, $e->getMessage());
90+
return app('json')->make($e->getCode() ? : 400, $e->getMessage());
6291
} elseif ($e instanceof AdminException) {
6392
return app('json')->fail($e->getMessage(), $massageData);
6493
} else {

crmeb/app/api/ApiExceptionHandle.php

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,64 @@
1212
namespace app\api;
1313

1414

15+
use crmeb\exceptions\AdminException;
1516
use crmeb\exceptions\ApiException;
1617
use crmeb\exceptions\AuthException;
17-
use think\exception\DbException;
18+
use think\db\exception\DbException;
1819
use think\exception\Handle;
1920
use think\facade\Env;
21+
use think\facade\Log;
2022
use think\Response;
2123
use Throwable;
2224
use think\exception\ValidateException;
2325

2426
class ApiExceptionHandle extends Handle
2527
{
28+
/**
29+
* 不需要记录信息(日志)的异常类列表
30+
* @var array
31+
*/
32+
protected $ignoreReport = [
33+
ValidateException::class,
34+
AuthException::class,
35+
AdminException::class,
36+
ApiException::class,
37+
];
2638

2739
/**
2840
* 记录异常信息(包括日志或者其它方式记录)
29-
*
3041
* @access public
3142
* @param Throwable $exception
3243
* @return void
3344
*/
3445
public function report(Throwable $exception): void
3546
{
36-
// 使用内置的方式记录异常日志
37-
parent::report($exception);
47+
if (!$this->isIgnoreReport($exception)) {
48+
$data = [
49+
'file' => $exception->getFile(),
50+
'line' => $exception->getLine(),
51+
'message' => $this->getMessage($exception),
52+
'code' => $this->getCode($exception),
53+
];
54+
55+
//日志内容
56+
$log = [
57+
request()->uid(), //用户ID
58+
request()->ip(), //客户ip
59+
ceil(msectime() - (request()->time(true) * 1000)), //耗时(毫秒)
60+
request()->rule()->getMethod(), //请求类型
61+
str_replace("/", "", request()->rootUrl()), //应用
62+
request()->baseUrl(), //路由
63+
json_encode(request()->param(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //请求参数
64+
json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //报错数据
65+
66+
];
67+
Log::write(implode("|", $log), "error");
68+
}
3869
}
3970

4071
/**
4172
* Render an exception into an HTTP response.
42-
*
4373
* @access public
4474
* @param \think\Request $request
4575
* @param Throwable $e
@@ -54,7 +84,7 @@ public function render($request, Throwable $e): Response
5484
'message' => $e->getMessage(),
5585
'line' => $e->getLine(),
5686
]);
57-
} else if ($e instanceof AuthException || $e instanceof ApiException || $e instanceof ValidateException) {
87+
} elseif ($e instanceof AuthException || $e instanceof ApiException || $e instanceof ValidateException) {
5888
return app('json')->fail($e->getMessage());
5989
} else {
6090
return app('json')->fail('很抱歉!系统开小差了', Env::get('app_debug', false) ? [

crmeb/app/api/controller/v1/order/OtherOrderController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function create(Request $request)
150150
return app('json')->status('pay_error', $pay);
151151
}
152152
case PayServices::ALIAPY_PAY:
153-
if (!$quitUrl && $from != 'routine') {
153+
if (!$quitUrl && $from != 'routine' && !request()->isApp()) {
154154
return app('json')->status('pay_error', '请传入支付宝支付回调URL', $info);
155155
}
156156
//支付金额为0

crmeb/app/api/controller/v1/user/UserExtractController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ public function cash(Request $request)
7272
} else if ($extractInfo['extract_type'] == 'bank') {
7373
if (!$extractInfo['cardnum']) return app('json')->fail('请输入银行卡账号');
7474
if (!$extractInfo['bankname']) return app('json')->fail('请输入开户行信息');
75-
} else if ($extractInfo['extract_type'] == 'weixin') {
76-
if (!$extractInfo['weixin']) return app('json')->fail('请输入微信账号');
7775
}
7876
$uid = (int)$request->uid();
7977
if ($this->services->cash($uid, $extractInfo))

crmeb/app/dao/product/product/StoreProductDao.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public function getRecommendProduct(array $where, string $field, int $num = 0, i
223223
->when($limit, function ($query) use ($limit) {
224224
$query->limit($limit);
225225
})
226-
->order('sort DESC, id DESC')->select()->toArray();
226+
->order(($field == 'is_hot' ? 'sales DESC' : 'sort DESC') . ', id DESC')->select()->toArray();
227227

228228
}
229229

crmeb/app/event.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'listen' => [
2020
'AppInit' => [],
2121
'HttpRun' => [],
22-
'HttpEnd' => [],
22+
'HttpEnd' => [\app\listener\http\HttpEnd::class], //HTTP请求结束回调事件
2323
'LogLevel' => [],
2424
'LogWrite' => [],
2525
'StoreProductOrderDeliveryAfter' => [], // OrderSubscribe 送货 发送模板消息 admin模块 order.StoreOrder控制器/order.combinationOrder控制器
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
// +----------------------------------------------------------------------
3+
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
4+
// +----------------------------------------------------------------------
5+
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
6+
// +----------------------------------------------------------------------
7+
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
8+
// +----------------------------------------------------------------------
9+
// | Author: CRMEB Team <[email protected]>
10+
// +----------------------------------------------------------------------
11+
12+
namespace app\http\middleware;
13+
14+
15+
use app\Request;
16+
use crmeb\interfaces\MiddlewareInterface;
17+
18+
/**
19+
* Class BaseMiddleware
20+
* @package app\api\middleware
21+
*/
22+
class BaseMiddleware implements MiddlewareInterface
23+
{
24+
public function handle(Request $request, \Closure $next, bool $force = true)
25+
{
26+
if (!Request::hasMacro('uid')) {
27+
Request::macro('uid', function(){ return 0; });
28+
}
29+
if (!Request::hasMacro('adminId')) {
30+
Request::macro('adminId', function(){ return 0; });
31+
}
32+
if (!Request::hasMacro('kefuId')) {
33+
Request::macro('kefuId', function(){ return 0; });
34+
}
35+
36+
return $next($request);
37+
}
38+
}

crmeb/app/kefuapi/KefuApiExceptionHandle.php

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,64 @@
1212
namespace app\kefuapi;
1313

1414

15+
use crmeb\exceptions\AdminException;
16+
use crmeb\exceptions\ApiException;
1517
use crmeb\exceptions\AuthException;
18+
use think\db\exception\DbException;
1619
use think\exception\Handle;
1720
use think\exception\ValidateException;
1821
use think\facade\Config;
22+
use think\facade\Log;
1923
use think\Response;
2024
use Throwable;
2125

2226
class KefuApiExceptionHandle extends Handle
2327
{
28+
/**
29+
* 不需要记录信息(日志)的异常类列表
30+
* @var array
31+
*/
32+
protected $ignoreReport = [
33+
ValidateException::class,
34+
AuthException::class,
35+
AdminException::class,
36+
ApiException::class,
37+
];
38+
2439
/**
2540
* 记录异常信息(包括日志或者其它方式记录)
26-
*
2741
* @access public
2842
* @param Throwable $exception
2943
* @return void
3044
*/
3145
public function report(Throwable $exception): void
3246
{
33-
// 使用内置的方式记录异常日志
34-
parent::report($exception);
47+
if (!$this->isIgnoreReport($exception)) {
48+
$data = [
49+
'file' => $exception->getFile(),
50+
'line' => $exception->getLine(),
51+
'message' => $this->getMessage($exception),
52+
'code' => $this->getCode($exception),
53+
];
54+
55+
//日志内容
56+
$log = [
57+
request()->kefuId(), //客服ID
58+
request()->ip(), //客户ip
59+
ceil(msectime() - (request()->time(true) * 1000)), //耗时(毫秒)
60+
request()->rule()->getMethod(), //请求类型
61+
str_replace("/", "", request()->rootUrl()), //应用
62+
request()->baseUrl(), //路由
63+
json_encode(request()->param(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //请求参数
64+
json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //报错数据
65+
66+
];
67+
Log::write(implode("|", $log), "error");
68+
}
3569
}
3670

3771
/**
3872
* Render an exception into an HTTP response.
39-
*
4073
* @access public
4174
* @param \think\Request $request
4275
* @param Throwable $e
@@ -54,7 +87,7 @@ public function render($request, Throwable $e): Response
5487
if ($e instanceof DbException) {
5588
return app('json')->fail('数据获取失败', $massageData);
5689
} elseif ($e instanceof ValidateException || $e instanceof AuthException) {
57-
return app('json')->make($e->getCode() ?: 400, $e->getMessage());
90+
return app('json')->make($e->getCode() ? : 400, $e->getMessage());
5891
} else {
5992
return app('json')->code(200)->make(400, $e->getMessage(), $massageData);
6093
}

0 commit comments

Comments
 (0)