Commit 130b5f67 by 杨树贤

初始化项目

parent 9f2dea45
Showing with 4794 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

.DS_Store
/node_modules
/public/hot
/public/storage
/storage/*.key
/storage/logs/*
/storage/framework/*
/.env.backup
/.phpunit.result.cache
/Homestead.json
/Homestead.yaml
/npm-debug.log
/yarn-error.log
/.idea
.env
vendor/_laravel_idea/
/.env
/vendor/_laravel_idea
/storage/clockwork/.gitignore
/*.jsbeautifyrc
/.vscode/extensions.json
/.vscode/settings.json
/.vscode
/*.env
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
<IfModule deflate_module>
# ??js,html,xml,css,??????????Gzip???
AddOutputFilterByType DEFLATE application/x-javascript text/html text/plain text/xml text/css
</IfModule>
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[OP.GG](https://op.gg)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
<?php
namespace App\Casts;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
class DateTime implements CastsAttributes
{
/**
* 将取出的数据进行转换
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $key
* @param mixed $value
* @param array $attributes
* @return array
*/
public function get($model, $key, $value, $attributes)
{
if (empty($attributes[$key])){
return "";
}
return date("Y-m-d H:i:s",$attributes[$key]);
}
/**
* 转换成将要进行存储的值
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $key
* @param array $value
* @param array $attributes
* @return string
*/
public function set($model, $key, $value, $attributes)
{
return json_encode($value);
}
}
<?php
namespace App\Console;
use App\Console\Commands\IndexStatistic;
use App\Console\Commands\PriceWarning;
use App\Console\Commands\SetDefaultSalePriceGroup;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
// PriceWarning::class,
SetDefaultSalePriceGroup::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
}
}
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Throwable
*/
public function report(Throwable $exception)
{
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
}
<?php
namespace App\Exceptions;
use App\Http\ApiHelper\Response;
use Illuminate\Http\Request;
/*
* 系统内部错误
* 数据库错误
*
*/
class InternalException extends \Exception
{
public function __construct($message = "", $code = 200)
{
parent::__construct($message, $code);
}
public function render(Request $request)
{
return response()->json(json_decode(Response::setError($this->message), true));
}
}
<?php
namespace App\Exceptions;
use App\Http\ApiHelper\Response;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
/*
*无效请求异常
*/
class InvalidRequestException extends \Exception
{
public function __construct($message = "", $code = 200)
{
parent::__construct($message, $code);
}
public function render(Request $request)
{
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$path_info = parse_url($request_uri);
$err_info = [
'domain' => isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '',
'interface' => isset($path_info) ? $path_info['path'] : '',
'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '',
'ip' => request()->getClientIp(),
'time' => time(),
'other' => '',
'request_params' => $_REQUEST,
'msg' => $this->getMessage(),
"code" => $this->getCode(),
];
Log::error(json_encode($err_info, JSON_UNESCAPED_UNICODE));
return response()->json(json_decode(Response::setError($this->message), true));
}
}
<?php
namespace App\Http\ApiHelper;
interface ApiCode
{
const API_CODE_SUCCESS = 0;//接口请求正常
const API_CODE_ERROR = 1;//接口请求异常 可预测失败
const API_CODE_NEED_LOGIN = 101; //需要登录
const API_CODE_LOGIN_ERROR = 102; // 登录信息错误
const API_CODE_MOBILE_NOTFOUND_ERROR = 103; // 手机号不存在
const API_CODE_PASSWD_NOTFOUND_ERROR = 104; // 密码错误
const API_CODE_USER_DISABLE_ERROR = 105; // 账号被封禁
}
<?php
/**
* Created by PhpStorm.
* User: duwenjun
* Date: 2021/8/11
* Time: 2:52 PM
*/
namespace App\Http\ApiHelper;
class Response
{
public static function setError($errMsg, $errCode = ApiCode::API_CODE_ERROR, $data = [])
{
return json_encode(['code' => $errCode, 'msg' => $errMsg, 'data' => $data],
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
public static function setSuccess($data, $code = ApiCode::API_CODE_SUCCESS, $msg = "")
{
return json_encode(['code' => $code, 'msg' => $msg, 'data' => $data],
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
}
\ No newline at end of file
<?php
namespace App\Http\Caches;
use \Illuminate\Support\Facades\Redis;
// 税率cache
class RateCache
{
const _KEY_RATE = 'erp_rate'; // hash 结构,一个用户一个key
private $redis;
public function __construct(string $default_instance = 'frq')
{
if ($default_instance) {
$this->redis = Redis::connection($default_instance);
} else {
$this->redis = Redis::connection();
}
}
public function getRate($k = "美元")
{
return $this->redis->hget(self::_KEY_RATE, $k);
}
public function getRateInfo()
{
return $this->redis->hgetall(self::_KEY_RATE);
}
}
\ No newline at end of file
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
class BaseApiController extends Controller
{
}
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Services\ActionLogService;
use App\Http\Services\CmsUserService;
use Illuminate\Http\Request;
class IndexController extends Controller
{
}
<?php
namespace App\Http\Controllers;
use Facade\FlareClient\Api;
use Illuminate\Http\Request;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use App\Http\ApiHelper\ApiCode;
use Illuminate\Support\Facades\Log;
class Controller extends BaseController implements ApiCode
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function user()
{
return request()->user;
}
public function setSuccessData($data = [], $count = 0, $code = ApiCode::API_CODE_SUCCESS, $msg = 'ok')
{
$res_data = [
"code" => $code,
"data" => $data,
];
if ($msg) {
$res_data['msg'] = $msg;
}
if ($count) {
$res_data['count'] = $count;
}
return response()->json($res_data);
}
public function setSuccess($msg = '操作成功', $code = ApiCode::API_CODE_SUCCESS, $data = [])
{
$res_data = [
"code" => $code,
"msg" => $msg,
'data' => (object)$data,
];
return response()->json($res_data);
}
public function setError($msg, $code = ApiCode::API_CODE_ERROR, $data = [])
{
$res_data = [
"code" => $code,
"msg" => $msg,
];
if ($data) {
$res_data['data'] = $data;
}
$this->logErr($msg, $code = ApiCode::API_CODE_ERROR, $data = null);
return response()->json($res_data);
}
private function logErr($msg, $code = ApiCode::API_CODE_ERROR, $data = null)
{
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$path_info = parse_url($request_uri);
$err_info = [
'domain' => isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '',
'interface' => isset($path_info) ? $path_info['path'] : '',
'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '',
'ip' => request()->getClientIp(),
'time' => time(),
'other' => '',
'request_params' => $_REQUEST,
'msg' => $msg,
"code" => $code,
"data" => $data
];
Log::error(json_encode($err_info, JSON_UNESCAPED_UNICODE));
}
}
<?php
namespace App\Http\Controllers;
use App\Http\Services\MenuService;
use Illuminate\Http\Request;
class HomeController extends Controller
{
public function home(Request $request)
{
$statistics = [];
return view('home.home', ['statistics' => $statistics]);
}
}
<?php
namespace App\Http\Controllers;
use App\Http\Services\MenuService;
use Illuminate\Http\Request;
class IndexController extends Controller
{
public function index(Request $request)
{
return 'Hello';
//$menu_list = MenuService::getMenu();
//return view('index', ['menu_list' => $menu_list]);
}
}
<?php
namespace App\Http\IdSender;
use App\Exceptions\InvalidRequestException;
use App\Http\Models\SnConfigModel;
class IdSender
{
const TYPE_CUBE_CHANNELDISCOUNT = 'CUBE_CHANNELDISCOUNT'; // 魔方渠道折扣编码
const TYPE_CUBE_GOODSSALEPRICEGROUP = 'CUBE_GOODS_PRICE'; // 商品售价组
const TYPE_ORG_ICHUNT = 1; // 采购组织-深圳市猎芯科技有限公司
const TYPE_ORG_SHENMAO = 2; // 采购组织-深贸电子有限公司
const TYPE_LANG_CN = 1; // 合同语言类型 中文
const TYPE_LANG_EN = 2; // 合同语言类型 英文
// 统一sn生成器,生成sn
public static function getSn($type = self::TYPE_CUBE_CHANNELDISCOUNT, $org = self::TYPE_ORG_ICHUNT)
{
$sn = '';
switch ($type) {
case self::TYPE_CUBE_CHANNELDISCOUNT:
case self::TYPE_CUBE_GOODSSALEPRICEGROUP:
$sn = self::getCommonSn($type, $org);
break;
default:
}
return $sn;
}
// 获取公共sn
private static function getCommonSn($type)
{
$sn_config = self::getSnConfig($type);
return $sn_config["prefix"] . "-" . self::getDate2() . self::getFilledId($sn_config);
}
// 当前日期
private static function getDate()
{
return date("Ymd");
}
// 当前日期
private static function getDate2()
{
return substr(date("Ymd"),2);
}
// 当日流水号id
private static function getFilledId($sn_config)
{
$current_date = date("Y-m-d");
if ($sn_config['current_date'] != $current_date) {
$sn_config['number_next'] = 1;
}
if (strlen($sn_config['number_next']) > $sn_config['padding']) {
$filled_id = $sn_config['number_next'];
} else {
$filled_id = str_pad($sn_config['number_next'], $sn_config['padding'], "0", STR_PAD_LEFT);
}
// 更新next_id
$update_sn_config = [
"current_date" => $current_date,
"number_next" => (int)($sn_config['number_next'] + $sn_config['number_increment'])
];
SnConfigModel::updateById($update_sn_config, $sn_config['id']);
return $filled_id;
}
// 获取sn配置信息
private static function getSnConfig($type)
{
$sn_config = SnConfigModel::getSnConfigByCode($type);
if (empty($sn_config)) {
throw new InvalidRequestException("sn_config is not config.");
}
return $sn_config;
}
}
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Foundation\Http\Middleware\TrimStrings;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\XhProf::class, // 接口性能分析中间件
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
// \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\Monitor::class
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\WebAuthenticate::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\Permission::class,
],
'api' => [
// 'throttle:60,1',
\App\Http\Middleware\ApiAuthenticate::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\TrimStrings::class,
\App\Http\Middleware\Permission::class,
],
'sync' => [
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
// 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'monitor' => \App\Http\Middleware\Monitor::class,
];
}
<?php
namespace App\Http\Middleware;
use App\Http\ApiHelper\Response;
use Illuminate\Support\Facades\Config;
use Closure;
use Illuminate\Support\Facades\Log;
class ApiAuthenticate
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$source = $request->header("source"); //来源端:内部后台:pc 芯链系统:yunxin App: app 小程序:h5_app
$userId = $skey = null;
if ($source == 'pc') {
$userId = $request->header('oa-user-id');
$skey = $request->header('oa-skey');
} else {
if ($request->cookie()) {
$userId = $request->cookie('oa_user_id');
$skey = $request->cookie('oa_skey');
}
}
if (empty($userId) || empty($skey)) {
return $this->redirectTo($request);
}
$login = config::get('website.login');
if (!$userId || !$skey || (string)((int)$userId) != $userId || !preg_match('/^[a-zA-Z0-9]+$/', $skey)) {
return $this->redirectTo($request);
}
$cookie = 'oa_user_id=' . $userId . '; oa_skey=' . $skey;
$client = new \GuzzleHttp\Client();
$rsp = $client->request('GET', $login['check'], [
'headers' => ['Cookie' => $cookie],
'connect_timeout' => 5,
'timeout' => 10,
'verify' => false,
]);
if ($rsp->getStatusCode() != 200) {
Log::error("login error");
abort(500);
}
$ret = json_decode($rsp->getBody());
if ($ret->retcode != 0) {
return $this->redirectTo($request);
}
$user = $ret->data;
$user->header = $request->cookie('oa_header');
$request->user = $user;
$request->attributes->add(['user' => $user]);
if (empty($user)) {
return $this->redirectTo($request);
}
return $next($request);
}
protected function redirectTo($request)
{
return Response::setError("need login..");
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
class CheckForMaintenanceMode extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use Error;
use Closure;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Psy\Exception\ErrorException;
class Monitor
{
/**
* The App container
*
* @var Container
*/
protected $container;
/**
* The Monitor Client
*
* @var
*/
protected $monitor;
/**
* Create a new middleware instance.
*
* @param Container $container
*/
public function __construct(Container $container)
{
$this->container = $container;
}
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// dump("monitorDing");
$enabled = config('monitorDing.enabled');
try {
$response = $next($request);
} catch (Exception $e) {
$response = $this->handleException($request, $e);
$enabled && $this->sendText(sprintf("文件:%s (%s 行) 内容:%s", $e->getFile(), $e->getLine(), $e->getMessage()));
} catch (Error $error) {
$e = new FatalThrowableError($error);
$response = $this->handleException($request, $e);
$enabled && $this->sendText(sprintf("文件:%s (%s 行) 内容:%s", $e->getFile(), $e->getLine(), $e->getMessage()));
} catch (ErrorException $error) {
$e = new FatalThrowableError($error);
$response = $this->handleException($request, $e);
$enabled && $this->sendText(sprintf("文件:%s (%s 行) 内容:%s", $e->getFile(), $e->getLine(), $e->getMessage()));
} finally {
if ($response->getStatusCode() == '500' && (isset($response->exception) && $response->exception && $response->exception !== null)) {
$sysName = config('monitorDing.web_name');
if (strpos($_SERVER['HTTP_HOST'], 'liexin') !== false) {
$sysName = '本地' . $sysName;
} else {
$sysName = '外网' . $sysName;
}
$this->sendText(substr($sysName . ":" . $response->exception, 0,
500) . ',请求数据:' . json_encode($request->input()) . "---[更多详情请看日志]");
}
}
return $response;
}
/**
* Handle the given exception.
*
* (Copy from Illuminate\Routing\Pipeline by Taylor Otwell)
*
* @param $passable
* @param Exception $e
* @return mixed
* @throws Exception
*/
protected function handleException($passable, Exception $e)
{
if (!$this->container->bound(ExceptionHandler::class) || !$passable instanceof Request) {
throw $e;
}
$handler = $this->container->make(ExceptionHandler::class);
$handler->report($e);
return $handler->render($passable, $e);
}
/**
* 发送文本类型的消息
*
* @param $content string 消息内容
* @param array $atMobiles 被@人的手机号
* @param bool $isAtAll 是否 @ 所有人
* @throws SendErrorException
*/
public function sendText($content, $atMobiles = [], $isAtAll = false)
{
$params = [
'msgtype' => 'text',
'text' => [
'content' => $content,
],
'at' => [
'atMobiles' => $atMobiles,
'isAtAll' => $isAtAll
]
];
$this->send($params);
}
/**
* 发送
* @param array $params 请求需要的参数
* @throws SendErrorException
*/
private function send($params = [])
{
if (!config('monitorDing.enabled')) {
\Log::info('~~ Monitor Ding ~~');
\Log::info($params);
} else {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, config("monitorDing.webhook"));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json;charset=utf-8'));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if (config()) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
}
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($data['errcode']) {
// throw new SendErrorException($data['errmsg']);
}
}
}
}
<?php
namespace App\Http\Middleware;
use App\Http\ApiHelper\Response;
use App\Http\Services\PermService;
use Closure;
class Permission
{
public function handle($request, Closure $next)
{
// 如果是admin账号,那么跳过检验权限
$user = request()->user;
$userId = $user->userId;
$email = $user->email;
$roles = PermService::getUserRoles($userId, $email);
if (PermService::hasRole(PermService::ROLE_ADMIN, $roles)) {
return $next($request);
}
$url = $request->url();
$url_info = parse_url($url);
if (isset($url_info['path'])) {
$path_arr = explode("/", $url_info['path']);
$path_arr = array_filter($path_arr);
$path_arr = array_values($path_arr);
$perm_id = implode("_", $path_arr);
if (in_array($perm_id, config('perm_args.ignore_check'))) {
return $next($request);
}
$res = PermService::hasPerm($perm_id);
if (!$res) {
if ($path_arr && isset($path_arr[0]) && ($path_arr[0] == 'api')) {
return Response::setError("没有访问权限");
} else {
return response("没有访问权限");
}
}
}
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
return $next($request);
}
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
<?php
namespace App\Http\Middleware;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}
<?php
namespace App\Http\Middleware;
use Illuminate\Support\Facades\Config;
use Closure;
use Illuminate\Support\Facades\Log;
class WebAuthenticate
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$userId = $request->cookie('oa_user_id');
$skey = $request->cookie('oa_skey');
$login = Config::get('website.login');
if (!$userId || !$skey || (string)((int)$userId) != $userId || !preg_match('/^[a-zA-Z0-9]+$/', $skey)) {
return $this->redirectTo($request);
}
$cookie = 'oa_user_id=' . $userId . '; oa_skey=' . $skey;
$client = new \GuzzleHttp\Client();
$rsp = $client->request('GET', $login['check'], [
'headers' => ['Cookie' => $cookie],
'connect_timeout' => 5,
'timeout' => 10,
'verify' => false,
]);
if ($rsp->getStatusCode() != 200) {
Log::error("login error");
abort(500);
}
$ret = json_decode($rsp->getBody());
if ($ret->retcode != 0) {
return $this->redirectTo($request);
}
$user = $ret->data;
$user->header = $request->cookie('oa_header');
$request->user = $user;
$request->attributes->add(['user' => $user]);
return $next($request);
}
protected function redirectTo($request)
{
$login = Config::get('website.login');
if (! $request->expectsJson()) {
return redirect($login['login'] . '?redirect=' . urlencode($request->url()));
}
}
}
<?php
namespace App\Http\Middleware;
use Closure;
class XhProf
{
public function handle($request, Closure $next)
{
$app_config = get_resource_config_section('app', 'crm');
$open_xhprof = isset($app_config['open_xhprof']) ? $app_config['open_xhprof'] : 0;
if ($open_xhprof && function_exists('xhprof_enable')) {
list($usec, $sec) = explode(" ", microtime());
$startTime = (float)$sec + (float)$usec; // 程序开始时间
xhprof_enable(XHPROF_FLAGS_NO_BUILTINS | XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY, []);
$response = $next($request);
if (function_exists('xhprof_disable')) {
list($usec, $sec) = explode(" ", microtime());
$endTime = (float)$sec + (float)$usec;
$data = xhprof_disable();
$excl_wall_time = isset($app_config['xhprof_excl_wall_time']) ? $app_config['xhprof_excl_wall_time'] : 0.5;
if (($endTime - $startTime) > $excl_wall_time) {
file_put_contents(sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid() . ".crm" . str_replace('/',
"-", $request->path()) . '.xhprof', serialize($data));
}
}
return $response;
} else {
return $next($request);
}
}
}
<?php
namespace App\Http\Queue;
use Monolog\Formatter\LineFormatter;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
class RabbitQueueModel
{
private $connection;
const DEFAULT_QUEUE = 'lie_queue_pur';
const QUEUE_DGK_SYNC_ORDER = 'lie_queue_dgk_sync_order';
const QUEUE_ORDER = 'lie_queue_order';
const QUEUE_ERP = 'lie_queue_erp';
const FORWARD_TYPE_HTTP = "http";
const FORWARD_TYPE_SOAP = "soap";
public function __construct(string $connect_name = '')
{
if ($connect_name) {
$config = Config('rabbitmq.connections.' . $connect_name);
} else {
$default_connect_name = Config('rabbitmq.default');
$config = Config('rabbitmq.connections.' . $default_connect_name);
}
try {
// 创建rabbitmq链接
$this->connection = new AMQPStreamConnection(
$config['host'], $config['port'], $config['login'], $config['password'], $config['vhost']
);
} catch (\Exception $e) {
$this->connection = null;
$err_json = json_encode([
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'code' => $e->getCode()
]);
(new Logger('queue'))->pushHandler(new StreamHandler(storage_path('logs/queue.log')))->info($err_json);
}
}
// 队列推送
public function insertQueue(
$route_key,
$queue_data,
$queue_name = self::DEFAULT_QUEUE,
$forward_type = self::FORWARD_TYPE_HTTP
) {
try {
$queue_message = [];
$queue_message["__route_key"] = $route_key;
$queue_message['__insert_time'] = time();
$queue_message['__from'] = $this->getFromUrl() ? $this->getFromUrl() : gethostname();
$queue_message['__uk'] = (string)self::_calc_uniqid($queue_message);
$queue_message['__type'] = $forward_type;
$queue_message['__search_key'] = isset($queue_data['__search_key']) ? $queue_data['__search_key'] : $route_key;
$queue_message['__trace_id'] = '';
$queue_message['data'] = $queue_data;
if ($this->connection) {
$message = new AMQPMessage(json_encode($queue_message, JSON_UNESCAPED_UNICODE));
$channel = $this->connection->channel();
$channel->queue_declare($queue_name, false, true, false, false);
$channel->basic_publish($message, '', $queue_name); // 推送消息
$channel->close();
$this->log("queue_insert", $queue_message, $queue_name);
} else {
throw new \Exception("rabbit connection is faild");
}
} catch (\Exception $e) {
$this->log("queue_insert_error", $queue_message, $queue_name);
return false;
}
return true;
}
public function getConnection()
{
return $this->connection;
}
private function getFromUrl()
{
$domain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
$request_url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$from_url = '';
if ($domain && $request_url) {
$from_url = $domain . $request_url;
}
return $from_url;
}
private function _calc_uniqid($params)
{
return crc32(json_encode($params) . time());
}
private function log($sign, $queue_message, $queue_name = '')
{
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$log_message = $sign . "|##data:" . json_encode(['queue_name' => $queue_name, 'mq_data' => $queue_message]) . ",##" . $user_agent;
$dateFormat = "Y-m-d H:i:s";
// 最后创建一个格式化器
$formatter = new LineFormatter(null, $dateFormat);
$stream = new StreamHandler(storage_path('logs/queue.log'));
$stream->setFormatter($formatter);
(new Logger('queue'))->pushHandler($stream)->info($log_message);
}
public function __destruct()
{
if ($this->connection) {
$this->connection->close();
}
}
}
<?php
/**
* Created by PhpStorm.
* User: duwenjun
* Date: 2021/9/1
* Time: 9:40 AM
*/
namespace App\Http\Utils;
class ArrUtil
{
public static function notContainsOnlyNull($arr)
{
return !empty(array_filter($arr, function ($a) {
return $a !== null;
}));
}
// 判断数组值是否相同,如果都相同,那么最终array_unique只有一个值
public static function isSame($arr)
{
return count(array_unique($arr)) == 1;
}
}
\ No newline at end of file
<?php
namespace App\Http\Utils;
class ErrMsg
{
public static function getExceptionInfo(\Exception $exception)
{
$err_info = [
'message' => $exception->getMessage(),
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'code' => $exception->getCode()
];
return $err_info;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: duwenjun
* Date: 2022/3/9
* Time: 1:35 PM
*/
namespace App\Http\Utils;
class FileUrl
{
// private static
private static $baseDomain = null;
private static function initConfig()
{
if (is_null(self::$baseDomain)) {
self::$baseDomain = Config('website.file_domain');
}
return true;
}
private static function getBaseDomain()
{
return self::$baseDomain;
}
public static function getUrl($file_id)
{
self::initConfig();
$file_url = '';
if ($file_id) {
$file_url = self::getBaseDomain() . "/download/" . $file_id;
}
return $file_url;
}
}
\ No newline at end of file
<?php
namespace App\Http\Utils;
//日志数据构建类
use Illuminate\Support\Facades\Lang;
class LogDataGenerate
{
//获取新增日志,根据插入数据来的
//objId是主键ID
public static function getInsertLog($objId, $insertData = [])
{
$logData = '';
foreach ($insertData as $key => $item) {
if (!Lang::has('log-fields.' . $key)) {
continue;
}
$logData .= trans('log-fields.' . $key) . '为' . $item . '; ';
}
return $logData ? [
'obj_id' => $objId,
'log_data' => ['message' => '新增数据 : ' . $logData],
] : [];
}
//获取修改的日志,根据更新数据来的
public static function getUpdateLog($objId, $updateData = [], $originData = [])
{
$logData = '';
foreach ($updateData as $key => $item) {
if (!Lang::has('log-fields.' . $key)) {
continue;
}
$originItem = \Arr::get($originData, $key);
if ($originItem == $item) {
continue;
}
//单独处理币种
switch ($key) {
case 'currency':
$originItem = \Arr::get(config('field.Currency'), $originItem);
$item = \Arr::get(config('field.Currency'), $item);
}
$logData .= trans('log-fields.' . $key) . "由 ${originItem} 修改为 ${item} ;";
}
return $logData ? [
'obj_id' => $objId,
'log_data' => ['message' => '修改数据 : ' . $logData],
] : [];
}
//获取删除的日志
public static function getDeleteLog($objId, $deleteData = [])
{
$logData = '';
foreach ($deleteData as $key => $item) {
if (!Lang::has('log-fields.' . $key)) {
continue;
}
$logData .= trans('log-fields.' . $key) . '为' . $item . '; ';
}
return $logData ? [
'obj_id' => $objId,
'log_data' => ['message' => '删除数据 : ' . $logData]
] : [];
}
}
<?php
/**
* Created by PhpStorm.
* User: duwenjun
* Date: 2021/8/13
* Time: 4:44 PM
*/
namespace App\Http\Utils;
use App\Http\Models\CmsUserInfoModel;
use App\Http\Models\Order\OrderServiceItemsModel;
use App\Http\Models\PayableModel;
use App\Http\Models\PaymentItemsModel;
use App\Http\Models\PaymentModel;
use App\Http\Models\PurchaseApproveModel;
use App\Http\Models\PurchaseSeviceApproveModel;
use App\Http\Services\PriceService;
class NameConvert
{
// 获取性别
public static function getGenderName($gender)
{
$gender = "未设置";
if ($gender == CmsUserInfoModel::GENDER_TYPE_MAN) {
$gender = "男性";
}
if ($gender == CmsUserInfoModel::GENDER_TYPE_WOMAN) {
$gender = "女性";
}
return $gender;
}
// 获取间隔天数;用于计算有效期,因为有效期为有效天数+创建时间,数据库存储的有效期为时间戳,需要反向计算有效期
public static function getIntervalDay($expire_time, $create_time)
{
$interval_days = '';
if ($expire_time) {
$interval_days = ($expire_time - $create_time) / 86400;
$interval_days = ceil($interval_days);
}
return $interval_days;
}
// 获取创建时间
public static function getDateTime($create_time)
{
$date_time = '';
if ($create_time && is_numeric($create_time)) {
$date_time = date("Y-m-d H:i:s", $create_time);
}
return $date_time;
}
public static function getDate($create_time)
{
$time = '';
if ($create_time) {
$time = date("Y-m-d", $create_time);
}
return $time;
}
// 获取审核状态
public static function getApproveStatusName($a_status)
{
$status_name = '';
if ($a_status == PurchaseApproveModel::APPROVE_STATUS_PROCESS) {
$status_name = "审核中";
}
if ($a_status == PurchaseApproveModel::APPROVE_STATUS_PASS) {
$status_name = "已通过";
}
if ($a_status == PurchaseApproveModel::APPROVE_STATUS_FAIL) {
$status_name = "未通过";
}
if ($a_status == PurchaseSeviceApproveModel::APPROVE_STATUS_CANCEL) {
$status_name = "取消审核";
}
return $status_name;
}
// 获取付款申请单状态
public static function getPaymentStatusName($status)
{
$status_name = '';
$status_name_map = PaymentModel::$STATUS_NAME_MAP;
if (isset($status_name_map[$status])) {
$status_name = $status_name_map[$status];
}
return $status_name;
}
// 获取付款申请单来源类型
public static function getPaymentTypeName($payment_type)
{
$type_name = '';
if ($payment_type == PaymentModel::PAYMENT_TYPE_PUR) {
$type_name = "采购单";
}
if ($payment_type == PaymentModel::PAYMENT_TYPE_PAYABLE) {
$type_name = "应付单";
}
return $type_name;
}
// 获取付款申请单付款类型 1预付款2退预付款3采购付款4退采购付款
public static function getPaymentPayTypeName($pay_type)
{
$type_name = '';
if (isset(PaymentItemsModel::$PAY_TYPE_NAME_MAP[$pay_type])) {
$type_name = PaymentItemsModel::$PAY_TYPE_NAME_MAP[$pay_type];
}
return $type_name;
}
// 获取应付单状态
public static function getPayableStatusName($status)
{
$status_name = '';
$status_name_map = PayableModel::$STATUS_NAME_MAP;
if (isset($status_name_map[$status])) {
$status_name = $status_name_map[$status];
}
return $status_name;
}
// 获取应付单付款状态
public static function getPayablePayStatusName($status)
{
$pay_status_name = '';
$status_name_map = PayableModel::$PAY_STATUS_NAME_MAP;
if (isset($status_name_map[$status])) {
$pay_status_name = $status_name_map[$status];
}
return $pay_status_name;
}
// 获取应付单开票状态
public static function getPayableInvoiceStatusName($status)
{
$invoice_status_name = '';
$status_name_map = PayableModel::$INVOICE_STATUS_NAME_MAP;
if (isset($status_name_map[$status])) {
$invoice_status_name = $status_name_map[$status];
}
return $invoice_status_name;
}
// 获取应付单入库类型
public static function getPayableStockInTypeName($stock_in_type)
{
$stock_in_type_name = '';
$stock_in_type_name_map = PayableModel::$STOCK_IN_NAME_MAP;
if (isset($stock_in_type_name_map[$stock_in_type])) {
$stock_in_type_name = $stock_in_type_name_map[$stock_in_type];
}
return $stock_in_type_name;
}
// 获取报价货币名称,根据类型转换名称,如1=人民币
public static function getCurrencyName($currency_type)
{
$name = '';
if ($currency_type) {
$currency_map = config('field.Currency');
if ($currency_map && isset($currency_map[$currency_type])) {
$name = $currency_map[$currency_type];
}
}
return $name;
}
// 获取币种code,如 1=RMB
public static function getCurrencyCode($currency_type)
{
$name = '';
if ($currency_type) {
$currency_map = config('field.currency_code');
if ($currency_map && isset($currency_map[$currency_type])) {
$name = $currency_map[$currency_type];
}
}
return $name;
}
// 获取报价货币类型,根据名称获取类型,如 人民币=1
public static function getCurrencyType($currency_name)
{
$type = 0;
if ($currency_name) {
$currency_map = config('field.Currency');
$type = array_search($currency_name, $currency_map);
}
return $type;
}
// 售后单-申请原因
public static function getServiceApplyReasonVal($apply_reason_type)
{
$apply_reason_val = '';
if ($apply_reason_type) {
$apply_reason_map = OrderServiceItemsModel::$APPLY_REASON_MAP;
if (isset($apply_reason_map[$apply_reason_type])) {
$apply_reason_val = $apply_reason_map[$apply_reason_type];
}
}
return $apply_reason_val;
}
// 售后单-货物处理方案
public static function getServiceRefundPlanVal($refund_plan_type)
{
$refund_plan_val = '';
if ($refund_plan_type == OrderServiceItemsModel::FEFUND_PLAN_SUP) {
$refund_plan_val = "退供应商";
}
if ($refund_plan_type == OrderServiceItemsModel::FEFUND_PLAN_SELF) {
$refund_plan_val = "转自营";
}
return $refund_plan_val;
}
//这个currency可以传currency或者company_id,因为这两个的值都是类型相等的,前者为1,后者肯定也是1
public static function getFmtPrice($price, $currency, $thousands_sep = ',')
{
$price = (float)$price;
$prefix_sign = '';
if ($price < 0) {
$prefix_sign = "-";
$price = abs($price);
}
$currency_sign = ($currency == PriceService::CURRENCY_TYPE_RMB ? '¥' : '$');
return $prefix_sign . $currency_sign . (string)number_format($price, 2, '.', $thousands_sep);
}
// 获取格式化金额,不带币种符合
public static function getNoSignFmtPrice($price)
{
return (string)number_format($price, 2);
}
//这个currency可以传currency或者company_id,因为这两个的值都是类型相等的,前者为1,后者肯定也是1
public static function getSignPrice($price, $currency)
{
$price = (float)$price;
$prefix_sign = '';
if ($price < 0) {
$prefix_sign = "-";
$price = abs($price);
}
$currency_sign = ($currency == PriceService::CURRENCY_TYPE_RMB ? '¥' : '$');
return $prefix_sign . $currency_sign . (string)number_format($price, 2);
}
// 固定符号为人民币
public static function getRmbSignPrice($price)
{
$price = (float)$price;
$prefix_sign = '';
if ($price < 0) {
$prefix_sign = "-";
$price = abs($price);
}
$currency_sign = '¥';
return $prefix_sign . $currency_sign . (string)$price;
}
/**
* 将单个数字转换成中文大写
* 零、壹、贰、叁、肆、伍、陆、柒、捌、玖
* @param $num
* @author handa
* @date 2022/3/29
*/
public static function numToUpperChar($num)
{
switch ($num) {
case 0:
return '零';
case 1:
return '壹';
case 2:
return '贰';
case 3:
return '叄';
case 4:
return '肆';
case 5:
return '伍';
case 6:
return '陆';
case 7:
return '柒';
case 8:
return '捌';
case 9:
return '玖';
default:
return '';
}
}
}
<?php
namespace App\Http\Utils;
use App\Http\ApiHelper\ApiCode;
use SoapClient;
use App\Exceptions\InvalidRequestException;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
class SoapRequester
{
const SOAP_NAME_ERP = "soap_name_erp";
public static function request($soap_name, $soap_func, $request_data)
{
$request_result = [];
try {
ini_set('soap.wsdl_cache_enabled', '0');
ini_set('default_socket_timeout', 30);//设置socket超时时间
libxml_disable_entity_loader(false);
if ($soap_name == self::SOAP_NAME_ERP) {
$soapClient = new SoapClient(Config('config.erp_domain') . '/ormrpc/services/WSIchuntjKFacade?wsdl');
}
$res = $soapClient->$soap_func(json_encode($request_data));
if ($res) {
$soap_res_arr = json_decode($res, true);
if ($soap_res_arr) {
$request_result = $soap_res_arr['data'];
}
// 如果接口返回错误,记录日志
if ($soap_res_arr && ($soap_res_arr['code'] !== ApiCode::API_CODE_SUCCESS)) {
self::errLog($soap_name, $soap_func, $request_data, $res);
}
} else {
self::errLog($soap_name, $soap_func, $request_data, $res);
}
} catch (\Exception $e) {
$err_json = json_encode([
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'code' => $e->getCode()
]);
(new Logger('soap'))->pushHandler(new StreamHandler(storage_path('logs/soap.log')))->error($err_json);
self::errLog($soap_name, $soap_func, $request_data, null);
throw new InvalidRequestException('soap接口请求异常,请联系技术查看日志,错误信息:' . $e->getMessage());
}
return $request_result;
}
// 请求错误日志
private static function errLog($soap_name, $soap_func, $request_data, $res)
{
$err_json = json_encode([
'soap_name' => $soap_name,
'soap_func' => $soap_func,
'request_data' => $request_data,
'res' => $res,
]);
(new Logger('soap'))->pushHandler(new StreamHandler(storage_path('logs/soap.log')))->error($err_json);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: duwenjun
* Date: 2021/9/1
* Time: 9:40 AM
*/
namespace App\Http\Utils;
use Illuminate\Support\Facades\Validator;
class ValidatorMsg
{
// 只返回错误的第一条错误
public static function getMsg($error_list)
{
$err_msg = '';
foreach ($error_list as $err_key => $err_msgs) {
foreach ($err_msgs as $msg) {
$err_msg .= "{$err_key}|{$msg}";
break;
}
break;
}
return $err_msg;
}
public static function checkValidateParamThrowException($validateRule,$params)
{
$validator = Validator::make($params, $validateRule);
if ($validator->fails()) {
$errors = $validator->errors()->toJson(JSON_UNESCAPED_UNICODE);
throw new \InvalidArgumentException($errors);
}
return true;
}
}
<?php
namespace App\Http\Validators;
use App\Http\Models\Self\SelfClassifyModel;
use App\Http\Models\Supplier\SupplierChannelModel;
use App\Http\Services\SupplierService;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Redis;
use Validator;
class LotteryValidator
{
public function checkSave($data)
{
$validator = Validator::make($data, [
], [], $this->attributes());
if ($validator->fails()) {
return $validator->errors()->first();
}
if (empty($data['lottery_name'])) {
return '请输入抽奖活动名称';
}
if (empty($data['start_time'])) {
return '请输入活动开始时间';
}
if (empty($data['end_time'])) {
return '请输入活动结束时间';
}
if (empty($data['win_limit_per_day']) && empty($data['win_limit_in_all'])) {
return '至少要有一个限制条件';
}
if (!empty($data['qualify_get_rule_register']) && empty($data['qualify_register'])) {
return '请输入注册最多赠送抽奖资格次数';
}
if (!empty($data['qualify_get_rule_login'])) {
if (empty($data['qualify_login']) && empty($data['qualify_login_day'])) {
return '请输入登陆最多赠送抽奖资格次数 或 登陆每天赠送抽奖次数';
}
}
if (!empty($data['qualify_get_rule_share']) && empty($data['qualify_share'])) {
return '请输入分享最多赠送抽奖资格次数';
}
if (!empty($data['qualify_get_rule_order'])) {
if (empty($data['qualify_order'])) {
return '请输入下单赠送抽奖资格次数';
}
if (empty($data['activity_url'])) {
return '请输入支付成功页要跳转的抽奖地址';
}
if (empty($data['paysucimg'])) {
return '请上传支付成功活动banner图';
}
}
if ((!empty($data['show_success_banner']) && $data['show_success_banner'] == 'on') && !$data['success_banner_image']) {
return '请上传抽奖成功展示banner图';
}
return null;
}
private function attributes()
{
return [
];
}
}
<?php
namespace App\Listeners;
use Faker\Provider\DateTime;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
class QueryListener
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param QueryExecuted $event
* @return void
*/
public function handle(QueryExecuted $event)
{
try {
if (Config('app.debug') == true) {
$sql = str_replace("?", "'%s'", $event->sql);
foreach ($event->bindings as $i => $binding) {
if ($binding instanceof DateTime) {
$event->bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
} else {
if (is_string($binding)) {
$event->bindings[$i] = "'$binding'";
}
}
}
$log = vsprintf($sql, $event->bindings);
$log = $log . ' [ RunTime:' . $event->time . 'ms ] ';
$fileName = sprintf("logs/log/sql-%s.log",date("Y-m-d"));
\Log::channel("sql")->info(sprintf($log));
// (new Logger('sql'))->pushHandler(new StreamHandler(storage_path($fileName)))->info($log);
}
} catch (\Exception $exception) {
\Log::channel("sql")->info(
sprintf(
"错误:请求参数 %s,错误原因:%s",
print_r(request()->all(),true),
json_encode($exception->getMessage(),JSON_UNESCAPED_UNICODE)
)
);
// (new Logger('sql'))->pushHandler(new StreamHandler(storage_path($fileName)))->info($exception->getMessage());
}
}
}
<?php
namespace App\Presenters;
use App\Http\Services\BrandService;
use App\Http\Services\SelfBrandService;
use App\Http\Services\StandardBrandService;
class BrandNameListPresenter
{
//brandType品牌类型,1是普通联营品牌,2是自营品牌
public function render($name, $fieldText, $value = null, $brandType = 1, $option = [])
{
//因为这个组件是专门给标准品牌用的,所以可以直接去获取标准列表展示出来
$standardBrandNameList = '';
$brandTypeName = $brandType == 1 ? '专营' : '自营';
if ($value) {
if ($brandType == 1) {
$standardBrandNameList = (new BrandService())->getBrandNameListByBrandIds($value);
} else {
$standardBrandNameList = (new SelfBrandService())->getBrandNameListByBrandIds($value);
}
}
$isRequired = \Arr::get($option, 'required', false);
$requiredHtml = $isRequired ? '<span style="color: red;margin-right: 3px">*</span>' : '';
$html = <<<EOF
<label class="layui-form-label">
$requiredHtml $fieldText</label>
<div class="layui-input-block" style="width: 80%">
<input type="hidden" name="$name" value="$value" id="$name">
<div class="layui-col-md7">
<textarea rows="7" placeholder="{$brandTypeName}普通品牌(非标准品牌),多个用英文逗号隔开" class="layui-textarea" id="${name}_name_list">$standardBrandNameList</textarea>
<blockquote class="layui-elem-quote" id="valid_${name}_name_list">$standardBrandNameList</blockquote>
<span style="color: red" id="invalid_${name}_name_list"></span>
</div>
<div class="layui-col-md5">
<button type="button" class="layui-btn-sm layui-btn" id="check_and_add_${name}_name_list" style="margin-left: 10px;">验证并加入</button>
<p style="margin-top: 130px;margin-left: 10px"></p>
</div>
</div>
<script>
$(document).on('click','#check_and_add_${name}_name_list',function () {
let standardBrandNameList = $('#${name}_name_list').val();
let url = '/api/commonData/checkBrandNameList?brand_type=$brandType';
layer.load();
var self = $(this);
$.ajax({
url: url,
type: 'POST',
async: true,
data: {
brand_name_list: standardBrandNameList
},
dataType: 'json',
timeout: 20000,
success: function (res) {
let brandCount = 0;
layer.closeAll();
if (res.code === 0) {
//得到结果后还要操作div
let data = res.data;
let invalidBrandNameList = data.invalid_brand_name_list;
let validBrandIds = data.valid_brand_ids;
let validBrandNameList = data.valid_brand_name_list;
let standardBrandIds = $('#${name}').val();
standardBrandIds = standardBrandIds.split(',');
standardBrandIds = validBrandIds;
standardBrandIds = array_unique(array_remove_empty(standardBrandIds));
$('#${name}').val(standardBrandIds.join(','));
let validStandardBrandNameList = $('#valid_${name}_name_list').text();
validStandardBrandNameList = validStandardBrandNameList.split(',');
validStandardBrandNameList = validBrandNameList;
validStandardBrandNameList = array_unique(array_remove_empty(validStandardBrandNameList));
brandCount = validStandardBrandNameList.length;
$('#valid_${name}_name_list').text(validStandardBrandNameList.join(','));
// $('#${name}_name_list').val(validStandardBrandNameList.join(','));
// let invalidStandardBrandNameList = $('#invalid_${name}_name_list').val();
// invalidStandardBrandNameList = invalidStandardBrandNameList.split(',');
// invalidStandardBrandNameList = $.merge(invalidStandardBrandNameList, invalidBrandNameList);
$('#invalid_${name}_name_list').text('');
let invalidStandardBrandNameList = invalidBrandNameList;
invalidStandardBrandNameList = array_unique(array_remove_empty(invalidStandardBrandNameList));
if (invalidStandardBrandNameList.length > 0){
let text = '品牌名称 : ' + invalidStandardBrandNameList.join('、') + ' 未匹配到{$brandTypeName}品牌';
$('#invalid_${name}_name_list').text(text);
$('#invalid_${name}_name_list').val(invalidStandardBrandNameList.join('、'));
}
self.next().text(brandCount+'个');
} else {
layer.msg(res.msg, {icon: 5});
}
},
error: function () {
layer.closeAll();
layer.msg('网络错误', {icon: 5});
}
});
});
</script>
EOF;
return $html;
}
}
<?php
namespace App\Presenters;
class BrandSelectorPresenter
{
public function render($name, $text, $value = null, $data = [0 => '禁用', 1 => '启用'], $option = [])
{
$isRequired = \Arr::get($option, 'required', false);
$requiredHtml = $isRequired ? '<span style="color: red">*</span>' : "";
$html = <<<EOF
<label class="layui-form-label">
$requiredHtml
$text</label>
<div class="layui-input-inline">
<div id="$name" class="layui-input-inline" value="$value" style="width: 700px;">
</div>
<input type="hidden" name="$name" id="$name">
</div>
<script>
//渲染品牌多选
let brandUrl = '/api/common/getBrandList';
let brandSelector = xmSelect.render({
el: '#$name',
name: '$name',
searchTips: '请输入要查找的制造商',
paging: true,
empty: '没有查找到数据',
prop: {
name: 'brand_name',
value: 'brand_id'
},
height: "1300px",
remoteSearch: true,
autoRow: true,
pageRemote: true,
pageSize: 10,
filterable: true,
remoteMethod: function (val, cb, show, pageIndex) {
//val: 搜索框的内容, 不开启搜索默认为空, cb: 回调函数, show: 当前下拉框是否展开, pageIndex: 当前第几页
$.ajax({
url: brandUrl,
type: 'post',
data: {
standard_brand_ids: $('#$name').val(),
brand_name: val,
page: pageIndex
},
dataType: 'json',
timeout: 10000,
success: function (res) {
if (!res) return layer.msg('网络错误,请重试', {icon: 5});
if (res.code === 0) {
cb(res.data, res.count/10);
}
},
error: function () {
return layer.msg('网络错误,请重试', {icon: 5});
}
});
},
on: function (data) {
let brandIds = '';
for (let x in data.arr) // x 为属性名
{
brandIds = brandIds + data.arr[x].brand_id + ',';
}
$("#standard_brand_ids").val(brandIds);
}
});
let brandIds = $('#brand_selector').attr('value');
brandSelector.setValue(brandIds.split(','));
</script>
EOF;
return $html;
}
}
\ No newline at end of file
<?php
namespace App\Presenters;
use Arr;
class SingleSelectPresenter
{
public function render($name, $text, $value = null, $data = [0 => '禁用', 1 => '启用'], $option = [])
{
$isRequired = Arr::get($option, 'required', false);
$disable = Arr::get($option, 'disabled', false);
$requiredHtml = $isRequired ? '<span style="color: red">*</span>' : "";
$html = <<<EOF
<label class="layui-form-label">
$requiredHtml
$text
</label>
<div class="layui-input-block">
{$this->itemRender($data, $name, $value, $disable)}
</div>
EOF;
return $html;
}
public function itemRender($data, $name, $value, $disable)
{
$checked = '';
$itemsHtml = '';
$disabled = $disable ? 'disabled' : '';
foreach ($data as $v => $item) {
if ($value !== null) {
$checked = ($v == $value) ? "checked" : '';
}
$itemsHtml = $itemsHtml . "<input type='radio' lay-filter='${name}' name='${name}' id='${name}' value='${v}' title='${item}' $checked $disabled>";
}
return $itemsHtml;
}
}
\ No newline at end of file
<?php
namespace App\Presenters;
use App\Http\Services\StandardBrandService;
class StandardBrandNameListPresenter
{
public function render($name, $fieldText, $value = null, $option = [])
{
//因为这个组件是专门给标准品牌用的,所以可以直接去获取标准列表展示出来
$standardBrandNameList = '';
if ($value) {
$standardBrandNameList = (new StandardBrandService())->getStandardBrandNameListByBrandIds($value);
}
$isRequired = \Arr::get($option, 'required', false);
$requiredHtml = $isRequired ? '<span style="color: red;margin-right: 3px">*</span>' : '';
$html = <<<EOF
<label class="layui-form-label">
$requiredHtml $fieldText</label>
<div class="layui-input-block" style="width: 80%">
<input type="hidden" name="$name" value="$value" id="$name">
<div class="layui-col-md7">
<textarea rows="7" placeholder="标准品牌名称,多个用英文逗号隔开" class="layui-textarea" id="${name}_name_list">$standardBrandNameList</textarea>
<blockquote class="layui-elem-quote" id="valid_${name}_name_list">$standardBrandNameList</blockquote>
<span style="color: red" id="invalid_${name}_name_list"></span>
</div>
<div class="layui-col-md5">
<button type="button" class="layui-btn-sm layui-btn" id="check_and_add_${name}_name_list" style="margin-left: 10px;">验证并加入</button>
<p style="margin-top: 130px;margin-left: 10px"></p>
</div>
</div>
<script>
$(document).on('click','#check_and_add_${name}_name_list',function () {
let standardBrandNameList = $('#${name}_name_list').val();
let url = '/api/commonData/checkStandardBrandNameList';
layer.load();
var self = $(this);
$.ajax({
url: url,
type: 'POST',
async: true,
data: {
standard_brand_name_list: standardBrandNameList
},
dataType: 'json',
timeout: 20000,
success: function (res) {
let brandCount = 0;
layer.closeAll();
if (res.code === 0) {
//得到结果后还要操作div
let data = res.data;
let invalidBrandNameList = data.invalid_brand_name_list;
let validBrandIds = data.valid_brand_ids;
let validBrandNameList = data.valid_brand_name_list;
let standardBrandIds = $('#${name}').val();
standardBrandIds = standardBrandIds.split(',');
standardBrandIds = validBrandIds;
standardBrandIds = array_unique(array_remove_empty(standardBrandIds));
$('#${name}').val(standardBrandIds.join(','));
// let validStandardBrandNameList = $('#valid_${name}_name_list').text();
// validStandardBrandNameList = validStandardBrandNameList.split(',');
let validStandardBrandNameList = validBrandNameList;
validStandardBrandNameList = array_unique(array_remove_empty(validStandardBrandNameList));
brandCount = validStandardBrandNameList.length;
$('#valid_${name}_name_list').text(validStandardBrandNameList.join(','));
// $('#${name}_name_list').val(validStandardBrandNameList.join(','));
// let invalidStandardBrandNameList = $('#invalid_${name}_name_list').val();
// let invalidStandardBrandNameList = '';
// invalidStandardBrandNameList = invalidStandardBrandNameList.split(',');
// invalidStandardBrandNameList = $.merge(invalidStandardBrandNameList, invalidBrandNameList);
$('#invalid_${name}_name_list').text('');
let invalidStandardBrandNameList = invalidBrandNameList;
invalidStandardBrandNameList = array_unique(array_remove_empty(invalidStandardBrandNameList));
if (invalidStandardBrandNameList.length > 0){
let text = '品牌名称 : ' + invalidStandardBrandNameList.join('、') + ' 未匹配到标准品牌';
$('#invalid_${name}_name_list').text(text);
$('#invalid_${name}_name_list').val(invalidStandardBrandNameList.join('、'));
}
self.next().text(brandCount+'个');
} else {
layer.msg(res.msg, {icon: 5});
}
},
error: function () {
layer.closeAll();
layer.msg('网络错误', {icon: 5});
}
});
});
</script>
EOF;
return $html;
}
}
\ No newline at end of file
<?php
namespace App\Presenters;
class StatusPresenter
{
public function render($name, $text, $status = null, $data = [0 => '禁用', 1 => '启用'], $option = [])
{
$isRequired = \Arr::get($option, 'required', false);
$requiredHtml = $isRequired ? '<span style="color: red">*</span>' : "";
$html = <<<EOF
<label class="layui-form-label">
$requiredHtml
$text
</label>
<div class="layui-input-inline">
<select name="$name" lay-filter="$name">
{$this->optionsRender($data, $status)}
</select>
</div>
EOF;
return $html;
}
public function optionsRender($data, $status)
{
$optionsHtml = ' <option value="">请选择</option>';
$checked = '';
foreach ($data as $key => $value) {
if ($status !== null) {
$checked = ($key == $status) ? "selected='selected'" : '';
}
$optionsHtml = $optionsHtml . "<option value='$key' $checked>$value</option>";
}
return $optionsHtml;
}
}
\ No newline at end of file
<?php
namespace App\Presenters;
class TimeIntervalPresenter
{
public function render($name, $text)
{
$time = request()->get($name);
$html = <<<EOF
<label class="layui-form-label" style="min-width: 80px">$text</label>
<div class="layui-input-inline" style="min-width: 260px">
<input type="text" name="{$name}" autocomplete="off" class="layui-input">
</div>
<script>
window.onload = function(){
layui.use('laydate', function(){
let laydate = layui.laydate;
laydate.render({
elem: 'input[name=$name]'
,type: 'datetime'
,trigger:'click'
,range: '~' //或 range: '~' 来自定义分割字符
,value: '$time'
});
});
}
</script>
EOF;
return $html;
}
}
\ No newline at end of file
<?php
namespace App\Providers;
use App\Http\Models\PurchasePlanModel;
use App\Http\Models\ReturnMaterialModel;
use App\Observers\PurchasePlanObserver;
use App\Observers\ReturnMaterialObserver;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
// $this->_dbQueryBuilderMacro();
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
date_default_timezone_set("Asia/Shanghai");
}
}
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
// 'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
'Illuminate\Database\Events\QueryExecuted' => [
'App\Listeners\QueryListener',
]
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
//
}
}
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* The path to the "home" route for your application.
*
* @var string
*/
public const HOME = '/home';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
//
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
$this->mapSyncRoutes();
$this->mapQueueRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless .
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless .
*
* @return void
*/
protected function mapSyncRoutes()
{
Route::prefix('sync')
->middleware('sync')
->namespace($this->namespace)
->group(base_path('routes/sync.php'));
}
// 采购系统队列接口调用
protected function mapQueueRoutes()
{
Route::prefix('queue')
->namespace($this->namespace)
->group(base_path('routes/queue.php'));
}
}
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
// 加载配置文件,公共读取配置文件函数
require __DIR__.'/bootstrap/init.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
$app->useStoragePath(APP_STORAGE_PATH) ;
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
<?php
// 判断是否是命令模式
if (is_cli()){
$default_env_dir = dirname(__DIR__);
} else {
$default_env_dir = dirname($_SERVER['DOCUMENT_ROOT']);
}
$dotenv = Dotenv\Dotenv::createImmutable($default_env_dir);
$dotenv->safeLoad();
$RESOURCE_CONFIG_DIR = $APP_STORAGE_PATH = '';
if (!empty(env('RESOURCE_CONFIG_DIR'))){
$RESOURCE_CONFIG_DIR = env('RESOURCE_CONFIG_DIR');
}
if (!empty(env('APP_STORAGE_PATH'))){
$APP_STORAGE_PATH = env('APP_STORAGE_PATH');
}
// 定义资源配置文件目录
define('RESOURCE_CONFIG_DIR', (is_dir($RESOURCE_CONFIG_DIR)) ? $RESOURCE_CONFIG_DIR : '/data/liexin_config');
// 定义日志目录
define('APP_STORAGE_PATH', (is_dir($APP_STORAGE_PATH)) ? $APP_STORAGE_PATH : '/data/liexin_logs/cube');
function is_cli(){
return preg_match("/cli/i", php_sapi_name()) ? true : false;
}
// 自动创建应用必须目录
$auto_create_dir = [
APP_STORAGE_PATH . "/framework/sessions",
APP_STORAGE_PATH . "/framework/caches",
APP_STORAGE_PATH . "/framework/views",
APP_STORAGE_PATH . "/app/public",
];
foreach ($auto_create_dir as $create_dir)
{
if (!is_dir($create_dir)){
mkdir($create_dir, 0755, true);
}
}
function get_resource_config($type){
if(!isset($GLOBALS['_lx_resource_config'][$type])){
$path = RESOURCE_CONFIG_DIR.'/'.$type.'.ini';
$config = parse_ini_file($path , true);
$GLOBALS['_lx_resource_config'][$type] = $config;
}else{
$config = $GLOBALS['_lx_resource_config'][$type];
}
return $config;
}
function get_resource_config_section($type, $section){
if(!isset($GLOBALS['_lx_resource_config'][$type])){
$path = RESOURCE_CONFIG_DIR.'/'.$type.'.ini';
$type_config = parse_ini_file($path , true);
$GLOBALS['_lx_resource_config'][$type] = $type_config;
$config = isset($type_config[$section]) ? $type_config[$section] : [];
}else{
$config = isset($GLOBALS['_lx_resource_config'][$type][$section]) ? $GLOBALS['_lx_resource_config'][$type][$section] : [];
}
return $config;
}
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5|^8.0",
"ext-json": "*",
"ext-libxml": "*",
"ext-soap": "*",
"artisaninweb/laravel-soap": "0.3.0.10",
"barryvdh/laravel-dompdf": "^0.9.0",
"dcat/laravel-wherehasin": "^0.8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3.1|^7.0.1",
"hprose/hprose": "^2.0",
"jenssegers/mongodb": "3.7.3",
"laravel/framework": "^7.29",
"laravel/tinker": "^2.5",
"maatwebsite/excel": "^3.1",
"overtrue/laravel-lang": "~5.0",
"php-amqplib/php-amqplib": "2.12.3",
"predis/predis": "^1.1",
"tucker-eric/eloquentfilter": "^3.0"
},
"require-dev": {
"facade/ignition": "^2.0",
"fakerphp/faker": "^1.9.1",
"itsgoingd/clockwork": "^5.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.3",
"phpunit/phpunit": "^8.5.8|^9.3.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"platform-check": false
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
],
"files":[
"app/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
This diff could not be displayed because it is too large.
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => get_resource_config_section('app', 'cube')['APP_NAME'],
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => get_resource_config_section('app', 'cube')['APP_ENV'],
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => true,
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => get_resource_config_section('app', 'cube')['APP_URL'],
'asset_url' => env('ASSET_URL', null),
'log' => 'daily',
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'zh_CN',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => get_resource_config_section('app', 'cube')['APP_KEY'],
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Jenssegers\Mongodb\MongodbServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Maatwebsite\Excel\ExcelServiceProvider::class,
Clockwork\Support\Laravel\ClockworkServiceProvider::class,
Barryvdh\DomPDF\ServiceProvider::class,
Artisaninweb\SoapWrapper\ServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'Str' => Illuminate\Support\Str::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'SoapWrapper' => \Artisaninweb\SoapWrapper\Facade::class
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
'hash' => false,
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'useTLS' => true,
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];
<?php
return [
'erp_domain' => get_resource_config_section('app', 'pur')["erp_domain"],
'scm_domain' => get_resource_config_section('app', 'pur')["scm_domain"],
'erp_login_name' => get_resource_config_section('app', 'pur')["erp_login_name"],
'erp_db_name' => get_resource_config_section('app', 'pur')["erp_db_name"],
"num_format"=>[
"1"=>"一",
"2"=>"二",
"3"=>"三",
"4"=>"四",
"5"=>"五",
"6"=>"六",
"7"=>"七",
"8"=>"八",
"9"=>"九",
],
"ladder_price_redis_connection_name"=>"frq",
//销售组阶梯价 代购
"ladder_price_rediskey_daigou"=>"magic_cube_price_rule_channel",
//销售组阶梯价 专营
"ladder_price_rediskey_zhuanying"=>"magic_cube_price_rule_v2",
//销售组阶梯价 代购全局默认
"ladder_price_rediskey_default_daigou"=>"magic_cube_price_rule_channel_default",
//销售组阶梯价 专营全局默认
"ladder_price_rediskey_default_zhuanying"=>"magic_cube_price_rule_v2_default",
//渠道折扣 代购
"channel_discount_daigou"=>"magic_cube_channel_discount_daigou",
//渠道折扣专营
"channel_discount_zhuanying"=>"magic_cube_channel_discount_zhuanying",
//渠道折扣专营 全局默认
"channel_discount_default_zhuanying"=>"magic_cube_channel_discount_default_zhuanying",
//渠道折扣代购 全局默认
"channel_discount_default_daigou"=>"magic_cube_channel_discount_default_daigou",
"liexin_zhuanying_supplier_id" => 17,
//专营默认售价组阶梯信息 初始化使用
"default_zy_salePriceGroup_ladder"=>'{
"1": {
"ladder_price_egt50_lt200": 1,
"ladder_price_egt200": 1
},
"2": {
"ladder_price_egt50_lt200": 3,
"ladder_price_egt200": 2
},
"3": {
"ladder_price_egt50_lt200": 6,
"ladder_price_egt200": 4
},
"4": {
"ladder_price_egt50_lt200": 10,
"ladder_price_egt200": 8
},
"5": {
"ladder_price_egt50_lt200": 15,
"ladder_price_egt200": 16
},
"6": {
"ladder_price_egt50_lt200": 17,
"ladder_price_egt200": 18
},
"7": {
"ladder_price_egt50_lt200": 19,
"ladder_price_egt200": 20
},
"8": {
"ladder_price_egt50_lt200": 21,
"ladder_price_egt200": 22
},
"9": {
"ladder_price_egt50_lt200": 23,
"ladder_price_egt200": 24
}
}',
//默认代购初始化数据 利润阶梯都是0
"default_daigou_salePriceGroup_ladder"=>'{"1":{"ratio":0,"ratio_usd":0},"2":{"ratio":0,"ratio_usd":0},"3":{"ratio":0,"ratio_usd":0},"4":{"ratio":0,"ratio_usd":0},"5":{"ratio":0,"ratio_usd":0},"6":{"ratio":0,"ratio_usd":0},"7":{"ratio":0,"ratio_usd":0},"8":{"ratio":0,"ratio_usd":0},"9":{"ratio":0,"ratio_usd":0}}',
//全局默认代购初始化数据 默认代购全局 利润阶梯都是0
"global_default_daigou_salePriceGroup_ladder"=>'{"ladder_price":[{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1}]}',
//全局默认专营初始化售价组 默认都是10%
"global_default_zhuanying_salePriceGroup_ladder"=>'{"cost_ladder_price_egt50_lt200":[{"purchases":1,"price":1.1,"price_usd":1.1},{"purchases":3,"price":1.1,"price_usd":1.1},{"purchases":6,"price":1.1,"price_usd":1.1},{"purchases":10,"price":1.1,"price_usd":1.1},{"purchases":15,"price":1.1,"price_usd":1.1},{"purchases":17,"price":1.1,"price_usd":1.1},{"purchases":19,"price":1.1,"price_usd":1.1},{"purchases":21,"price":1.1,"price_usd":1.1},{"purchases":23,"price":1.1,"price_usd":1.1}],"cost_ladder_price_egt200":[{"purchases":1,"price":1.1,"price_usd":1.1},{"purchases":2,"price":1.1,"price_usd":1.1},{"purchases":4,"price":1.1,"price_usd":1.1},{"purchases":8,"price":1.1,"price_usd":1.1},{"purchases":16,"price":1.1,"price_usd":1.1},{"purchases":18,"price":1.1,"price_usd":1.1},{"purchases":20,"price":1.1,"price_usd":1.1},{"purchases":22,"price":1.1,"price_usd":1.1},{"purchases":24,"price":1.1,"price_usd":1.1}],"ladder_price_egt50_lt200":[{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.12,"ratio_usd":1.12},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1}],"ladder_price_egt200":[{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1},{"ratio":1.1,"ratio_usd":1.1}],"is_set_lowest_profit":true,"ladder_price_mini_profit_level":9}',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];
<?php
return [
"perm_list" => [
// [
// "title" => "销售订单导出",
// "perm_id" => "order_sale_export"
// ],
],
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
// 新魔方
'mysql' => [
'driver' => 'mysql',
'host' => get_resource_config_section('db', 'db_topic')['host'],
'database' => get_resource_config_section('db', 'db_topic')['db'], // liexin_crm
'username' => get_resource_config_section('db', 'db_topic')['user'],
'password' => get_resource_config_section('db', 'db_topic')['passwd'],
'port' => 3306,
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => 'lie_',
'strict' => false,
'engine' => null,
],
'cms' => [
'driver' => 'mysql',
'host' => get_resource_config_section('db', 'db_cms')['host'],
'database' => get_resource_config_section('db', 'db_cms')['db'],
'username' => get_resource_config_section('db', 'db_cms')['user'],
'password' => get_resource_config_section('db', 'db_cms')['passwd'],
'port' => 3306,
'charset' => 'utf8',
'collation' => 'utf8_general_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'cluster' => false,
'default' => [
'host' => env('REDIS_HOST', 'redis.liexindev.me'),
'password' => env('REDIS_PASSWORD', "d=icDb29mLy2s"),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
'read' => [
'host' => env('REDIS_READ_HOST', 'redis.liexindev.me'),
'password' => env('REDIS_READ_PASSWORD', "d=icDb29mLy2s"),
'port' => env('REDIS_READ_PORT', 6379),
'database' => 0,
],
'frq' => [
'host' => get_resource_config_section('redis', 'frq')['host'],
'password' => get_resource_config_section('redis', 'frq')['passwd'],
'port' => get_resource_config_section('redis', 'frq')['port'],
'database' => 0,
'prefix' => env('PREFIX', '')
],
'sku' => [
'host' => get_resource_config_section('redis', 'sku')['host'],
'password' => get_resource_config_section('redis', 'sku')['passwd'],
'port' => get_resource_config_section('redis', 'sku')['port'],
'database' => 0,
'prefix' => env('PREFIX', '')
],
'spu' => [
'host' => get_resource_config_section('redis', 'spu')['host'],
'password' => get_resource_config_section('redis', 'spu')['passwd'],
'port' => get_resource_config_section('redis', 'spu')['port'],
'database' => 0,
'prefix' => env('PREFIX', '')
],
'user' => [
'host' => get_resource_config_section('redis', 'user')['host'],
'password' => get_resource_config_section('redis', 'user')['passwd'],
'port' => get_resource_config_section('redis', 'user')['port'],
'database' => 0,
'prefix' => env('PREFIX', '')
],
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Eloquent Filter Settings
|--------------------------------------------------------------------------
|
| This is the namespace all you Eloquent Model Filters will reside
|
*/
'namespace' => 'App\\Http\\Filters\\',
/*
|--------------------------------------------------------------------------
| Custom generator stub
|--------------------------------------------------------------------------
|
| If you want to override the default stub this package provides
| you can enter the path to your own at this point
|
*/
// 'generator' => [
// 'stub' => app_path('stubs/modelfilter.stub')
// ]
/*
|--------------------------------------------------------------------------
| Default Paginator Limit For `paginateFilter` and `simplePaginateFilter`
|--------------------------------------------------------------------------
|
| Set paginate limit
|
*/
'paginate_limit' => env('PAGINATION_LIMIT_DEFAULT',10)
];
<?php
return [
'TaxRate' => get_resource_config_section('app', 'pur')["field_TaxRate"],
'SupplierGroup' => [
0 => '其它',
1 => '代理商',
2 => '贸易商',
3 => '方案商IDH/IDM',
4 => '原厂',
5 => '分销商/平台',
6 => 'EMS/OEM/ODM',
],
'StockupType' => [
1 => '国内现货',
6 => '猎芯期货',
3 => '国际现货',
7 => '原厂直供',
2 => '猎芯仓库',
4 => '现货寄售',
5 => '芯链商家',
],
'currency_code' => [
1 => 'RMB',
2 => 'USD',
3 => 'HKD',
4 => 'EUR',
5 => 'GBP',
6 => 'CHF',
7 => 'ADLY',
8 => 'JND',
9 => 'JPY',
10 => 'XJP',
11 => 'XTB',
],
'currency_sign' => [
1 => '¥',
2 => '$',
3 => 'HK$',
4 => '€',
5 => '£',
6 => '₣',
7 => 'S/',
8 => 'C$',
9 => 'J¥',
10 => 'S$',
11 => 'NT',
],
'CouponUsageRange' => [
'1' => '线下',
'2' => '专卖',
'4' => '专营'
],
//-3已删除 -2已取消 -1审核中 1有效 2追加中(仍然有效)
'CouponStatus' => [
-3 => '已删除',
-2 => '已取消',
-1 => '审核中',
1 => '有效',
2 => '追加中',
],
'CouponType' => [
1 => '抵扣券',
2 => '折扣券'
],
'CouponMallType' => [
1 => '通用',
2 => '自营商品',
3 => '专营商品',
],
//有效期类型
'CouponTimeType' => [
1 => '绝对时间',
2 => '相对时间',
],
//发放方式
'CouponIssueType' => [
1 => '买家领取',
2 => '系统发放',
],
//优惠券领取规则
'CouponGetRuler' => [
1 => '注册可领取',
2 => '登陆可领取',
3 => '付款可领取',
],
//用户优惠券状态
'UserCouponStatus' => [
-3 => '已删除',
-2 => '已失效',
-1 => '待使用',
1 => '已使用',
],
//商品范围
'CouponGoodsRange' => [
1 => '全部',
2 => '供应商',
3 => '品牌',
4 => '分类ID',
5 => '供应商ID',
6 => '按型号'
],
//抽奖状态
'LotteryStatus' => [
1 => '启用',
2 => '禁用',
3 => '已删除',
],
'PrizeType' => [
1 => '实物',
2 => '优惠券',
3 => '其他',
4 => '未中奖',
5 => '抽奖资格'
],
//抽奖类型
'PrizeDrawType' => [
1 => '前台抽奖',
2 => '后台发放',
],
//筛选条件用
'FilterPrizeType' => [
1 => '实物',
2 => '优惠券',
3 => '其他',
],
//优惠券日志操作类型 1新增优惠券 2编辑限领规则 3追加发行量 4新券审核 5追加审核
'CouponOpLogType' => [
1 => '新增优惠券',
2=> '编辑限领规则',
3 => '追加发行量',
4 => '新券审核',
5 => '追加审核',
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['daily'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path("logs/laravel.log"),
'level' => 'debug',
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'papertrail' => [
'driver' => 'monolog',
'level' => 'debug',
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
'goodsSalePriceGroup' => [
'driver' => 'daily',
'path' => storage_path('logs/goodsSalePriceGroup/goodsSalePriceGroup.log'),
'level' => 'debug',
'days' => 30,
],
'channelDidcount' => [
'driver' => 'daily',
'path' => storage_path('logs/channelDidcount/channelDidcount.log'),
'level' => 'debug',
'days' => 30,
],
'priceWarning' => [
'driver' => 'daily',
'path' => storage_path('logs/priceWarning/priceWarning.log'),
'level' => 'debug',
'days' => 30,
],
'formRequest' => [
'driver' => 'daily',
'path' => storage_path("logs/FormRequest/FormRequest.log"),
'level' => 'debug',
'days' => 30,
],
'sql' => [
'driver' => 'daily',
'path' => storage_path('logs/sql/sql.log'),
'level' => 'debug',
'days' => 30,
],
],
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
<?php
return [
// 是否开启报错写入
'enabled' => boolval(get_resource_config_section('app', 'cube')["monitorDing_enabled"]),
// curl证书验证, 线下环境不用开启
'curl_verify' => boolval(get_resource_config_section('app', 'cube')["monitorDing_curl_verify"]),
'web_name'=>get_resource_config_section('app', 'cube')["monitorDing_web_name"],
// webhook的值
'webhook' => get_resource_config_section('app', 'cube')["monitorDing_webhook"],
];
<?php
return [
//币种 1:CNY 2:USD 3: 港币 4:欧元 5:英磅
'currency' => [
1 => '人民币',
2 => '美元',
3 => '港币',
4 => '欧元',
5 => '英镑',
],
'currency_sign' => [
1 => '¥',
2 => '$',
3 => 'HK$',
4 => '€',
5 => '£',
],
'delivery_place_map' => [
1 => "大陆",
2 => "香港"
]
];
<?php
return [
// 菜单key
'perm_menus_data' => 'frq_menus_href_data',
'perm_menus_data_expire' => 7200,
// 用户角色
'roles' => [
'管理员' => 1,
'销售查看下级' => 2,
'销售查看自己' => 3,
'采购查看下级' => 4,
'采购查看自己' => 5,
'运营' => 6,
],
'ignore_check' => [
'api_commonData_uploadFile',
]
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
'block_for' => 0,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];
<?php
return [
'default' => "default",
'connections' => [
'default' => [
'host' => get_resource_config_section('rabbit', 'trading_rabbit')['host'],
'port' => get_resource_config_section('rabbit', 'trading_rabbit')['port'],
'login' => get_resource_config_section('rabbit', 'trading_rabbit')['user'],
'password' => get_resource_config_section('rabbit', 'trading_rabbit')['passwd'],
'vhost' => get_resource_config_section('rabbit', 'trading_rabbit')['vhost']
],
'dgk' => [
'host' => get_resource_config_section('rabbit', 'dgk')['host'],
'port' => get_resource_config_section('rabbit', 'dgk')['port'],
'login' => get_resource_config_section('rabbit', 'dgk')['user'],
'password' => get_resource_config_section('rabbit', 'dgk')['passwd'],
'vhost' => get_resource_config_section('rabbit', 'dgk')['vhost']
]
]
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];
This diff is collapsed. Click to expand it.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment