Skip to content

Commit

Permalink
更新前端文件
Browse files Browse the repository at this point in the history
  • Loading branch information
evoxwht committed Apr 9, 2022
1 parent b8b8514 commit bfec09d
Show file tree
Hide file tree
Showing 935 changed files with 2,400 additions and 2,163 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/.git
/.idea
/crmeb/.constant
/crmeb/runtime
/crmeb/public/uploads
*.log
/crmeb/public/install/install.lock
/crmeb/.env
/crmeb/timer.pid
/crmeb/workerman.pid
/docker-compose/mysql/data/
/docker-compose/mysql/log/
/docker-compose/nginx/log/
6 changes: 3 additions & 3 deletions crmeb/LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
5、如果您未能遵守本协议的条款,您的授权将被终止,所被许可的权利将被收回,并承担相应法律责任。

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

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

CRMEB官方网站:http://www.crmeb.com
CRMEB演示站:http://demo.crmeb.com
-----------------------------------------------------
运营团队: 众邦科技
电 话: 400-8888-794
邮 箱: [email protected]
网 址: http://www.xazbkj.com
网 址: http://www.xazbkj.com
41 changes: 35 additions & 6 deletions crmeb/app/adminapi/AdminApiExceptionHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,61 @@
use crmeb\exceptions\AdminException;
use crmeb\exceptions\ApiException;
use crmeb\exceptions\AuthException;
use think\exception\DbException;
use think\db\exception\DbException;
use think\exception\Handle;
use think\exception\ValidateException;
use think\facade\Env;
use think\facade\Log;
use think\Response;
use Throwable;

class AdminApiExceptionHandle extends Handle
{
/**
* 不需要记录信息(日志)的异常类列表
* @var array
*/
protected $ignoreReport = [
ValidateException::class,
AuthException::class,
AdminException::class,
ApiException::class,
];

/**
* 记录异常信息(包括日志或者其它方式记录)
*
* @access public
* @param Throwable $exception
* @return void
*/
public function report(Throwable $exception): void
{
// 使用内置的方式记录异常日志
parent::report($exception);
if (!$this->isIgnoreReport($exception)) {
$data = [
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'message' => $this->getMessage($exception),
'code' => $this->getCode($exception),
];

//日志内容
$log = [
request()->adminId(), //管理员ID
request()->ip(), //客户ip
ceil(msectime() - (request()->time(true) * 1000)), //耗时(毫秒)
request()->rule()->getMethod(), //请求类型
str_replace("/", "", request()->rootUrl()), //应用
request()->baseUrl(), //路由
json_encode(request()->param(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //请求参数
json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //报错数据

];
Log::write(implode("|", $log), "error");
}
}

/**
* Render an exception into an HTTP response.
*
* @access public
* @param \think\Request $request
* @param Throwable $e
Expand All @@ -58,7 +87,7 @@ public function render($request, Throwable $e): Response
if ($e instanceof DbException) {
return app('json')->fail('数据获取失败', $massageData);
} elseif ($e instanceof AuthException || $e instanceof ValidateException || $e instanceof ApiException) {
return app('json')->make($e->getCode() ?: 400, $e->getMessage());
return app('json')->make($e->getCode() ? : 400, $e->getMessage());
} elseif ($e instanceof AdminException) {
return app('json')->fail($e->getMessage(), $massageData);
} else {
Expand Down
42 changes: 36 additions & 6 deletions crmeb/app/api/ApiExceptionHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,64 @@
namespace app\api;


use crmeb\exceptions\AdminException;
use crmeb\exceptions\ApiException;
use crmeb\exceptions\AuthException;
use think\exception\DbException;
use think\db\exception\DbException;
use think\exception\Handle;
use think\facade\Env;
use think\facade\Log;
use think\Response;
use Throwable;
use think\exception\ValidateException;

class ApiExceptionHandle extends Handle
{
/**
* 不需要记录信息(日志)的异常类列表
* @var array
*/
protected $ignoreReport = [
ValidateException::class,
AuthException::class,
AdminException::class,
ApiException::class,
];

/**
* 记录异常信息(包括日志或者其它方式记录)
*
* @access public
* @param Throwable $exception
* @return void
*/
public function report(Throwable $exception): void
{
// 使用内置的方式记录异常日志
parent::report($exception);
if (!$this->isIgnoreReport($exception)) {
$data = [
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'message' => $this->getMessage($exception),
'code' => $this->getCode($exception),
];

//日志内容
$log = [
request()->uid(), //用户ID
request()->ip(), //客户ip
ceil(msectime() - (request()->time(true) * 1000)), //耗时(毫秒)
request()->rule()->getMethod(), //请求类型
str_replace("/", "", request()->rootUrl()), //应用
request()->baseUrl(), //路由
json_encode(request()->param(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //请求参数
json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //报错数据

];
Log::write(implode("|", $log), "error");
}
}

/**
* Render an exception into an HTTP response.
*
* @access public
* @param \think\Request $request
* @param Throwable $e
Expand All @@ -54,7 +84,7 @@ public function render($request, Throwable $e): Response
'message' => $e->getMessage(),
'line' => $e->getLine(),
]);
} else if ($e instanceof AuthException || $e instanceof ApiException || $e instanceof ValidateException) {
} elseif ($e instanceof AuthException || $e instanceof ApiException || $e instanceof ValidateException) {
return app('json')->fail($e->getMessage());
} else {
return app('json')->fail('很抱歉!系统开小差了', Env::get('app_debug', false) ? [
Expand Down
2 changes: 1 addition & 1 deletion crmeb/app/api/controller/v1/order/OtherOrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function create(Request $request)
return app('json')->status('pay_error', $pay);
}
case PayServices::ALIAPY_PAY:
if (!$quitUrl && $from != 'routine') {
if (!$quitUrl && $from != 'routine' && !request()->isApp()) {
return app('json')->status('pay_error', '请传入支付宝支付回调URL', $info);
}
//支付金额为0
Expand Down
2 changes: 0 additions & 2 deletions crmeb/app/api/controller/v1/user/UserExtractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ public function cash(Request $request)
} else if ($extractInfo['extract_type'] == 'bank') {
if (!$extractInfo['cardnum']) return app('json')->fail('请输入银行卡账号');
if (!$extractInfo['bankname']) return app('json')->fail('请输入开户行信息');
} else if ($extractInfo['extract_type'] == 'weixin') {
if (!$extractInfo['weixin']) return app('json')->fail('请输入微信账号');
}
$uid = (int)$request->uid();
if ($this->services->cash($uid, $extractInfo))
Expand Down
2 changes: 1 addition & 1 deletion crmeb/app/dao/product/product/StoreProductDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function getRecommendProduct(array $where, string $field, int $num = 0, i
->when($limit, function ($query) use ($limit) {
$query->limit($limit);
})
->order('sort DESC, id DESC')->select()->toArray();
->order(($field == 'is_hot' ? 'sales DESC' : 'sort DESC') . ', id DESC')->select()->toArray();

}

Expand Down
2 changes: 1 addition & 1 deletion crmeb/app/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'listen' => [
'AppInit' => [],
'HttpRun' => [],
'HttpEnd' => [],
'HttpEnd' => [\app\listener\http\HttpEnd::class], //HTTP请求结束回调事件
'LogLevel' => [],
'LogWrite' => [],
'StoreProductOrderDeliveryAfter' => [], // OrderSubscribe 送货 发送模板消息 admin模块 order.StoreOrder控制器/order.combinationOrder控制器
Expand Down
38 changes: 38 additions & 0 deletions crmeb/app/http/middleware/BaseMiddleware.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <[email protected]>
// +----------------------------------------------------------------------

namespace app\http\middleware;


use app\Request;
use crmeb\interfaces\MiddlewareInterface;

/**
* Class BaseMiddleware
* @package app\api\middleware
*/
class BaseMiddleware implements MiddlewareInterface
{
public function handle(Request $request, \Closure $next, bool $force = true)
{
if (!Request::hasMacro('uid')) {
Request::macro('uid', function(){ return 0; });
}
if (!Request::hasMacro('adminId')) {
Request::macro('adminId', function(){ return 0; });
}
if (!Request::hasMacro('kefuId')) {
Request::macro('kefuId', function(){ return 0; });
}

return $next($request);
}
}
43 changes: 38 additions & 5 deletions crmeb/app/kefuapi/KefuApiExceptionHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,64 @@
namespace app\kefuapi;


use crmeb\exceptions\AdminException;
use crmeb\exceptions\ApiException;
use crmeb\exceptions\AuthException;
use think\db\exception\DbException;
use think\exception\Handle;
use think\exception\ValidateException;
use think\facade\Config;
use think\facade\Log;
use think\Response;
use Throwable;

class KefuApiExceptionHandle extends Handle
{
/**
* 不需要记录信息(日志)的异常类列表
* @var array
*/
protected $ignoreReport = [
ValidateException::class,
AuthException::class,
AdminException::class,
ApiException::class,
];

/**
* 记录异常信息(包括日志或者其它方式记录)
*
* @access public
* @param Throwable $exception
* @return void
*/
public function report(Throwable $exception): void
{
// 使用内置的方式记录异常日志
parent::report($exception);
if (!$this->isIgnoreReport($exception)) {
$data = [
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'message' => $this->getMessage($exception),
'code' => $this->getCode($exception),
];

//日志内容
$log = [
request()->kefuId(), //客服ID
request()->ip(), //客户ip
ceil(msectime() - (request()->time(true) * 1000)), //耗时(毫秒)
request()->rule()->getMethod(), //请求类型
str_replace("/", "", request()->rootUrl()), //应用
request()->baseUrl(), //路由
json_encode(request()->param(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //请求参数
json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), //报错数据

];
Log::write(implode("|", $log), "error");
}
}

/**
* Render an exception into an HTTP response.
*
* @access public
* @param \think\Request $request
* @param Throwable $e
Expand All @@ -54,7 +87,7 @@ public function render($request, Throwable $e): Response
if ($e instanceof DbException) {
return app('json')->fail('数据获取失败', $massageData);
} elseif ($e instanceof ValidateException || $e instanceof AuthException) {
return app('json')->make($e->getCode() ?: 400, $e->getMessage());
return app('json')->make($e->getCode() ? : 400, $e->getMessage());
} else {
return app('json')->code(200)->make(400, $e->getMessage(), $massageData);
}
Expand Down
Loading

0 comments on commit bfec09d

Please sign in to comment.