Commit 13d29250 by 朱继来

fix

parent c594eb74
Showing with 3348 additions and 1039 deletions
......@@ -11,67 +11,6 @@ use App\Http\Page;
use App\Http\Controllers\PermController;
use App\Http\Error;
function CheckActive($menus, &$arr, $url)
{
for ($i = 0; $i < count($menus); $i++) {
$menu = $menus[$i];
array_push($arr, $i);
if (isset($menu->href) && ($menu->href == $url || ($menu->href == '/' && $url == '//')))
return true;
if (isset($menu->childs) && count($menu->childs) > 0) {
$ret = CheckActive($menu->childs, $arr, $url);
if ($ret)
return $ret;
}
array_pop($arr);
}
return false;
}
function createMenuReal($menus, $active, $level)
{
$subclass = ($level == 0) ? 'nav-second-level' : 'nav-third-level';
$ret = '';
for ($ii = 0; $ii < ($level == 0 ? 1 : 2); $ii++) {
for ($i = 0; $i < count($menus); $i++) {
$menu = $menus[$i];
$act = (count($active) > $level && $active[$level] == $i) ? true : false;
$actclass = $act ? ' class="active"' : '';
$actmenu = $act ? ' in': '';
if (isset($menu->childs) && count($menu->childs) > 0) {
if ($ii != 0 && $level > 0)
continue;
$ret .= '<li' . $actclass . '><a><i class="'
. $menu->class . '"></i><span class="nav-label">'
. $menu->title . '</span><span class="fa arrow"></span></a>'
. '<ul class="nav ' . $subclass . ' collapse' . $actmenu . '">'
. createMenuReal($menu->childs, $act ? $active : [], $level + 1)
. '</ul></li>';
} else {
if ($ii != 1 && $level > 0)
continue;
$ret .= '<li' . $actclass . '><a href="'. $menu->href . '"><i class="' .
$menu->class . '"></i><span class="nav-label">' . $menu->title . '</span></a></li>';
}
}
}
return $ret;
}
function createMenu($menus, $url)
{
$actives = [];
$ret = CheckActive($menus, $actives, $url);
if (!$ret)
$actives = [];
return createMenuReal($menus, $actives, 0);
}
Class AddOrderController extends Controller
{
// 页面用户、菜单信息
......@@ -115,7 +54,6 @@ Class AddOrderController extends Controller
$info = $this->getPageInfo($request);
$info['title'] = '新增联营订单';
$info['paths'] = [["title" => '新增联营订单', "href" => '#']];
$info['sale_id'] = $request->user->userId;
......@@ -128,7 +66,6 @@ Class AddOrderController extends Controller
$info = $this->getPageInfo($request);
$info['title'] = '新增自营线上订单';
$info['paths'] = [["title" => '新增自营线上订单', "href" => '#']];
$info['sale_id'] = $request->user->userId;
......@@ -253,7 +190,6 @@ Class AddOrderController extends Controller
$info = $this->getPageInfo($request);
$info['title'] = '新增自营线下订单';
$info['paths'] = [["title" => '新增自营线下订单', "href" => '#']];
// 默认内部账号ID
$internal = DB::connection('order')->table('lie_user_main')->where('mobile', Config('website.internal-account'))->select('user_id')->first();
......
......@@ -15,67 +15,6 @@ use Excel;
use App\Model\OrderModel;
use App\Model\UserMainModel;
function CheckActive($menus, &$arr, $url)
{
for ($i = 0; $i < count($menus); $i++) {
$menu = $menus[$i];
array_push($arr, $i);
if (isset($menu->href) && ($menu->href == $url || ($menu->href == '/' && $url == '//')))
return true;
if (isset($menu->childs) && count($menu->childs) > 0) {
$ret = CheckActive($menu->childs, $arr, $url);
if ($ret)
return $ret;
}
array_pop($arr);
}
return false;
}
function createMenuReal($menus, $active, $level)
{
$subclass = ($level == 0) ? 'nav-second-level' : 'nav-third-level';
$ret = '';
for ($ii = 0; $ii < ($level == 0 ? 1 : 2); $ii++) {
for ($i = 0; $i < count($menus); $i++) {
$menu = $menus[$i];
$act = (count($active) > $level && $active[$level] == $i) ? true : false;
$actclass = $act ? ' class="active"' : '';
$actmenu = $act ? ' in': '';
if (isset($menu->childs) && count($menu->childs) > 0) {
if ($ii != 0 && $level > 0)
continue;
$ret .= '<li'. $actclass .'><a><i class="'
. $menu->class . '"></i><span class="nav-label">'
. $menu->title . '</span><span class="fa arrow"></span></a>'
. '<ul class="nav ' . $subclass . ' collapse' . $actmenu . '">'
. createMenuReal($menu->childs, $act ? $active : [], $level + 1)
. '</ul></li>';
} else {
if ($ii != 1 && $level > 0)
continue;
$ret .= '<li' . $actclass . '><a href="'. $menu->href . '"><i class="' .
$menu->class . '"></i><span class="nav-label">' . $menu->title . '</span></a></li>';
}
}
}
return $ret;
}
function createMenu($menus, $url)
{
$actives = [];
$ret = CheckActive($menus, $actives, $url);
if (!$ret)
$actives = [];
return createMenuReal($menus, $actives, 0);
}
// 获取订单优惠券金额
function getCoupon($order_id)
{
......@@ -498,6 +437,7 @@ Class OrderController extends Controller
public function erpOrder(Request $request)
{
$info = $this->getPageInfo($request);
$info['title'] = 'ERP订单';
$map = array();
......@@ -561,6 +501,7 @@ Class OrderController extends Controller
public function selfOrder(Request $request)
{
$info = $this->getOrderInfo($request, 2);
$info['title'] = '自营订单';
return view('selfOrder', $info);
}
......@@ -632,6 +573,7 @@ Class OrderController extends Controller
public function templateData(Request $request, $id, $view_id)
{
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '订单详情');
if ($info['order_info']['order_goods_type'] == 2 && in_array($info['order_info']['order_type'], [1, 3])) { // 平台自营订单
if ($request->input('tags') != 'self') {
......@@ -672,6 +614,7 @@ Class OrderController extends Controller
public function changeOrder(Request $request, $id)
{
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '人工审单', ["title" => '人工审单', "href" => '#']);
if ($info['order_info']['order_goods_type'] == 2 && in_array($info['order_info']['order_type'], [1, 3])) { // 平台自营订单
if ($request->input('tags') != 'self') {
......@@ -847,6 +790,7 @@ Class OrderController extends Controller
}
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '推送业务员', ["title" => '推送业务员', "href" => '#']);
// 获取所有的业务员
$sale_list = $this->getSales('销售');
......@@ -1098,6 +1042,7 @@ Class OrderController extends Controller
public function checkPay(Request $request, $id)
{
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '对账', ["title" => '对账', "href" => '#']);
if ($request->isMethod('post')) {
$order_id = $request->input('order_id', '');
......@@ -1182,6 +1127,7 @@ Class OrderController extends Controller
}
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '订单收货地址', ["title" => '收货地址', "href" => '#']);
if (!$info['order_address_info']) {
errorLog(Error::E_NOT_EXISTS, '订单地址不存在');
......@@ -1218,6 +1164,7 @@ Class OrderController extends Controller
}
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '订单发票信息', ["title" => '发票信息', "href" => '#']);
if (!$info['order_invoice_info']) {
errorLog(Error::E_NOT_EXISTS, '发票不存在');
......@@ -1230,6 +1177,25 @@ Class OrderController extends Controller
return view('changeInvoice', $info);
}
// 订单详情页面头部信息
public function pageHeader($request, &$info, $title, $addInfo=[])
{
$info['title'] = $title;
$param = $request->only('tags');
if (!$param['tags']) {
$info['paths'] = [["title" => '联营订单', "href" => '#'], ["title" => '平台订单列表', "href" => '/list'], ["title" => '订单明细', "href" => !empty($addInfo) ? '/details/'.$info['order_info']['order_id'] : '#']];
} else if ($param['tags'] && $param['tags'] == 'erp') {
$info['paths'] = [["title" => '联营订单', "href" => '#'], ["title" => 'ERP订单列表', "href" => '/erp_order'], ["title" => '订单明细', "href" => !empty($addInfo) ? '/details/'.$info['order_info']['order_id'].'?tags=erp' : '#']];
} else if ($param['tags'] && $param['tags'] == 'self') {
$info['paths'] = [["title" => '自营订单', "href" => '#'], ["title" => '自营订单列表', "href" => '/self_order'], ["title" => '订单明细', "href" => !empty($addInfo) ? '/details/'.$info['order_info']['order_id'].'?tags=self' : '#']];
}
if (!empty( $addInfo))
array_push($info['paths'], $addInfo);
}
/**
*发货
*/
......@@ -1251,6 +1217,7 @@ Class OrderController extends Controller
}
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '发货', ["title" => '发货', "href" => '#']);
$shippings = DB::connection('order')->table('lie_shipping')->where(['enabled'=>1,'is_order'=>1])->get();//获取配送方式
......@@ -1265,7 +1232,7 @@ Class OrderController extends Controller
return view('detail', $info);
}
//发票物流信息
// 发票物流信息
public function invShipping(Request $request, $id)
{
if($request->isMethod('post')){
......@@ -1294,6 +1261,7 @@ Class OrderController extends Controller
}
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '寄送发票', ["title" => '寄送发票', "href" => '#']);
if($info['order_invoice_info']['inv_type'] == 1){
return redirect('/prompt')->with(['message'=>'当前订单不需要发票~','url' =>$_SERVER['HTTP_REFERER'], 'jumpTime'=>3,'status'=>false]);
......@@ -1445,6 +1413,8 @@ Class OrderController extends Controller
}
$info = $this->orderDetail($request, $id);
$this->pageHeader($request, $info, '自营对账', ["title" => '自营对账', "href" => '#']);
$this->selfOtherData($info, $id);
return view('detail', $info);
......@@ -1467,6 +1437,7 @@ Class OrderController extends Controller
}
$info = $this->getPageInfo($request);
$info['title'] = '快递配置';
$redis = Redis::connection('read');
$express = $redis->get($key);
......
......@@ -10,67 +10,6 @@ use Cookie;
use App\Http\Page;
use App\Http\Controllers\PermController;
function CheckActive($menus, &$arr, $url)
{
for ($i = 0; $i < count($menus); $i++) {
$menu = $menus[$i];
array_push($arr, $i);
if (isset($menu->href) && ($menu->href == $url || ($menu->href == '/' && $url == '//')))
return true;
if (isset($menu->childs) && count($menu->childs) > 0) {
$ret = CheckActive($menu->childs, $arr, $url);
if ($ret)
return $ret;
}
array_pop($arr);
}
return false;
}
function createMenuReal($menus, $active, $level)
{
$subclass = ($level == 0) ? 'nav-second-level' : 'nav-third-level';
$ret = '';
for ($ii = 0; $ii < ($level == 0 ? 1 : 2); $ii++) {
for ($i = 0; $i < count($menus); $i++) {
$menu = $menus[$i];
$act = (count($active) > $level && $active[$level] == $i) ? true : false;
$actclass = $act ? ' class="active"' : '';
$actmenu = $act ? ' in': '';
if (isset($menu->childs) && count($menu->childs) > 0) {
if ($ii != 0 && $level > 0)
continue;
$ret .= '<li' . $actclass . '><a><i class="'
. $menu->class . '"></i><span class="nav-label">'
. $menu->title . '</span><span class="fa arrow"></span></a>'
. '<ul class="nav ' . $subclass . ' collapse' . $actmenu . '">'
. createMenuReal($menu->childs, $act ? $active : [], $level + 1)
. '</ul></li>';
} else {
if ($ii != 1 && $level > 0)
continue;
$ret .= '<li' . $actclass . '><a href="'. $menu->href . '"><i class="' .
$menu->class . '"></i><span class="nav-label">' . $menu->title . '</span></a></li>';
}
}
}
return $ret;
}
function createMenu($menus, $url)
{
$actives = [];
$ret = CheckActive($menus, $actives, $url);
if (!$ret)
$actives = [];
return createMenuReal($menus, $actives, 0);
}
Class OrderCountController extends Controller
{
// 页面用户、菜单信息
......@@ -114,6 +53,8 @@ Class OrderCountController extends Controller
public function count(Request $request, $type = 1, $view = 'count')
{
$info = $this->getPageInfo($request);
$info['type'] = $type;
$info['title'] = '订单统计';
$url = Config('website.api_domain').'order/orderCount';
......@@ -135,6 +76,9 @@ Class OrderCountController extends Controller
public function amount(Request $request, $type = 1, $view = 'amount')
{
$info = $this->getPageInfo($request);
$info['type'] = $type;
$info['title'] = '订单金额统计';
$info['paths'] = [["title" => '订单统计', "href" => '#'], ["title" => $type == 1 ? '联营订单统计' : '自营订单统计', "href" => $type == 1 ? '/count' : 'self_count'], ["title" => '订单金额统计', "href" => '#']];
$time_start = $request->input('time_start', ''); // 开始时间
$time_end = $request->input('time_end', ''); // 结束时间
......@@ -195,12 +139,12 @@ Class OrderCountController extends Controller
// 自营订单统计
public function selfCount(REQUEST $request)
{
return $this->count($request, 2, 'self_count');
return $this->count($request, 2, 'count');
}
// 自营订单金额统计
public function selfAmount(REQUEST $request)
{
return $this->amount($request, 2, 'self_amount');
return $this->amount($request, 2, 'amount');
}
}
\ No newline at end of file
......@@ -9,48 +9,6 @@ use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
function createMenuReal($menus, $active, $level)
{
$subclass = ($level == 0) ? 'nav-second-level' : 'nav-third-level';
$ret = '';
for ($ii = 0; $ii < ($level == 0 ? 1 : 2); $ii++) {
for ($i = 0; $i < count($menus); $i++) {
$menu = $menus[$i];
$act = (count($active) > $level && $active[$level] == $i) ? true : false;
$actclass = $act ? ' class="active"' : '';
$actmenu = $act ? ' in': '';
if (isset($menu->childs) && count($menu->childs) > 0) {
if ($ii != 0 && $level > 0)
continue;
$ret .= '<li' . $actclass . '><a><i class="'
. $menu->class . '"></i><span class="nav-label">'
. $menu->title . '</span><span class="fa arrow"></span></a>'
. '<ul class="nav ' . $subclass . ' collapse' . $actmenu . '">'
. createMenuReal($menu->childs, $act ? $active : [], $level + 1)
. '</ul></li>';
} else {
if ($ii != 1 && $level > 0)
continue;
$ret .= '<li' . $actclass . '><a href="'. $menu->href . '"><i class="' .
$menu->class . '"></i><span class="nav-label">' . $menu->title . '</span></a></li>';
}
}
}
return $ret;
}
function createMenu($menus, $url)
{
$actives = [];
$ret = CheckActive($menus, $actives, $url);
if (!$ret)
$actives = [];
return createMenuReal($menus, $actives, 0);
}
class WebController extends Controller
{
// 页面用户、菜单信息
......@@ -80,7 +38,6 @@ class WebController extends Controller
$data = [
'header' => $request->user->header,
'uri' => $uri,
'paths' => [["title" => "首页", "href" => '/database/']],
'username' => $username,
'useremail' => $useremail,
'menus' => $menus,
......@@ -104,6 +61,7 @@ class WebController extends Controller
private function AuthPaymentDays($request,$data,$id){
$data['title']='审核账期申请';
$data['Status']=[1=>'待审核',2=>'审核通过',3=>'审核不通过'];
$data['paths'] = [["title" => '账期管理', "href" => '#'], ["title" => '申请列表', "href" => '/web/PaymentDaysList'], ["title" => '审核账期申请', "href" => '#']];
$Model=new PaymentDaysModel();
$data['info']=$Model->AuthPaymentDays();
return view($id,$data);
......
<?php
/** 公用函数 */
//导出数据
//导出数据
function exportExcel($expTitle, $expCellName, $expTableData)
{
$xlsTitle = iconv('utf-8', 'gb2312', $expTitle);//文件名称
$fileName = $expTitle.date('_YmdHis');//or $xlsTitle 文件名称可根据自己情况设定
$cellNum = count($expCellName);
$dataNum = count($expTableData);
// vendor("PHPExcel.PHPExcel");
$objPHPExcel = new PHPExcel();
include_once(__DIR__."/../../vendor/PHPExcel/PHPExcel/IOFactory.php");
set_time_limit(0);//不对php(主要是写数据)执行时间做限制
ini_set("memory_limit", "1024M");//设置内存(防爆内存)
$cacheMethod = \PHPExcel_CachedObjectStorageFactory::cache_in_memory_serialized;//设置缓存策略(减少内存占用)
//判断缓存策略是否可用
if (!\PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
die($cacheMethod . " 缓存方法不可用" . EOL);
}
$cellName = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL','AM','AN','AO','AP','AQ','AR','AS','AT','AU','AV','AW','AX','AY','AZ');
//显示导出名称和导出时间
// $objPHPExcel->getActiveSheet(0)->mergeCells('A1:'.$cellName[$cellNum-1].'1');//合并单元格
// $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', $expTitle.' 导出时间:'.date('Y-m-d H:i:s'));
for($i=0;$i<$cellNum;$i++){
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($cellName[$i].'1', $expCellName[$i][1]);
}
// Miscellaneous glyphs, UTF-8
for($i=0;$i<$dataNum;$i++){
for($j=0;$j<$cellNum;$j++){
$objPHPExcel->getActiveSheet(0)->setCellValue($cellName[$j].($i+2), $expTableData[$i][$expCellName[$j][0]]);
}
}
header('pragma:public');
header('Content-type:application/vnd.ms-excel;charset=utf-8;name="'.$xlsTitle.'.csv"');
header("Content-Disposition:attachment;filename=$fileName.csv");//attachment新窗口打印inline本窗口打印
//输出bom
print(chr(0xEF).chr(0xBB).chr(0xBF));
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
$objWriter->save('php://output');
exit;
}
// curl
function curlApi( $url , $params = array(), $method = 'GET' , $multi = false, $extheaders = array())
{
if(!function_exists('curl_init')) exit('Need to open the curl extension');
$method = strtoupper($method);
$ci = curl_init();
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ci, CURLOPT_TIMEOUT, 3);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ci, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ci, CURLOPT_HEADER, false);
$headers = (array)$extheaders;
switch ($method)
{
case 'POST':
curl_setopt($ci, CURLOPT_POST, TRUE);
if (!empty($params))
{
if($multi)
{
foreach($multi as $key => $file)
{
$params[$key] = '@' . $file;
}
curl_setopt($ci, CURLOPT_POSTFIELDS, $params);
$headers[] = 'Expect: ';
}
else
{
curl_setopt($ci, CURLOPT_POSTFIELDS, http_build_query($params));
}
}
break;
case 'DELETE':
case 'GET':
$method == 'DELETE' && curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
if (!empty($params))
{
$url = $url . (strpos($url, '?') ? '&' : '?')
. (is_array($params) ? http_build_query($params) : $params);
}
break;
}
curl_setopt($ci, CURLINFO_HEADER_OUT, TRUE );
curl_setopt($ci, CURLOPT_URL, $url);
if($headers)
{
curl_setopt($ci, CURLOPT_HTTPHEADER, $headers );
}
$response = curl_exec($ci);
curl_close ($ci);
return $response;
}
/**
* webpower CURL 请求
* @param $url
* @param $content
* @param string $method
* @return mixed
*/
function webpower_curl($url, $content, $method= 'post'){
//username and password
$username = "xb@ichunt.com"; //短信平台的账号
$password = "Webp0wer"; //短信平台的密码
$data_string = json_encode($content);
$header = array(
"Content-Type: application/json",
"X-HTTP-Method-Override: $method",
"Authorization: Basic " . base64_encode($username . ":" . $password)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch,CURLOPT_HTTPHEADER, $header);
$response = curl_exec($ch);
return $response ? $response : curl_error($ch);
}
/**
* 接口服务时加密方式
* @param [type] $data [description]
* @param [type] $timestamp [description]
* @param [type] $key [description]
* @return [type] [description]
*/
function service_token($data, $timestamp, $key = null)
{
$key = is_null($key) ? Config('website.SERVICE_KEY') : $key;
$token = md5($data.$timestamp.$key);
return $token;
}
/**
* 获取客户端IP地址
* @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字
* @param boolean $adv 是否进行高级模式获取(有可能被伪装)
* @return mixed
*/
function get_client_ip($type = 0, $adv = false)
{
$type = $type ? 1 : 0;
static $ip = null;
if (null !== $ip) {
return $ip[$type];
}
if ($adv) {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$pos = array_search('unknown', $arr);
if (false !== $pos) {
unset($arr[$pos]);
}
$ip = trim($arr[0]);
} elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}
} elseif (isset($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
}
// IP地址合法验证
$long = sprintf("%u", ip2long($ip));
$ip = $long ? array($ip, $long) : array('0.0.0.0', 0);
return $ip[$type];
}
// 记录错误日志
function errorLog($err_code, $err_msg)
{
$near_trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$backtrace = array_pop($near_trace);
$file = !empty($near_trace[0]['file']) ? $near_trace[0]['file'] : '';
$line = !empty($near_trace[0]['line']) ? $near_trace[0]['line'] : 0;
$method = !empty($backtrace['function']) ? $backtrace['function'] : '';
\LogReport::write(\LogReport::anlyError($err_msg, $file, $line, $err_code, $method));
}
function Crumbs($menus, $uri)
{
$actives = [];
CheckActive($menus, $actives, $uri);
$ret = '';
foreach ($actives as $k => $v) {
if ($k == count($actives) - 1) {
$ret .= '<li class="active"><a>' . $menus[$actives[0]]->childs[$actives[1]]->title . '</a></li>';
} else {
$ret .= '<li><a href="#">' . $menus[$actives[0]]->title . '</a></li>';
}
}
return $ret;
}
function CheckActive($menus, &$arr, $url)
{
for ($i = 0; $i < count($menus); $i++) {
$menu = $menus[$i];
array_push($arr, $i);
if (isset($menu->href) && ($menu->href == $url || ($menu->href == '/' && $url == '//')))
return true;
if (isset($menu->childs) && count($menu->childs) > 0) {
$ret = CheckActive($menu->childs, $arr, $url);
if ($ret)
return $ret;
}
array_pop($arr);
}
return false;
}
\ No newline at end of file
......@@ -10,7 +10,9 @@
"justinrainbow/json-schema": "~1.3",
"maatwebsite/excel": "~2.0.0",
"guzzlehttp/guzzle": "^6.3",
"predis/predis": "^1.1"
"predis/predis": "^1.1",
"redgo/monitor-ding": "0.2",
"barryvdh/laravel-debugbar": "^2.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
......
......@@ -155,6 +155,8 @@ return [
App\Providers\AuthServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Redgo\MonitorDing\MonitorDingServiceProvider::class,
Barryvdh\Debugbar\ServiceProvider::class,
],
/*
......@@ -201,6 +203,8 @@ return [
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'MonitorDing' => Redgo\MonitorDing\Facades\MonitorDing::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class,
],
......
<?php
return [
/*
|--------------------------------------------------------------------------
| Debugbar Settings
|--------------------------------------------------------------------------
|
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
|
*/
'enabled' => env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Storage settings
|--------------------------------------------------------------------------
|
| DebugBar stores data for session/ajax requests.
| You can disable this, so the debugbar stores data in headers/session,
| but this can cause problems with large data collectors.
| By default, file storage (in the storage folder) is used. Redis and PDO
| can also be used. For PDO, run the package migrations first.
|
*/
'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '' // Instance of StorageInterface for custom driver
],
/*
|--------------------------------------------------------------------------
| Vendors
|--------------------------------------------------------------------------
|
| Vendor files are included by default, but can be set to false.
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
| and for js: jquery and and highlight.js
| So if you want syntax highlighting, set it to true.
| jQuery is set to not conflict with existing jQuery scripts.
|
*/
'include_vendors' => true,
/*
|--------------------------------------------------------------------------
| Capture Ajax Requests
|--------------------------------------------------------------------------
|
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
| you can use this option to disable sending the data through the headers.
|
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
*/
'capture_ajax' => true,
'add_ajax_timing' => false,
/*
|--------------------------------------------------------------------------
| Custom Error Handler for Deprecated warnings
|--------------------------------------------------------------------------
|
| When enabled, the Debugbar shows deprecated warnings for Symfony components
| in the Messages tab.
|
*/
'error_handler' => false,
/*
|--------------------------------------------------------------------------
| Clockwork integration
|--------------------------------------------------------------------------
|
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
*/
'clockwork' => false,
/*
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => true, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => true, // Display session data
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
],
/*
|--------------------------------------------------------------------------
| Extra options
|--------------------------------------------------------------------------
|
| Configure some DataCollectors
|
*/
'options' => [
'auth' => [
'show_name' => true, // Also show the users name/email in the debugbar
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'timeline' => false, // Add the queries to the timeline
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
],
'mail' => [
'full_log' => false
],
'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large..
],
'route' => [
'label' => true // show complete route on bar
],
'logs' => [
'file' => null
],
],
/*
|--------------------------------------------------------------------------
| Inject Debugbar in Response
|--------------------------------------------------------------------------
|
| Usually, the debugbar is added just before </body>, by listening to the
| Response after the App is done. If you disable this, you have to add them
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
*/
'inject' => true,
/*
|--------------------------------------------------------------------------
| DebugBar route prefix
|--------------------------------------------------------------------------
|
| Sometimes you want to set route prefix to be used by DebugBar to load
| its resources from. Usually the need comes from misconfigured web server or
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
*/
'route_prefix' => '_debugbar',
/*
|--------------------------------------------------------------------------
| DebugBar route domain
|--------------------------------------------------------------------------
|
| By default DebugBar route served from the same domain that request served.
| To override default domain, specify it as a non-empty value.
*/
'route_domain' => null,
];
<?php
return [
// 是否开启报错写入
'enabled' => true,
// curl证书验证, 线下环境不用开启
'curl_verify' => true,
// webhook的值
'webhook' => 'https://oapi.dingtalk.com/robot/send?access_token=a1ecbb3b7dc17660f0d8b833d79a16578b682e28b673dd024c4125ca974abadd',
];
\ No newline at end of file
<?php
return [
'joint_addr' => '深圳市龙岗区坂田五和大道南2号万科星火online六栋三楼猎芯科技', // 联营自提地址
'self_addr' => '深圳市光明新区新湖街道楼村社区荔都路32号A栋三楼', // 自营自提地址
];
\ No newline at end of file
.page-content {
margin-top: 20px;
}
/* 订单信息 */
.order-details .order-info {
width: 100%;
......@@ -202,18 +206,34 @@ li {
width: 55%;
}
.payment-status {
width: 420px;
}
/* 响应式 */
@media screen and (max-width: 768px) {
.body-small .navbar-static-side { width: 170px; top: 48px; left: 10px; }
#page-wrapper { padding: 0 10px; }
.body-small .navbar-static-side { width: 220px; top: 48px; left: 10px; background: #293846; }
.search-box > div dl dd { width: 130px; }
.side-section { margin-left: 40px; }
.Wdate{ width: 110px !important; }
.search-box > div dl dd { width: 120px; }
.test-order { width: 130px !important; }
.Wdate{ width: 80px !important; }
.btn-group { width: 220px; }
.search-btn { margin-bottom: 20px !important; }
.show-list-info { display: none; }
.payment-status { width: 220px; }
}
@media screen and (max-width: 460px) {
.order_contain { margin-left: 80px !important; }
}
......@@ -144,11 +144,11 @@ input[type="color"],
.nav-tabs>li.active>a,
.nav-tabs>li.active>a:hover,
.nav-tabs>li.active>a:focus{
background-color: #ffa300 !important;
background-color: #1ab394 !important;
color: #fff;
border-top: 1px solid #ffa300 !important;
border-left: 1px solid #ffa300 !important;
border-right: 1px solid #ffa300 !important;
border-top: 1px solid #1ab394 !important;
border-left: 1px solid #1ab394 !important;
border-right: 1px solid #1ab394 !important;
}
.tabs-box{
......@@ -164,6 +164,12 @@ input[type="color"],
box-shadow: 0 1px 10px rgba(0,0,0,0.1);
}
.order-amount-search {
height: 28px;
line-height: 10px;
margin-top: -4px;
}
.row-fluid {
width: 100%;
}
......
$(document).ready(function(){if($(this).width()<769){$("body").addClass("body-small")}else{$("body").removeClass("body-small")}$("#side-menu").metisMenu();$(".collapse-link").click(function(){var d=$(this).closest("div.ibox");var b=$(this).find("i");var c=d.find("div.ibox-content");c.slideToggle(200);b.toggleClass("fa-chevron-up").toggleClass("fa-chevron-down");d.toggleClass("").toggleClass("border-bottom");setTimeout(function(){d.resize();d.find("[id^=map-]").resize()},50)});$(".close-link").click(function(){var b=$(this).closest("div.ibox");b.remove()});$(".fullscreen-link").click(function(){var c=$(this).closest("div.ibox");var b=$(this).find("i");$("body").toggleClass("fullscreen-ibox-mode");b.toggleClass("fa-expand").toggleClass("fa-compress");c.toggleClass("fullscreen");setTimeout(function(){$(window).trigger("resize")},100)});$(".close-canvas-menu").click(function(){$("body").toggleClass("mini-navbar");SmoothlyMenu()});$("body.canvas-menu .sidebar-collapse").slimScroll({height:"100%",railOpacity:0.9});$(".right-sidebar-toggle").click(function(){$("#right-sidebar").toggleClass("sidebar-open")});$(".sidebar-container").slimScroll({height:"100%",railOpacity:0.4,wheelStep:10});$(".open-small-chat").click(function(){$(this).children().toggleClass("fa-comments").toggleClass("fa-remove");$(".small-chat-box").toggleClass("active")});$(".small-chat-box .content").slimScroll({height:"234px",railOpacity:0.4});$(".check-link").click(function(){var c=$(this).find("i");var b=$(this).next("span");c.toggleClass("fa-check-square").toggleClass("fa-square-o");b.toggleClass("todo-completed");return false});$(".navbar-minimalize").click(function(){$("body").toggleClass("mini-navbar");SmoothlyMenu()});$(".tooltip-demo").tooltip({selector:"[data-toggle=tooltip]",container:"body"});$(".modal").appendTo("body");function a(){var d=$("body > #wrapper").height()-61;$(".sidebard-panel").css("min-height",d+"px");var b=$("nav.navbar-default").height();var c=$("#page-wrapper").height();if(b>c){$("#page-wrapper").css("min-height",b+"px")}if(b<c){$("#page-wrapper").css("min-height",$(window).height()+"px")}if($("body").hasClass("fixed-nav")){if(b>c){$("#page-wrapper").css("min-height",b-60+"px")}else{$("#page-wrapper").css("min-height",$(window).height()-60+"px")}}}a();$(window).bind("load",function(){if($("body").hasClass("fixed-sidebar")){$(".sidebar-collapse").slimScroll({height:"100%",railOpacity:0.9})}});$(window).scroll(function(){if($(window).scrollTop()>0&&!$("body").hasClass("fixed-nav")){$("#right-sidebar").addClass("sidebar-top")}else{$("#right-sidebar").removeClass("sidebar-top")}});$(window).bind("load resize scroll",function(){if(!$("body").hasClass("body-small")){a()}});$("[data-toggle=popover]").popover();$(".full-height-scroll").slimscroll({height:"100%"})});$(window).bind("resize",function(){if($(this).width()<769){$("body").addClass("body-small")}else{$("body").removeClass("body-small")}});$(document).ready(function(){if(localStorageSupport){var e=localStorage.getItem("collapse_menu");var f=localStorage.getItem("fixedsidebar");var d=localStorage.getItem("fixednavbar");var b=localStorage.getItem("boxedlayout");var c=localStorage.getItem("fixedfooter");var a=$("body");if(f=="on"){a.addClass("fixed-sidebar");$(".sidebar-collapse").slimScroll({height:"100%",railOpacity:0.9})}if(e=="on"){if(a.hasClass("fixed-sidebar")){if(!a.hasClass("body-small")){a.addClass("mini-navbar")}}else{if(!a.hasClass("body-small")){a.addClass("mini-navbar")}}}if(d=="on"){$(".navbar-static-top").removeClass("navbar-static-top").addClass("navbar-fixed-top");a.addClass("fixed-nav")}if(b=="on"){a.addClass("boxed-layout")}if(c=="on"){$(".footer").addClass("fixed")}}});function localStorageSupport(){return(("localStorage" in window)&&window.localStorage!==null)}function animationHover(a,b){a=$(a);a.hover(function(){a.addClass("animated "+b)},function(){window.setTimeout(function(){a.removeClass("animated "+b)},2000)})}function SmoothlyMenu(){if(!$("body").hasClass("mini-navbar")||$("body").hasClass("body-small")){$("#side-menu").hide();setTimeout(function(){$("#side-menu").fadeIn(400)},200)}else{if($("body").hasClass("fixed-sidebar")){$("#side-menu").hide();setTimeout(function(){$("#side-menu").fadeIn(400)},100)}else{$("#side-menu").removeAttr("style")}}}function WinMove(){var b="[class*=col]";var c=".ibox-title";var a="[class*=col]";$(b).sortable({handle:c,connectWith:a,tolerance:"pointer",forcePlaceholderSize:true,opacity:0.8}).disableSelection()};
\ No newline at end of file
$(document).ready(function(){if($(this).width()<769){$("body").addClass("body-small");$('.navbar-minimalize').addClass('navdrop').removeClass('navbar-minimalize');$('.navdrop').click(function() {$('.body-small .navbar-static-side').toggle();})}else{$("body").removeClass("body-small")}$("#side-menu").metisMenu();$(".collapse-link").click(function(){var d=$(this).closest("div.ibox");var b=$(this).find("i");var c=d.find("div.ibox-content");c.slideToggle(200);b.toggleClass("fa-chevron-up").toggleClass("fa-chevron-down");d.toggleClass("").toggleClass("border-bottom");setTimeout(function(){d.resize();d.find("[id^=map-]").resize()},50)});$(".close-link").click(function(){var b=$(this).closest("div.ibox");b.remove()});$(".fullscreen-link").click(function(){var c=$(this).closest("div.ibox");var b=$(this).find("i");$("body").toggleClass("fullscreen-ibox-mode");b.toggleClass("fa-expand").toggleClass("fa-compress");c.toggleClass("fullscreen");setTimeout(function(){$(window).trigger("resize")},100)});$(".close-canvas-menu").click(function(){$("body").toggleClass("mini-navbar");SmoothlyMenu()});$("body.canvas-menu .sidebar-collapse").slimScroll({height:"100%",railOpacity:0.9});$(".right-sidebar-toggle").click(function(){$("#right-sidebar").toggleClass("sidebar-open")});$(".sidebar-container").slimScroll({height:"100%",railOpacity:0.4,wheelStep:10});$(".open-small-chat").click(function(){$(this).children().toggleClass("fa-comments").toggleClass("fa-remove");$(".small-chat-box").toggleClass("active")});$(".small-chat-box .content").slimScroll({height:"234px",railOpacity:0.4});$(".check-link").click(function(){var c=$(this).find("i");var b=$(this).next("span");c.toggleClass("fa-check-square").toggleClass("fa-square-o");b.toggleClass("todo-completed");return false});$(".navbar-minimalize").click(function(){$("body").toggleClass("mini-navbar");SmoothlyMenu()});$(".tooltip-demo").tooltip({selector:"[data-toggle=tooltip]",container:"body"});$(".modal").appendTo("body");function a(){var d=$("body > #wrapper").height()-61;$(".sidebard-panel").css("min-height",d+"px");var b=$("nav.navbar-default").height();var c=$("#page-wrapper").height();if(b>c){$("#page-wrapper").css("min-height",b+"px")}if(b<c){$("#page-wrapper").css("min-height",$(window).height()+"px")}if($("body").hasClass("fixed-nav")){if(b>c){$("#page-wrapper").css("min-height",b-60+"px")}else{$("#page-wrapper").css("min-height",$(window).height()-60+"px")}}}a();$(window).bind("load",function(){if($("body").hasClass("fixed-sidebar")){$(".sidebar-collapse").slimScroll({height:"100%",railOpacity:0.9})}});$(window).scroll(function(){if($(window).scrollTop()>0&&!$("body").hasClass("fixed-nav")){$("#right-sidebar").addClass("sidebar-top")}else{$("#right-sidebar").removeClass("sidebar-top")}});$(window).bind("load resize scroll",function(){if(!$("body").hasClass("body-small")){a()}});$("[data-toggle=popover]").popover();$(".full-height-scroll").slimscroll({height:"100%"})});$(window).bind("resize",function(){if($(this).width()<769){$("body").addClass("body-small")}else{$("body").removeClass("body-small")}});$(document).ready(function(){if(localStorageSupport){var e=localStorage.getItem("collapse_menu");var f=localStorage.getItem("fixedsidebar");var d=localStorage.getItem("fixednavbar");var b=localStorage.getItem("boxedlayout");var c=localStorage.getItem("fixedfooter");var a=$("body");if(f=="on"){a.addClass("fixed-sidebar");$(".sidebar-collapse").slimScroll({height:"100%",railOpacity:0.9})}if(e=="on"){if(a.hasClass("fixed-sidebar")){if(!a.hasClass("body-small")){a.addClass("mini-navbar")}}else{if(!a.hasClass("body-small")){a.addClass("mini-navbar")}}}if(d=="on"){$(".navbar-static-top").removeClass("navbar-static-top").addClass("navbar-fixed-top");a.addClass("fixed-nav")}if(b=="on"){a.addClass("boxed-layout")}if(c=="on"){$(".footer").addClass("fixed")}}});function localStorageSupport(){return(("localStorage" in window)&&window.localStorage!==null)}function animationHover(a,b){a=$(a);a.hover(function(){a.addClass("animated "+b)},function(){window.setTimeout(function(){a.removeClass("animated "+b)},2000)})}function SmoothlyMenu(){if(!$("body").hasClass("mini-navbar")||$("body").hasClass("body-small")){$("#side-menu").hide();setTimeout(function(){$("#side-menu").fadeIn(400)},200)}else{if($("body").hasClass("fixed-sidebar")){$("#side-menu").hide();setTimeout(function(){$("#side-menu").fadeIn(400)},100)}else{$("#side-menu").removeAttr("style")}}}function WinMove(){var b="[class*=col]";var c=".ibox-title";var a="[class*=col]";$(b).sortable({handle:c,connectWith:a,tolerance:"pointer",forcePlaceholderSize:true,opacity:0.8}).disableSelection()};
\ No newline at end of file
......@@ -9,18 +9,17 @@
},
bind:function(){
$('.order-amount-search').click(function(){
searchAmount('/amount');
})
$('.self-order-amount-search').click(function(){
searchAmount('/self_amount');
})
function searchAmount(url) {
var checkTime = $('#checkTime').val(),
var type = $('input[name=type]').val(),
checkTime = $('#checkTime').val(),
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
checkStatus = $('#checkStatus').val(),
checkStatus = $('#checkStatus').val();
if (type == 1) {
var url = '/amount';
} else {
var url = '/self_amount';
}
time_start = Date.parse(time_start) / 1000;
time_end = Date.parse(time_end) / 1000;
......@@ -28,7 +27,7 @@
url = url+'?checkTime='+checkTime+'&time_start='+time_start+'&time_end='+time_end+'&checkStatus='+checkStatus;
location.href = url;
}
})
}
}
......
......@@ -23,11 +23,12 @@
<div id="wrapper">
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
@include('layouts.header')
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins ibox-content" style="margin: 15px">
<div class="row mapping-rows" style="overflow:hidden;margin: 10px">
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<div class="row-fluid ibox-content">
@include("PaymentDays.$id")
</div>
</div>
......
......@@ -12,9 +12,9 @@
}
</style>
<div class="layui-table-box layui-form">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
<fieldset class="layui-elem-field layui-field-title table-responsive" style="margin-top: 20px;">
<legend>申请信息</legend>
<table class="layui-table">
<table class="layui-table table">
<thead>
<tr>
<th style="text-align: center">申请状态</th>
......@@ -40,9 +40,9 @@
</table>
</fieldset>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
<fieldset class="layui-elem-field layui-field-title table-responsive" style="margin-top: 20px;">
<legend>申请公司信息</legend>
<table class="layui-table">
<table class="layui-table table">
<thead>
<tr>
<th style="text-align: center">公司注册地址</th>
......
......@@ -17,7 +17,7 @@
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-input-inline" style="width: 420px">
<div class="layui-input-inline payment-status">
<input type="hidden" name="status" value="1,2,">
@if(!empty($Status) && is_array($Status))
@foreach($Status as $k=>$v)
......
......@@ -11,12 +11,24 @@
@include('addOffline.js')
</head>
<body class="body-small" style="min-width:1024px;">
<body class="body-small">
<div id="wrapper">
<!-- layouts.navigation -->
@include('layouts.navigation')
@include('addOffline.content')
<div id="page-wrapper" class="gray-bg">
<div class="row">
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<div class="ibox float-e-margins">
@include('addOffline.content')
</div>
</div>
</div>
</div>
</div>
</div>
</body>
......@@ -11,12 +11,24 @@
@include('addOffline.js')
</head>
<body class="body-small" style="min-width:1024px;">
<body class="body-small">
<div id="wrapper">
<!-- layouts.navigation -->
@include('layouts.navigation')
@include('addOnline.content')
<div id="page-wrapper" class="gray-bg">
<div class="row">
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<div class="ibox float-e-margins">
@include('addOnline.content')
</div>
</div>
</div>
</div>
</div>
</div>
</body>
......@@ -11,12 +11,26 @@
@include('addOffline.js')
</head>
<body class="body-small" style="min-width:1024px;">
<body class="body-small">
<div id="wrapper">
<!-- layouts.navigation -->
@include('layouts.navigation')
@include('addOrder.content')
<div id="page-wrapper" class="gray-bg">
<div class="row">
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<div class="ibox float-e-margins">
@include('addOrder.content')
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<div class="page-content order-details">
<ul class="nav nav-tabs">
@if (isset($_REQUEST['tags']))
<li><a href="{{URL('erp_order')}}">ERP订单</a></li>
<li><a href="/details/{{$detail['order_id']}}?tags={{$_REQUEST['tags']}}">订单详情</a></li>
@else
<li><a href="{{URL('list')}}">平台订单</a></li>
<li><a href="{{URL('details', ['order_id'=>$detail['order_id']])}}">订单详情</a></li>
@endif
<div class="wrapper">
@include('layouts.header')
<li class="active"><a href="javascript:;">订单发票信息</a></li>
</ul>
<?php
$route = \Route::current()->getActionName();
$action_name = explode('@', $route)[1];
?>
<input type="hidden" class="action_type" value="{{$action_name}}">
<div class="page-content order-details">
<!-- <ul class="nav nav-tabs">
@if (isset($_REQUEST['tags']))
<li><a href="{{URL('erp_order')}}">ERP订单</a></li>
<li><a href="/details/{{$detail['order_id']}}?tags={{$_REQUEST['tags']}}">订单详情</a></li>
@else
<li><a href="{{URL('list')}}">平台订单</a></li>
<li><a href="{{URL('details', ['order_id'=>$detail['order_id']])}}">订单详情</a></li>
@endif
<div class="tabs-box shipping-info">
<form action="{{URL('changeInvoice')}}" method="POST">
<input type="hidden" name="order_id" value="{{$detail['order_id']}}">
<table class="table table-bordered table-hover order-invoice">
<caption><h3>订单发票信息</h3></caption>
<tr>
<td width="10%">发票类型</td>
<td width="40%">
<select name="inv_type" id="inv_type" style="width:164px;">
<option value="1">不开发票</option>
<option value="2">普通发票</option>
<option value="3">增值税发票</option>
</select>
</td>
<td width="10%">开票状态</td>
<td width="40%">
<input type="hidden" name="invoice_status" value="{{$detail['invoice_status']}}">
<?php
switch ($detail['invoice_status']) {
case -1: echo '<span class="error">待确认</span>';break;
case 1: echo '<span class="error">已开票</span>';break;
case 2: echo '<span class="error">已发货</span>';break;
case 3: echo '<span class="error">已签收</span>';break;
}
?>
</td>
</tr>
<li class="active"><a href="javascript:;">订单发票信息</a></li>
</ul> -->
<?php
$route = \Route::current()->getActionName();
$action_name = explode('@', $route)[1];
?>
<input type="hidden" class="action_type" value="{{$action_name}}">
<tr>
<td>发票抬头</td>
<td class="invoice_title">
<input type="text" name="tax_title" value="{{$detail['tax_title']}}">
</td>
<td class="add_tax">税务登记号</td>
<td class="add_tax">
<input type="text" name="tax_no" value="{{$detail['tax_no']}}">
</td>
</tr>
<div class="tabs-box shipping-info">
<form action="{{URL('changeInvoice')}}" method="POST" class="table-responsive">
<input type="hidden" name="order_id" value="{{$detail['order_id']}}">
<table class="table table-bordered table-hover order-invoice">
<caption><h3>订单发票信息</h3></caption>
<tr>
<td width="10%">发票类型</td>
<td width="40%">
<select name="inv_type" id="inv_type" style="width:164px;">
<option value="1">不开发票</option>
<option value="2">普通发票</option>
<option value="3">增值税专用发票</option>
<option value="4">增值税普通发票</option>
</select>
</td>
<td width="10%">开票状态</td>
<td width="40%">
<input type="hidden" name="invoice_status" value="{{$detail['invoice_status']}}">
<?php
switch ($detail['invoice_status']) {
case -1: echo '<span class="error">待确认</span>';break;
case 1: echo '<span class="error">已开票</span>';break;
case 2: echo '<span class="error">已发货</span>';break;
case 3: echo '<span class="error">已签收</span>';break;
}
?>
</td>
</tr>
<tr class="add_tax">
<td>开户银行</td>
<td>
<input type="text" name="bank_name" value="{{$detail['bank_name']}}">
</td>
<td>银行卡</td>
<td>
<input type="text" name="bank_account" value="{{$detail['bank_account']}}">
</td>
</tr>
<tr>
<td>发票抬头</td>
<td class="invoice_title">
<input type="text" name="tax_title" value="{{$detail['tax_title']}}">
</td>
<td class="add_tax">税务登记</td>
<td class="add_tax">
<input type="text" name="tax_no" value="{{$detail['tax_no']}}">
</td>
</tr>
<tr class="add_tax">
<td>公司电话</td>
<td>
<input type="text" name="company_phone" value="{{$detail['company_phone']}}">
</td>
<td>公司注册地址</td>
<td>
<textarea name="company_address" id="company_address" cols="30" rows="10" placeholder="请填写详细地址">{{$detail['company_address']}}</textarea>
</td>
</tr>
<tr class="add_tax">
<td>开户银行</td>
<td>
<input type="text" name="bank_name" value="{{$detail['bank_name']}}">
</td>
<td>银行卡号</td>
<td>
<input type="text" name="bank_account" value="{{$detail['bank_account']}}">
</td>
</tr>
<tr>
<td colspan="4"><input type="submit" value="保存" class="btn btn-success"></td>
</tr>
</table>
</form>
<tr class="add_tax">
<td>公司电话</td>
<td>
<input type="text" name="company_phone" value="{{$detail['company_phone']}}">
</td>
<td>公司注册地址</td>
<td>
<textarea name="company_address" id="company_address" cols="50" rows="2" placeholder="请填写详细地址">{{$detail['company_address']}}</textarea>
</td>
</tr>
<tr>
<td colspan="4"><input type="submit" value="保存" class="btn btn-success"></td>
</tr>
</table>
</form>
</div>
</div>
</div>
......
<div class="page-content order-details">
<ul class="nav nav-tabs">
@if (isset($_REQUEST['tags']))
<li><a href="{{URL('erp_order')}}">ERP订单</a></li>
<li><a href="/details/{{$detail['order_id']}}?tags={{$_REQUEST['tags']}}">订单详情</a></li>
@else
<li><a href="{{URL('list')}}">平台订单</a></li>
<li><a href="{{URL('details', ['order_id'=>$detail['order_id']])}}">订单详情</a></li>
@endif
<li class="active"><a href="javascript:;">订单收货信息</a></li>
</ul>
<?php
<div class="wrapper">
@include('layouts.header')
<div class="page-content order-details">
<!-- <ul class="nav nav-tabs">
@if (isset($_REQUEST['tags']))
<li><a href="{{URL('erp_order')}}">ERP订单</a></li>
<li><a href="/details/{{$detail['order_id']}}?tags={{$_REQUEST['tags']}}">订单详情</a></li>
@else
<li><a href="{{URL('list')}}">平台订单</a></li>
<li><a href="{{URL('details', ['order_id'=>$detail['order_id']])}}">订单详情</a></li>
@endif
<li class="active"><a href="javascript:;">订单收货信息</a></li>
</ul> -->
<?php
$route = \Route::current()->getActionName();
$action_name = explode('@', $route)[1];
?>
<input type="hidden" class="action_type" value="{{$action_name}}">
<input type="hidden" class="action_type" value="{{$action_name}}">
<div class="tabs-box shipping-info">
<form action="{{URL('changeShipping')}}" method="POST">
<input type="hidden" name="order_id" value="{{$detail['order_id']}}">
<table class="table table-hover table-bordered">
<caption><h3>订单物流信息</h3></caption>
<tr>
<th width="10%">配送方式</th>
<td colspan="3">
<label class="radio-inline">
<input type="radio" name="shipping_type" class="shipping_type" value="1"> 快递配送
</label>
<label class="radio-inline">
<input type="radio" name="shipping_type" class="shipping_type" value="2"> 上门自提
</label>
</td>
</tr>
<div class="tabs-box shipping-info">
<form action="{{URL('changeShipping')}}" method="POST" class="table-responsive">
<input type="hidden" name="order_id" value="{{$detail['order_id']}}">
<table class="table table-hover table-bordered">
<caption><h3>订单物流信息</h3></caption>
<tr>
<th width="10%">配送方式</th>
<td>
<label class="radio-inline">
<input type="radio" name="shipping_type" class="shipping_type" value="1"> 快递配送
</label>
<label class="radio-inline">
<input type="radio" name="shipping_type" class="shipping_type" value="2"> 上门自提
</label>
</td>
</tr>
<tr>
<th width="10%">收货人</th>
<td><input type="text" name="consignee" value="{{$detail['consignee']}}"></td>
<th width="10%">联系电话</th>
<td><input type="text" name="mobile" value="{{$detail['mobile']}}"></td>
</tr>
<tr>
<th width="10%">收货人</th>
<td><input type="text" name="consignee" value="{{$detail['consignee']}}"></td>
</tr>
<tr class="address-info">
<th width="10%">收货地址</th>
<td colspan="3">
<select class="address s_province" name="province" default="{{$detail['province']}}"></select>
<select class="address s_city" name="city" default="{{$detail['city']}}"></select>
<select class="address s_county" name="district" default="{{$detail['district']}}"></select>
</td>
</tr>
<tr>
<th width="10%">详细地址</th>
<td colspan="3"><textarea class="form-control" name="address" placeholder="请输入详细地址">{{$detail['address']}}</textarea></td>
</tr>
<tr>
<td colspan="4"><input type="submit" value="保存" class="btn btn-success"></td>
</tr>
</table>
</form>
<tr>
<th width="10%">联系电话</th>
<td><input type="text" name="mobile" value="{{$detail['mobile']}}"></td>
</tr>
<tr class="address-info">
<th width="10%">收货地址</th>
<td>
<select class="address s_province" name="province" default="{{$detail['province']}}"></select>
<select class="address s_city" name="city" default="{{$detail['city']}}"></select>
<select class="address s_county" name="district" default="{{$detail['district']}}"></select>
</td>
</tr>
<tr>
<th width="10%">详细地址</th>
<td><textarea class="form-control" name="address" placeholder="请输入详细地址">{{$detail['address']}}</textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="保存" class="btn btn-success"></td>
</tr>
</table>
</form>
</div>
</div>
</div>
......@@ -78,9 +84,9 @@
}
if (goods_type == 2) {
var self_addr = '深圳市光明新区新湖街道楼村社区荔都路32号A栋三楼';
var self_addr = "{{ Config('params.self_addr') }}";
} else {
var self_addr = '深圳市龙岗区坂田五和大道南2号万科星火online六栋三楼猎芯科技';
var self_addr = "{{ Config('params.joint_addr') }}";
}
$('.shipping_type').change(function() {
......
<div class="page-content">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">联营订单状态概览</a></li>
<li><a href="{{URL('amount')}}">订单金额统计</a></li>
</ul>
<div class="tabs-box">
<div class="row-fluid">
<table class="table">
<tr>
<th>时间</th>
<th title = "指定时间内,新创建的订单,不考虑该订单是否有状态变化。">新创建订单数</th>
<th title = "指定时间内,新创建的订单中,未经过审核的订单数量。(对应待审核状态)">待审核</th>
<th title = "指定时间内,后台审核通过,但客户未付款的订单数量。(对应待付款状态)">审核通过</th>
<th title = "指定时间内,预付款订单,客户支付了首款,并系统对账完成的订单数量。(对应待付尾款状态)">已付定金</th>
<th title = "指定时间内,客户完成了所有款项的支付,并系统对账完成的订单数量。(对应待发货状态)">已付全款</th>
<th title = "指定时间内,订单完成发货,但客户还未完成收货状态的订单数量。(对应待收货状态)">待收货</th>
<th title = "指定时间内,订单已完成状态的订单数量(对应已完成状态)">已完成</th>
<th title = "指定时间内,订单已取消的订单数量(对应已取消状态) ">已取消</th>
</tr>
<tr>
<td>今日</td>
<td>{{$count['all']['today']}}</td>
<td>{{$count['waitCheck']['today']}}</td>
<td>{{$count['checkPass']['today']}}</td>
<td>{{$count['paidPre']['today']}}</td>
<td>{{$count['paid']['today']}}</td>
<td>{{$count['send']['today']}}</td>
<td>{{$count['done']['today']}}</td>
<td>{{$count['cancel']['today']}}</td>
</tr>
<tr>
<td>近7天</td>
<td>{{$count['all']['week']}}</td>
<td>{{$count['waitCheck']['week']}}</td>
<td>{{$count['checkPass']['week']}}</td>
<td>{{$count['paidPre']['week']}}</td>
<td>{{$count['paid']['week']}}</td>
<td>{{$count['send']['week']}}</td>
<td>{{$count['done']['week']}}</td>
<td>{{$count['cancel']['week']}}</td>
</tr>
<tr>
<td>近30天</td>
<td>{{$count['all']['month']}}</td>
<td>{{$count['waitCheck']['month']}}</td>
<td>{{$count['checkPass']['month']}}</td>
<td>{{$count['paidPre']['month']}}</td>
<td>{{$count['paid']['month']}}</td>
<td>{{$count['send']['month']}}</td>
<td>{{$count['done']['month']}}</td>
<td>{{$count['cancel']['month']}}</td>
</tr>
</table>
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">{{ $type == 1 ? '联营订单状态概览' : '自营订单状态概览' }}</a></li>
<li><a href="{{ $type == 1 ? URL('amount') : URL('self_amount') }}">{{ $type == 1 ? '联营订单金额统计' : '自营订单金额统计' }}</a></li>
</ul>
<div class="tabs-box">
<div class="row-fluid table-responsive">
<table class="table">
<tr>
<th>时间</th>
<th title = "指定时间内,新创建的订单,不考虑该订单是否有状态变化。">新创建订单数</th>
<th title = "指定时间内,新创建的订单中,未经过审核的订单数量。(对应待审核状态)">待审核</th>
<th title = "指定时间内,后台审核通过,但客户未付款的订单数量。(对应待付款状态)">审核通过</th>
<th title = "指定时间内,预付款订单,客户支付了首款,并系统对账完成的订单数量。(对应待付尾款状态)">已付定金</th>
<th title = "指定时间内,客户完成了所有款项的支付,并系统对账完成的订单数量。(对应待发货状态)">已付全款</th>
<th title = "指定时间内,订单完成发货,但客户还未完成收货状态的订单数量。(对应待收货状态)">待收货</th>
<th title = "指定时间内,订单已完成状态的订单数量(对应已完成状态)">已完成</th>
<th title = "指定时间内,订单已取消的订单数量(对应已取消状态) ">已取消</th>
</tr>
<tr>
<td>今日</td>
<td>{{$count['all']['today']}}</td>
<td>{{$count['waitCheck']['today']}}</td>
<td>{{$count['checkPass']['today']}}</td>
<td>{{$count['paidPre']['today']}}</td>
<td>{{$count['paid']['today']}}</td>
<td>{{$count['send']['today']}}</td>
<td>{{$count['done']['today']}}</td>
<td>{{$count['cancel']['today']}}</td>
</tr>
<tr>
<td>近7天</td>
<td>{{$count['all']['week']}}</td>
<td>{{$count['waitCheck']['week']}}</td>
<td>{{$count['checkPass']['week']}}</td>
<td>{{$count['paidPre']['week']}}</td>
<td>{{$count['paid']['week']}}</td>
<td>{{$count['send']['week']}}</td>
<td>{{$count['done']['week']}}</td>
<td>{{$count['cancel']['week']}}</td>
</tr>
<tr>
<td>近30天</td>
<td>{{$count['all']['month']}}</td>
<td>{{$count['waitCheck']['month']}}</td>
<td>{{$count['checkPass']['month']}}</td>
<td>{{$count['paidPre']['month']}}</td>
<td>{{$count['paid']['month']}}</td>
<td>{{$count['send']['month']}}</td>
<td>{{$count['done']['month']}}</td>
<td>{{$count['cancel']['month']}}</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<script>
......
......@@ -2,7 +2,7 @@
<div class="tabs-box">
<div class="order-change-main">
@if ($order_info['status'] == 1)
<form id="checkOrderForm" class="form-horizontal">
<form id="checkOrderForm" class="form-horizontal table-responsive">
<input type="hidden" name="order_sn" value="{{$order_info['order_sn']}}">
<input type="hidden" name="user_id" value="{{$order_info['user_id']}}">
<input type="hidden" name="order_id" value="{{$order_info['order_id']}}">
......@@ -348,7 +348,7 @@
<div class="tabs-box adjusted_order" style="display: none;">
<div class="order-change-main">
<form id="adjustedOrderForm" class="form-horizontal">
<form id="adjustedOrderForm" class="form-horizontal table-responsive">
<input type="hidden" name="order_id" value="{{$order_info['order_id']}}">
<input type="hidden" name="sale_id" value="{{$order_info['sale_id']}}">
<input type="hidden" name="extra_fee" value="{{$order_temp_info['extra_fee']}}">
......
......@@ -5,7 +5,7 @@
<p class="error">订单已推送!</p>
@endif
<form id="sendSalesForm" class="form-horizontal">
<form id="sendSalesForm" class="form-horizontal table-responsive">
<input type="hidden" name="order_id" value="{{$order_info['order_id']}}">
<table class="table table-bordered table-hover check-table" style="min-height:150px;">
......
......@@ -12,9 +12,7 @@
</head>
<body class="">
<div id="wrapper">
<!-- layouts.navigation -->
<div id="wrapper">
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
......
<div class="wrapper wrapper-content">
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<ul class="nav nav-tabs">
<!-- <ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">ERP订单</a></li>
</ul>
</ul> -->
<div class="tabs-box">
<div class="row-fluid search-box">
......@@ -21,14 +23,14 @@
</ul>
</div>
</dd>
<dd><input type="text" name="order_contain" value="{{$condition['order_contain']}}" placeholder="请输入内容"></dd>
<dd class="order_contain"><input type="text" name="order_contain" value="{{$condition['order_contain']}}" placeholder="请输入内容"></dd>
</dl>
<dl>
<dt>创建日期: </dt>
<dd style="width:auto !important;">
<input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" />
</dd>
<dd>
<dd style="width:auto !important;">
<input type="text" name="time_end" value="{{ !empty($condition['time_end']) ? date('Y/m/d', $condition['time_end']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="结束时间" autocomplete="off" />
</dd>
</dl>
......@@ -211,7 +213,7 @@
<td class="show-list">{{date('Y-m-d', $v['create_time'])}}</td>
<td>
<div class="btn-group btn-group-xs">
<a class="btn btn-primary" href="/details/{{$v['order_id']}}?tags=erp">详情</a>
<a class="btn btn-primary" href="/details/{{$v['order_id']}}?tags=erp" target="_blank">详情</a>
</div>
</td>
</tr>
......
<div class="page-content">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">自营快递配置</a></li>
</ul>
<div class="tabs-box">
<div class="row-fluid">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>配置名称</th>
<th>描述</th>
<th>操作</th>
</tr>
</thead>
<div class="wrapper">
@include('layouts.header')
<tbody>
<tr>
<td>自营快递价格</td>
<td>深圳市:¥{{$express_fee['sz_inside']}}, 广东省内:¥{{$express_fee['gd_inside']}}, 广东省外:¥{{$express_fee['gd_outside']}}</td>
<td>
<button class="btn btn-info btn-xs update_express">修改</button>
</td>
</tr>
</tbody>
</table>
<div class="page-content">
<!-- <ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">自营快递配置</a></li>
</ul> -->
<div class="tabs-box">
<div class="row-fluid table-responsive">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>配置名称</th>
<th>描述</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>自营快递价格</td>
<td>深圳市:¥{{$express_fee['sz_inside']}}, 广东省内:¥{{$express_fee['gd_inside']}}, 广东省外:¥{{$express_fee['gd_outside']}}</td>
<td>
<button class="btn btn-info btn-xs update_express">修改</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script>
......
<div class="row wrapper border-bottom white-bg page-heading">
<a class="navbar-minimalize minimalize-styl-2 btn btn-primary pull-left" style="margin-left:0px;margin-top:18px;" href="#"><i class="fa fa-bars"></i> </a>
<div class="col-lg-10" style="padding-left:0px;">
<div class="col-lg-10 side-section" style="padding-left:0px;">
<h2>{{ $title }}</h2>
<ol class="breadcrumb">
{{--@for ($i = 0; $i < count($paths); $i++)--}}
{{--@if ($i == count($paths) - 1)--}}
{{--<li><a href="{{ $paths[$i]["href"] }}">{{ $paths[$i]["title"] }}</a></li>--}}
{{--@else--}}
{{--<li class="active"><a>{{ $paths[$i]["title"] }}</a></li>--}}
{{--@endif--}}
{{--@endfor--}}
<?php echo Crumbs($menus, $uri); ?>
@if (!empty($paths))
@for ($i = 0; $i < count($paths); $i++)
<li><a href="{{ $paths[$i]["href"] }}">{{ $paths[$i]["title"] }}</a></li>
@endfor
@else
<?php echo Crumbs($menus, $uri) ?>
@endif
</ol>
</div>
</div>
......@@ -16,7 +16,7 @@
</div>
</li>
<?php echo App\Http\Controllers\createMenu($menus, $uri); ?>
<?php echo createMenu($menus, $uri); ?>
</ul>
</div>
</nav>
......@@ -12,9 +12,7 @@
</head>
<body class="">
<div id="wrapper">
<!-- layouts.navigation -->
<div id="wrapper">
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
......
<div class="wrapper wrapper-content">
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<ul class="nav nav-tabs">
<!-- <ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">平台订单</a></li>
</ul>
</ul> -->
<div class="tabs-box">
<div class="row-fluid search-box">
......@@ -21,14 +23,14 @@
</ul>
</div>
</dd>
<dd><input type="text" name="order_contain" value="{{$condition['order_contain']}}" placeholder="请输入内容"></dd>
<dd class="order_contain"><input type="text" name="order_contain" value="{{$condition['order_contain']}}" placeholder="请输入内容"></dd>
</dl>
<dl>
<dt>创建日期: </dt>
<dd style="width:auto !important;">
<input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" />
</dd>
<dd>
<dd style="width:auto !important;">
<input type="text" name="time_end" value="{{ !empty($condition['time_end']) ? date('Y/m/d', $condition['time_end']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="结束时间" autocomplete="off" />
</dd>
</dl>
......@@ -172,8 +174,8 @@
@if (in_array('check_test_order', $userPerms))
<dl>
<dt></dt>
<dd>
<label><input type="checkbox" name="test_order"> 所有订单-包括测试</label>
<dd class="test-order">
<label><input type="checkbox" name="test_order">所有订单-包括测试</label>
</dd>
</dl>
@endif
......
<div class="wrapper wrapper-content">
<div class="wrapper">
@include('layouts.header')
<div class="page-content">
<ul class="nav nav-tabs">
<!-- <ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">自营订单</a></li>
</ul>
</ul> -->
<div class="tabs-box">
<div class="row-fluid search-box">
......@@ -22,14 +24,14 @@
</ul>
</div>
</dd>
<dd><input type="text" name="order_contain" value="{{$condition['order_contain']}}" placeholder="请输入内容"></dd>
<dd class="order_contain"><input type="text" name="order_contain" value="{{$condition['order_contain']}}" placeholder="请输入内容"></dd>
</dl>
<dl>
<dt>创建日期: </dt>
<dd style="width:auto !important;">
<input type="text" name="time_start" value="{{ !empty($condition['time_start']) ? date('Y/m/d', $condition['time_start']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="开始时间" autocomplete="off" />
</dd>
<dd>
<dd style="width:auto !important;">
<input type="text" name="time_end" value="{{ !empty($condition['time_end']) ? date('Y/m/d', $condition['time_end']) : '' }}" class="Wdate " onfocus="WdatePicker({dateFmt:'yyyy/MM/dd'})" placeholder="结束时间" autocomplete="off" />
</dd>
</dl>
......@@ -149,7 +151,7 @@
@if (in_array('self_check_test_order', $userPerms))
<dl>
<dt></dt>
<dd>
<dd class="test-order">
<label><input type="checkbox" name="test_order"> 所有订单-包括测试</label>
</dd>
</dl>
......
<div class="page-content">
<ul class="nav nav-tabs">
<li><a href="{{URL('self_count')}}">自营订单数统计</a></li>
<li class="active"><a href="javascript:;">订单金额统计</a></li>
</ul>
<div class="tabs-box">
<div class="row-fluid order-amount">
<select name="checkTime" id="checkTime" style="width: 150px; margin-bottom: 0;">
<option value="1">订单付款时间</option>
<option value="2">订单创建时间</option>
</select>
<input type="text" readonly name="time_start" value="{{ !empty($time_start) ? date('Y-m-d H:i:s', $time_start) : '' }}" class="Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
<span> - </span>
<input type="text" readonly name="time_end" value="{{ !empty($time_end) ? date('Y-m-d H:i:s', $time_end) : '' }}" class="Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
<select name="checkStatus" id="checkStatus" style="width: 80px; margin-bottom: 0;">
<option value="1">全部</option>
<option value="2">已完成</option>
<option value="3">未完成</option>
</select>
<button class="btn btn-primary self-order-amount-search">搜索</button>
</div>
</div>
<div class="tabs-box">
<div class="row-fluid">
<table class="table table-bordered">
<tr>
<th>序号</th>
<th>订单号</th>
<th>订单付款时间</th>
<th>交易完成时间</th>
<th>订单金额</th>
</tr>
<empty name="list">
@if (empty($list))
<tr><td colspan="5">没有更多数据~</td></tr>
@else
@foreach ($list as $key => $vo)
<tr>
<td>{{$key + 1}}</td>
<td>{{$vo['order_sn']}}</td>
<td>
<?php
// 全款
if ($vo['order_pay_type'] == 1) {
echo date('Y-m-d H:i:s', $vo['pay_time']);
} else if ($vo['order_pay_type'] == 2) { // 预付款
$exp = explode(',', $vo['pay_time']);
$pay_amount = explode(',', $vo['pay_amount']);
if (count($exp) == 1) {
// 如果有两条金额记录,支付时间只有一条,则首尾款时间一致
if (count($pay_amount) == 2) {
echo date('Y-m-d H:i:s', $exp[0]).' (尾款)<br>'.date('Y-m-d H:i:s', $exp[0]).' (首款)';
} else {
if ($vo['pay_type'] == 2) {
echo date('Y-m-d H:i:s', $exp[0]).' (首款)';
} else {
echo date('Y-m-d H:i:s', $exp[0]).' (尾款)';
}
}
} else {
if ($exp[0] < $exp[1]){
echo date('Y-m-d H:i:s', $exp[1]).' (尾款)<br>'.date('Y-m-d H:i:s', $exp[0]).' (首款)';
} else {
echo date('Y-m-d H:i:s', $exp[0]).' (尾款)<br>'.date('Y-m-d H:i:s', $exp[1]).' (首款)';
}
}
}
?>
</td>
<td>
@if ($vo['finish_time'] != 0)
{{date('Y-m-d H:i:s', $vo['finish_time'])}}
@endif
</td>
<td>
<?php
if ($vo['currency'] == 1) {
$currency = '¥';
} else {
$currency = '$';
}
if ($vo['order_pay_type'] == 1) { // 全款
echo $currency.$vo['pay_amount'];
} else if ($vo['order_pay_type'] == 2) { // 预付款
$exp = explode(',', $vo['pay_amount']);
if (count($exp) == 1) {
if ($vo['pay_type'] == 2) {
echo $currency.$exp[0].' (首款)';
} else {
echo $currency.$exp[0].' (尾款)';
}
} else {
if ($exp[0] > $exp[1]) {
echo $currency.$exp[0].' (尾款)<br>'.$currency.$exp[1].' (首款)';
} else {
echo $currency.$exp[1].' (尾款)<br>'.$currency.$exp[0].' (首款)';
}
}
}
?>
</td>
</tr>
@endforeach
@endif
</table>
</div>
<div class="row-fluid pagination">
<span>
@if ($checkStatus == 1)
实收金额:¥{{isset($pay_count['rmb_pay']) ? $pay_count['rmb_pay'] : 0}} &nbsp; ${{isset($pay_count['usd_pay']) ? $pay_count['usd_pay'] : 0}}
已完成金额:¥{{!empty($pay_count['rmb_pay_finish']) ? $pay_count['rmb_pay_finish'] : 0}} &nbsp; ${{!empty($pay_count['usd_pay_finish']) ? $pay_count['usd_pay_finish'] : 0}}
未完成金额:¥{{!empty($pay_count['rmb_pay_unfinish']) ? $pay_count['rmb_pay_unfinish'] : 0}} &nbsp; ${{!empty($pay_count['usd_pay_unfinish']) ? $pay_count['usd_pay_unfinish'] : 0}}
@elseif ($checkStatus == 2)
实收金额:¥{{isset($pay_count['rmb_pay']) ? $pay_count['rmb_pay'] : 0}} &nbsp; ${{isset($pay_count['usd_pay']) ? $pay_count['usd_pay'] : 0}}
已完成金额:¥{{!empty($pay_count['rmb_pay_finish']) ? $pay_count['rmb_pay_finish'] : 0}} &nbsp; ${{!empty($pay_count['usd_pay_finish']) ? $pay_count['usd_pay_finish'] : 0}}
@else
实收金额:¥{{isset($pay_count['rmb_pay']) ? $pay_count['rmb_pay'] : 0}} &nbsp; ${{isset($pay_count['usd_pay']) ? $pay_count['usd_pay'] : 0}}
未完成金额:¥{{!empty($pay_count['rmb_pay_unfinish']) ? $pay_count['rmb_pay_unfinish'] : 0}} &nbsp; ${{!empty($pay_count['usd_pay_unfinish']) ? $pay_count['usd_pay_unfinish'] : 0}}
@endif
</span>
<?php echo isset($page) ? $page : ''; ?>
</div>
</div>
</div>
<script>
$.lie.orderamount.index();
var checkTime = '{{$checkTime}}';
var checkStatus = '{{$checkStatus}}';
$('#checkTime').val(checkTime);
$('#checkStatus').val(checkStatus);
$('#side-menu').children('li').last().attr('class', 'active');
$('#side-menu').children('li').last().children('ul').children('li').eq(2).attr('class', 'active');
</script>
\ No newline at end of file
<div class="page-content">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">自营订单状态概览</a></li>
<li><a href="{{URL('self_amount')}}">订单金额统计</a></li>
</ul>
<div class="tabs-box">
<div class="row-fluid">
<table class="table">
<tr>
<th>时间</th>
<th title = "指定时间内,新创建的订单,不考虑该订单是否有状态变化。">新创建订单数</th>
<th title = "指定时间内,客户完成了所有款项的支付,并系统对账完成的订单数量。(对应待发货状态)">已付款</th>
<th title = "指定时间内,订单完成发货,但客户还未完成收货状态的订单数量。(对应待收货状态)">待收货</th>
<th title = "指定时间内,订单已完成状态的订单数量(对应已完成状态)">已完成</th>
<th title = "指定时间内,订单已取消的订单数量(对应已取消状态) ">已取消</th>
</tr>
<tr>
<td>今日</td>
<td>{{$count['all']['today']}}</td>
<td>{{$count['paid']['today']}}</td>
<td>{{$count['send']['today']}}</td>
<td>{{$count['done']['today']}}</td>
<td>{{$count['cancel']['today']}}</td>
</tr>
<tr>
<td>近7天</td>
<td>{{$count['all']['week']}}</td>
<td>{{$count['paid']['week']}}</td>
<td>{{$count['send']['week']}}</td>
<td>{{$count['done']['week']}}</td>
<td>{{$count['cancel']['week']}}</td>
</tr>
<tr>
<td>近30天</td>
<td>{{$count['all']['month']}}</td>
<td>{{$count['paid']['month']}}</td>
<td>{{$count['send']['month']}}</td>
<td>{{$count['done']['month']}}</td>
<td>{{$count['cancel']['month']}}</td>
</tr>
</table>
</div>
</div>
</div>
<script>
$.lie.order.index();
</script>
\ No newline at end of file
*
!.gitignore
\ No newline at end of file
/vendor
composer.phar
composer.lock
.DS_Store
\ No newline at end of file
Copyright (C) 2013-2014 Barry vd. Heuvel
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
# Changelog for Laravel Debugbar
## 1.8.4 (2014-10-31)
- Add Redis/PDO storage options
## 1.8.3 (2014-11-23)
- Base EventCollector on TimeData Collector
## 1.8.2 (2014-11-18)
- Use XHR handler instead of jQuery handler
## 1.8.1 (2014-11-14)
- Fix compatability with Symfony 2.3 (Laravel 4.)
## 1.8.0 (2014-10-31)
- Fix L5 compatability
- add hints + explain options to QueryLogger
- update to Debugbar 1.10.x
- new ViewCollector layout with more information
## 1.7.7 (2014-09-15)
- Make it compatible with Laravel 5.0-dev
- Allow anonymous function as `enabled` setting (for IP checks etc)
- Escape query bindings, to prevent executing of scripts/html
## 1.7.6 (2014-09-12)
- Fix reflash bug
- Fix caching of debugbar assets
## 1.7.5 (2014-09-12)
- Reflash data for all debugbar requests
## 1.7.4 (2014-09-08)
- Rename assets routes to prevent Nginx conflicts
## 1.7.3 (2014-09-05)
- Add helper functions (debug(), add/start/stop_measure() and measure()
- Collect data on responses that are not redirect/ajax/html also.
## 1.7.2 (2014-09-04)
- Fix 4.0 compatibility (problem with Controller namespace)
- Give deprecation notice instead of publishing assets.
## 1.7.1 (2014-09-03)
- Deprecated `debugbar:publish` command in favor of AssetController
- Fixed issue with detecting absolute paths in Windows
## 1.7.0 (2014-09-03)
- Use AssetController instead of publishing assets to the public folder.
- Inline fonts + images to base64 Data-URI
- Use PSR-4 file structure
## 1.6.8 (2014-08-27)
- Change OpenHandler layout
- Add backtrace option for query origin
## 1.6.7 (2014-08-09)
- Add Twig extensions for better integration with rcrowe/TwigBridge
## 1.6.6 (2014-07-08)
- Check if Requests wantsJSON instead of only isXmlHttpRequest
- Make sure closure for timing is run, even when disabled
## 1.6.5 (2014-06-24)
- Add Laravel style
## 1.6.4 (2014-06-15)
- Work on non-UTF-8 handling
\ No newline at end of file
{
"name": "barryvdh/laravel-debugbar",
"description": "PHP Debugbar integration for Laravel",
"keywords": ["laravel", "debugbar", "profiler", "debug", "webprofiler"],
"license": "MIT",
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"require": {
"php": ">=5.5.9",
"illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*",
"symfony/finder": "~2.7|~3.0",
"maximebf/debugbar": "~1.13.0"
},
"autoload": {
"psr-4": {
"Barryvdh\\Debugbar\\": "src/"
},
"files": [
"src/helpers.php"
]
}
}
<?php
return [
/*
|--------------------------------------------------------------------------
| Debugbar Settings
|--------------------------------------------------------------------------
|
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
|
*/
'enabled' => env('DEBUGBAR_ENABLED', null),
/*
|--------------------------------------------------------------------------
| Storage settings
|--------------------------------------------------------------------------
|
| DebugBar stores data for session/ajax requests.
| You can disable this, so the debugbar stores data in headers/session,
| but this can cause problems with large data collectors.
| By default, file storage (in the storage folder) is used. Redis and PDO
| can also be used. For PDO, run the package migrations first.
|
*/
'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '' // Instance of StorageInterface for custom driver
],
/*
|--------------------------------------------------------------------------
| Vendors
|--------------------------------------------------------------------------
|
| Vendor files are included by default, but can be set to false.
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
| and for js: jquery and and highlight.js
| So if you want syntax highlighting, set it to true.
| jQuery is set to not conflict with existing jQuery scripts.
|
*/
'include_vendors' => true,
/*
|--------------------------------------------------------------------------
| Capture Ajax Requests
|--------------------------------------------------------------------------
|
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
| you can use this option to disable sending the data through the headers.
|
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
*/
'capture_ajax' => true,
'add_ajax_timing' => false,
/*
|--------------------------------------------------------------------------
| Custom Error Handler for Deprecated warnings
|--------------------------------------------------------------------------
|
| When enabled, the Debugbar shows deprecated warnings for Symfony components
| in the Messages tab.
|
*/
'error_handler' => false,
/*
|--------------------------------------------------------------------------
| Clockwork integration
|--------------------------------------------------------------------------
|
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
*/
'clockwork' => false,
/*
|--------------------------------------------------------------------------
| DataCollectors
|--------------------------------------------------------------------------
|
| Enable/disable DataCollectors
|
*/
'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => true, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => true, // Display session data
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
],
/*
|--------------------------------------------------------------------------
| Extra options
|--------------------------------------------------------------------------
|
| Configure some DataCollectors
|
*/
'options' => [
'auth' => [
'show_name' => true, // Also show the users name/email in the debugbar
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'timeline' => false, // Add the queries to the timeline
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
],
'mail' => [
'full_log' => false
],
'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large..
],
'route' => [
'label' => true // show complete route on bar
],
'logs' => [
'file' => null
],
],
/*
|--------------------------------------------------------------------------
| Inject Debugbar in Response
|--------------------------------------------------------------------------
|
| Usually, the debugbar is added just before </body>, by listening to the
| Response after the App is done. If you disable this, you have to add them
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
*/
'inject' => true,
/*
|--------------------------------------------------------------------------
| DebugBar route prefix
|--------------------------------------------------------------------------
|
| Sometimes you want to set route prefix to be used by DebugBar to load
| its resources from. Usually the need comes from misconfigured web server or
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
*/
'route_prefix' => '_debugbar',
/*
|--------------------------------------------------------------------------
| DebugBar route domain
|--------------------------------------------------------------------------
|
| By default DebugBar route served from the same domain that request served.
| To override default domain, specify it as a non-empty value.
*/
'route_domain' => null,
];
## Laravel Debugbar
[![Packagist License](https://poser.pugx.org/barryvdh/laravel-debugbar/license.png)](http://choosealicense.com/licenses/mit/)
[![Latest Stable Version](https://poser.pugx.org/barryvdh/laravel-debugbar/version.png)](https://packagist.org/packages/barryvdh/laravel-debugbar)
[![Total Downloads](https://poser.pugx.org/barryvdh/laravel-debugbar/d/total.png)](https://packagist.org/packages/barryvdh/laravel-debugbar)
### For Laravel 4, please use the [1.8 branch](https://github.com/barryvdh/laravel-debugbar/tree/1.8)!
This is a package to integrate [PHP Debug Bar](http://phpdebugbar.com/) with Laravel 5.
It includes a ServiceProvider to register the debugbar and attach it to the output. You can publish assets and configure it through Laravel.
It bootstraps some Collectors to work with Laravel and implements a couple custom DataCollectors, specific for Laravel.
It is configured to display Redirects and (jQuery) Ajax Requests. (Shown in a dropdown)
Read [the documentation](http://phpdebugbar.com/docs/) for more configuration options.
![Screenshot](https://cloud.githubusercontent.com/assets/973269/4270452/740c8c8c-3ccb-11e4-8d9a-5a9e64f19351.png)
Note: Use the DebugBar only in development. It can slow the application down (because it has to gather data). So when experiencing slowness, try disabling some of the collectors.
This package includes some custom collectors:
- QueryCollector: Show all queries, including binding + timing
- RouteCollector: Show information about the current Route.
- ViewCollector: Show the currently loaded views. (Optionally: display the shared data)
- EventsCollector: Show all events
- LaravelCollector: Show the Laravel version and Environment. (disabled by default)
- SymfonyRequestCollector: replaces the RequestCollector with more information about the request/response
- LogsCollector: Show the latest log entries from the storage logs. (disabled by default)
- FilesCollector: Show the files that are included/required by PHP. (disabled by default)
- ConfigCollector: Display the values from the config files. (disabled by default)
Bootstraps the following collectors for Laravel:
- LogCollector: Show all Log messages
- SwiftMailCollector and SwiftLogCollector for Mail
And the default collectors:
- PhpInfoCollector
- MessagesCollector
- TimeDataCollector (With Booting and Application timing)
- MemoryCollector
- ExceptionsCollector
It also provides a Facade interface for easy logging Messages, Exceptions and Time
## Installation
Require this package with composer:
```shell
composer require barryvdh/laravel-debugbar
```
After updating composer, add the ServiceProvider to the providers array in config/app.php
> If you use a catch-all/fallback route, make sure you load the Debugbar ServiceProvider before your own App ServiceProviders.
### Laravel 5.x:
```php
Barryvdh\Debugbar\ServiceProvider::class,
```
If you want to use the facade to log messages, add this to your facades in app.php:
```php
'Debugbar' => Barryvdh\Debugbar\Facade::class,
```
The profiler is enabled by default, if you have app.debug=true. You can override that in the config (`debugbar.enabled`). See more options in `config/debugbar.php`
You can also set in your config if you want to include/exclude the vendor files also (FontAwesome, Highlight.js and jQuery). If you already use them in your site, set it to false.
You can also only display the js or css vendors, by setting it to 'js' or 'css'. (Highlight.js requires both css + js, so set to `true` for syntax highlighting)
Copy the package config to your local config with the publish command:
```shell
php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"
```
### Lumen:
For Lumen, register a different Provider in `bootstrap/app.php`:
```php
if (env('APP_DEBUG')) {
$app->register(Barryvdh\Debugbar\LumenServiceProvider::class);
}
```
To change the configuration, copy the file to your config folder and enable it:
```php
$app->configure('debugbar');
```
## Usage
You can now add messages using the Facade (when added), using the PSR-3 levels (debug, info, notice, warning, error, critical, alert, emergency):
```php
Debugbar::info($object);
Debugbar::error('Error!');
Debugbar::warning('Watch out…');
Debugbar::addMessage('Another message', 'mylabel');
```
And start/stop timing:
```php
Debugbar::startMeasure('render','Time for rendering');
Debugbar::stopMeasure('render');
Debugbar::addMeasure('now', LARAVEL_START, microtime(true));
Debugbar::measure('My long operation', function() {
// Do something…
});
```
Or log exceptions:
```php
try {
throw new Exception('foobar');
} catch (Exception $e) {
Debugbar::addThrowable($e);
}
```
There are also helper functions available for the most common calls:
```php
// All arguments will be dumped as a debug message
debug($var1, $someString, $intValue, $object);
start_measure('render','Time for rendering');
stop_measure('render');
add_measure('now', LARAVEL_START, microtime(true));
measure('My long operation', function() {
// Do something…
});
```
If you want you can add your own DataCollectors, through the Container or the Facade:
```php
Debugbar::addCollector(new DebugBar\DataCollector\MessagesCollector('my_messages'));
//Or via the App container:
$debugbar = App::make('debugbar');
$debugbar->addCollector(new DebugBar\DataCollector\MessagesCollector('my_messages'));
```
By default, the Debugbar is injected just before `</body>`. If you want to inject the Debugbar yourself,
set the config option 'inject' to false and use the renderer yourself and follow http://phpdebugbar.com/docs/rendering.html
```php
$renderer = Debugbar::getJavascriptRenderer();
```
Note: Not using the auto-inject, will disable the Request information, because that is added After the response.
You can add the default_request datacollector in the config as alternative.
## Enabling/Disabling on run time
You can enable or disable the debugbar during run time.
```php
\Debugbar::enable();
\Debugbar::disable();
```
NB. Once enabled, the collectors are added (and could produce extra overhead), so if you want to use the debugbar in production, disable in the config and only enable when needed.
## Twig Integration
Laravel Debugbar comes with two Twig Extensions. These are tested with [rcrowe/TwigBridge](https://github.com/rcrowe/TwigBridge) 0.6.x
Add the following extensions to your TwigBridge config/extensions.php (or register the extensions manually)
```php
'Barryvdh\Debugbar\Twig\Extension\Debug',
'Barryvdh\Debugbar\Twig\Extension\Dump',
'Barryvdh\Debugbar\Twig\Extension\Stopwatch',
```
The Dump extension will replace the [dump function](http://twig.sensiolabs.org/doc/functions/dump.html) to output variables using the DataFormatter. The Debug extension adds a `debug()` function which passes variables to the Message Collector,
instead of showing it directly in the template. It dumps the arguments, or when empty; all context variables.
```twig
{{ debug() }}
{{ debug(user, categories) }}
```
The Stopwatch extension adds a [stopwatch tag](http://symfony.com/blog/new-in-symfony-2-4-a-stopwatch-tag-for-twig) similar to the one in Symfony/Silex Twigbridge.
```twig
{% stopwatch "foo" %}
…some things that gets timed
{% endstopwatch %}
```
<?php namespace Barryvdh\Debugbar\Console;
use DebugBar\DebugBar;
use Illuminate\Console\Command;
class ClearCommand extends Command
{
protected $name = 'debugbar:clear';
protected $description = 'Clear the Debugbar Storage';
protected $debugbar;
public function __construct(DebugBar $debugbar)
{
$this->debugbar = $debugbar;
parent::__construct();
}
public function fire()
{
$this->debugbar->boot();
if ($storage = $this->debugbar->getStorage()) {
try
{
$storage->clear();
} catch(\InvalidArgumentException $e) {
// hide InvalidArgumentException if storage location does not exist
if(strpos($e->getMessage(), 'does not exist') === false) {
throw $e;
}
}
$this->info('Debugbar Storage cleared!');
} else {
$this->error('No Debugbar Storage found..');
}
}
}
<?php
namespace Barryvdh\Debugbar\Console;
use Illuminate\Console\Command;
/**
* Publish the Debugbar assets to the public directory
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @deprecated No longer needed because of the AssetController
*/
class PublishCommand extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'debugbar:publish';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Publish the Debugbar assets';
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$this->info(
'NOTICE: Since laravel-debugbar 1.7.x, publishing assets is no longer necessary. The assets in public/packages/barryvdh/laravel-debugbar and maximebf/php-debugbar can be safely removed.'
);
}
}
<?php namespace Barryvdh\Debugbar\Controllers;
use Illuminate\Http\Response;
class AssetController extends BaseController
{
/**
* Return the javascript for the Debugbar
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function js()
{
$renderer = $this->debugbar->getJavascriptRenderer();
$content = $renderer->dumpAssetsToString('js');
$response = new Response(
$content, 200, [
'Content-Type' => 'text/javascript',
]
);
return $this->cacheResponse($response);
}
/**
* Return the stylesheets for the Debugbar
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function css()
{
$renderer = $this->debugbar->getJavascriptRenderer();
$content = $renderer->dumpAssetsToString('css');
$response = new Response(
$content, 200, [
'Content-Type' => 'text/css',
]
);
return $this->cacheResponse($response);
}
/**
* Cache the response 1 year (31536000 sec)
*/
protected function cacheResponse(Response $response)
{
$response->setSharedMaxAge(31536000);
$response->setMaxAge(31536000);
$response->setExpires(new \DateTime('+1 year'));
return $response;
}
}
<?php namespace Barryvdh\Debugbar\Controllers;
use Barryvdh\Debugbar\LaravelDebugbar;
use Illuminate\Routing\Controller;
use Illuminate\Http\Request;
if (class_exists('Illuminate\Routing\Controller')) {
class BaseController extends Controller
{
protected $debugbar;
public function __construct(Request $request, LaravelDebugbar $debugbar)
{
$this->debugbar = $debugbar;
if ($request->hasSession()){
$request->session()->reflash();
}
}
}
} else {
class BaseController
{
protected $debugbar;
public function __construct(Request $request, LaravelDebugbar $debugbar)
{
$this->debugbar = $debugbar;
if ($request->hasSession()){
$request->session()->reflash();
}
}
}
}
\ No newline at end of file
<?php namespace Barryvdh\Debugbar\Controllers;
use Barryvdh\Debugbar\Support\Clockwork\Converter;
use DebugBar\OpenHandler;
use Illuminate\Http\Response;
class OpenHandlerController extends BaseController
{
public function handle()
{
$debugbar = $this->debugbar;
if (!$debugbar->isEnabled()) {
$this->app->abort('500', 'Debugbar is not enabled');
}
$openHandler = new OpenHandler($debugbar);
$data = $openHandler->handle(null, false, false);
return new Response(
$data, 200, [
'Content-Type' => 'application/json'
]
);
}
/**
* Return Clockwork output
*
* @param $id
* @return mixed
* @throws \DebugBar\DebugBarException
*/
public function clockwork($id)
{
$request = [
'op' => 'get',
'id' => $id,
];
$debugbar = $this->debugbar;
if (!$debugbar->isEnabled()) {
$this->app->abort('500', 'Debugbar is not enabled');
}
$openHandler = new OpenHandler($debugbar);
$data = $openHandler->handle($request, false, false);
// Convert to Clockwork
$converter = new Converter();
$output = $converter->convert(json_decode($data, true));
return response()->json($output);
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use DebugBar\DataCollector\DataCollector;
use DebugBar\DataCollector\Renderable;
use Illuminate\Contracts\Support\Arrayable;
/**
* Collector for Laravel's Auth provider
*/
class AuthCollector extends DataCollector implements Renderable
{
/** @var \Illuminate\Auth\AuthManager */
protected $auth;
/** @var bool */
protected $showName = false;
/**
* @param \Illuminate\Auth\AuthManager $auth
*/
public function __construct($auth)
{
$this->auth = $auth;
}
/**
* Set to show the users name/email
* @param bool $showName
*/
public function setShowName($showName)
{
$this->showName = (bool) $showName;
}
/**
* @{inheritDoc}
*/
public function collect()
{
try {
$user = $this->auth->user();
} catch (\Exception $e) {
$user = null;
}
return $this->getUserInformation($user);
}
/**
* Get displayed user information
* @param \Illuminate\Auth\UserInterface $user
* @return array
*/
protected function getUserInformation($user = null)
{
// Defaults
if (is_null($user)) {
return [
'name' => 'Guest',
'user' => ['guest' => true],
];
}
// The default auth identifer is the ID number, which isn't all that
// useful. Try username and email.
$identifier = $user->getAuthIdentifier();
if (is_numeric($identifier)) {
try {
if ($user->username) {
$identifier = $user->username;
} elseif ($user->email) {
$identifier = $user->email;
}
} catch (\Exception $e) {
}
}
return [
'name' => $identifier,
'user' => $user instanceof Arrayable ? $user->toArray() : $user,
];
}
/**
* @{inheritDoc}
*/
public function getName()
{
return 'auth';
}
/**
* @{inheritDoc}
*/
public function getWidgets()
{
$widgets = [
'auth' => [
'icon' => 'lock',
'widget' => 'PhpDebugBar.Widgets.VariableListWidget',
'map' => 'auth.user',
'default' => '{}'
]
];
if ($this->showName) {
$widgets['auth.name'] = [
'icon' => 'user',
'tooltip' => 'Auth status',
'map' => 'auth.name',
'default' => '',
];
}
return $widgets;
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use DebugBar\DataCollector\TimeDataCollector;
use Illuminate\Events\Dispatcher;
use Illuminate\Support\Str;
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
class EventCollector extends TimeDataCollector
{
/** @var Dispatcher */
protected $events;
/** @var ValueExporter */
protected $exporter;
public function __construct($requestStartTime = null)
{
parent::__construct($requestStartTime);
$this->exporter = new ValueExporter();
}
public function onWildcardEvent($name = null, $data = [])
{
// Pre-Laravel 5.4, using 'firing' to get the current event name.
if (method_exists($this->events, 'firing')) {
$name = $this->events->firing();
// Get the arguments passed to the event
$data = func_get_args();
}
$params = $this->prepareParams($data);
$time = microtime(true);
// Find all listeners for the current event
foreach ($this->events->getListeners($name) as $i => $listener) {
// Check if it's an object + method name
if (is_array($listener) && count($listener) > 1 && is_object($listener[0])) {
list($class, $method) = $listener;
// Skip this class itself
if ($class instanceof static) {
continue;
}
// Format the listener to readable format
$listener = get_class($class) . '@' . $method;
// Handle closures
} elseif ($listener instanceof \Closure) {
$reflector = new \ReflectionFunction($listener);
// Skip our own listeners
if ($reflector->getNamespaceName() == 'Barryvdh\Debugbar') {
continue;
}
// Format the closure to a readable format
$filename = ltrim(str_replace(base_path(), '', $reflector->getFileName()), '/');
$listener = $reflector->getName() . ' (' . $filename . ':' . $reflector->getStartLine() . '-' . $reflector->getEndLine() . ')';
} else {
// Not sure if this is possible, but to prevent edge cases
$listener = $this->formatVar($listener);
}
$params['listeners.' . $i] = $listener;
}
$this->addMeasure($name, $time, $time, $params);
}
public function subscribe(Dispatcher $events)
{
$this->events = $events;
$events->listen('*', [$this, 'onWildcardEvent']);
}
protected function prepareParams($params)
{
$data = [];
foreach ($params as $key => $value) {
if (is_object($value) && Str::is('Illuminate\*\Events\*', get_class($value))) {
$value = $this->prepareParams(get_object_vars($value));
}
$data[$key] = htmlentities($this->exporter->exportValue($value), ENT_QUOTES, 'UTF-8', false);
}
return $data;
}
public function collect()
{
$data = parent::collect();
$data['nb_measures'] = count($data['measures']);
return $data;
}
public function getName()
{
return 'event';
}
public function getWidgets()
{
return [
"events" => [
"icon" => "tasks",
"widget" => "PhpDebugBar.Widgets.TimelineWidget",
"map" => "event",
"default" => "{}",
],
'events:badge' => [
'map' => 'event.nb_measures',
'default' => 0,
],
];
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use DebugBar\DataCollector\DataCollector;
use DebugBar\DataCollector\Renderable;
use Illuminate\Contracts\Foundation\Application;
class FilesCollector extends DataCollector implements Renderable
{
/** @var \Illuminate\Contracts\Foundation\Application */
protected $app;
protected $basePath;
/**
* @param \Illuminate\Contracts\Foundation\Application $app
*/
public function __construct(Application $app = null)
{
$this->app = $app;
$this->basePath = base_path();
}
/**
* {@inheritDoc}
*/
public function collect()
{
$files = $this->getIncludedFiles();
$compiled = $this->getCompiledFiles();
$included = [];
$alreadyCompiled = [];
foreach ($files as $file) {
// Skip the files from Debugbar, they are only loaded for Debugging and confuse the output.
// Of course some files are stil always loaded (ServiceProvider, Facade etc)
if (strpos($file, 'vendor/maximebf/debugbar/src') !== false || strpos(
$file,
'vendor/barryvdh/laravel-debugbar/src'
) !== false
) {
continue;
} elseif (!in_array($file, $compiled)) {
$included[] = [
'message' => "'" . $this->stripBasePath($file) . "',",
// Use PHP syntax so we can copy-paste to compile config file.
'is_string' => true,
];
} else {
$alreadyCompiled[] = [
'message' => "* '" . $this->stripBasePath($file) . "',",
// Mark with *, so know they are compiled anyways.
'is_string' => true,
];
}
}
// First the included files, then those that are going to be compiled.
$messages = array_merge($included, $alreadyCompiled);
return [
'messages' => $messages,
'count' => count($included),
];
}
/**
* Get the files included on load.
*
* @return array
*/
protected function getIncludedFiles()
{
return get_included_files();
}
/**
* Get the files that are going to be compiled, so they aren't as important.
*
* @return array
*/
protected function getCompiledFiles()
{
if ($this->app && class_exists('Illuminate\Foundation\Console\OptimizeCommand')) {
$reflector = new \ReflectionClass('Illuminate\Foundation\Console\OptimizeCommand');
$path = dirname($reflector->getFileName()) . '/Optimize/config.php';
if (file_exists($path)) {
$app = $this->app;
$core = require $path;
return array_merge($core, $app['config']['compile']);
}
}
return [];
}
/**
* Remove the basePath from the paths, so they are relative to the base
*
* @param $path
* @return string
*/
protected function stripBasePath($path)
{
return ltrim(str_replace($this->basePath, '', $path), '/');
}
/**
* {@inheritDoc}
*/
public function getWidgets()
{
$name = $this->getName();
return [
"$name" => [
"icon" => "files-o",
"widget" => "PhpDebugBar.Widgets.MessagesWidget",
"map" => "$name.messages",
"default" => "{}"
],
"$name:badge" => [
"map" => "$name.count",
"default" => "null"
]
];
}
/**
* {@inheritDoc}
*/
public function getName()
{
return 'files';
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use DebugBar\DataCollector\MessagesCollector;
use Illuminate\Contracts\Auth\Access\Gate;
use Illuminate\Contracts\Auth\Authenticatable;
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
/**
* Collector for Laravel's Auth provider
*/
class GateCollector extends MessagesCollector
{
/** @var ValueExporter */
protected $exporter;
/**
* @param Gate $gate
*/
public function __construct(Gate $gate)
{
parent::__construct('gate');
$this->exporter = new ValueExporter();
if (method_exists($gate, 'after')) {
$gate->after([$this, 'addCheck']);
}
}
public function addCheck(Authenticatable $user, $ability, $result, $arguments = [])
{
$label = $result ? 'success' : 'error';
$this->addMessage([
'ability' => $ability,
'result' => $result,
'user' => $user->getAuthIdentifier(),
'arguments' => $this->exporter->exportValue($arguments),
], $label, false);
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use DebugBar\DataCollector\DataCollector;
use DebugBar\DataCollector\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Config;
/**
* Based on Illuminate\Foundation\Console\RoutesCommand for Taylor Otwell
* https://github.com/laravel/framework/blob/master/src/Illuminate/Foundation/Console/RoutesCommand.php
*
*/
class IlluminateRouteCollector extends DataCollector implements Renderable
{
/**
* The router instance.
*
* @var \Illuminate\Routing\Router
*/
protected $router;
public function __construct(Router $router)
{
$this->router = $router;
}
/**
* {@inheritDoc}
*/
public function collect()
{
$route = $this->router->current();
return $this->getRouteInformation($route);
}
/**
* Get the route information for a given route.
*
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function getRouteInformation($route)
{
if (!is_a($route, 'Illuminate\Routing\Route')) {
return [];
}
$uri = head($route->methods()) . ' ' . $route->uri();
$action = $route->getAction();
$result = [
'uri' => $uri ?: '-',
];
$result = array_merge($result, $action);
if (isset($action['controller']) && strpos($action['controller'], '@') !== false) {
list($controller, $method) = explode('@', $action['controller']);
if(class_exists($controller) && method_exists($controller, $method)) {
$reflector = new \ReflectionMethod($controller, $method);
}
unset($result['uses']);
} elseif (isset($action['uses']) && $action['uses'] instanceof \Closure) {
$reflector = new \ReflectionFunction($action['uses']);
$result['uses'] = $this->formatVar($result['uses']);
}
if (isset($reflector)) {
$filename = ltrim(str_replace(base_path(), '', $reflector->getFileName()), '/');
$result['file'] = $filename . ':' . $reflector->getStartLine() . '-' . $reflector->getEndLine();
}
if ($middleware = $this->getMiddleware($route)) {
$result['middleware'] = $middleware;
}
return $result;
}
/**
* Get middleware
*
* @param \Illuminate\Routing\Route $route
* @return string
*/
protected function getMiddleware($route)
{
return implode(', ', $route->middleware());
}
/**
* {@inheritDoc}
*/
public function getName()
{
return 'route';
}
/**
* {@inheritDoc}
*/
public function getWidgets()
{
$widgets = [
"route" => [
"icon" => "share",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "route",
"default" => "{}"
]
];
if (Config::get('debugbar.options.route.label', true)) {
$widgets['currentroute'] = [
"icon" => "share",
"tooltip" => "Route",
"map" => "route.uri",
"default" => ""
];
}
return $widgets;
}
/**
* Display the route information on the console.
*
* @param array $routes
* @return void
*/
protected function displayRoutes(array $routes)
{
$this->table->setHeaders($this->headers)->setRows($routes);
$this->table->render($this->getOutput());
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use DebugBar\DataCollector\DataCollector;
use DebugBar\DataCollector\Renderable;
use Illuminate\Foundation\Application;
class LaravelCollector extends DataCollector implements Renderable
{
/** @var \Illuminate\Foundation\Application $app */
protected $app;
/**
* @param Application $app
*/
public function __construct(Application $app = null)
{
$this->app = $app;
}
/**
* {@inheritDoc}
*/
public function collect()
{
// Fallback if not injected
$app = $this->app ?: app();
return [
"version" => $app::VERSION,
"environment" => $app->environment(),
"locale" => $app->getLocale(),
];
}
/**
* {@inheritDoc}
*/
public function getName()
{
return 'laravel';
}
/**
* {@inheritDoc}
*/
public function getWidgets()
{
return [
"version" => [
"icon" => "github",
"tooltip" => "Version",
"map" => "laravel.version",
"default" => ""
],
"environment" => [
"icon" => "desktop",
"tooltip" => "Environment",
"map" => "laravel.environment",
"default" => ""
],
"locale" => [
"icon" => "flag",
"tooltip" => "Current locale",
"map" => "laravel.locale",
"default" => "",
],
];
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use DebugBar\DataCollector\MessagesCollector;
use Psr\Log\LogLevel;
use ReflectionClass;
class LogsCollector extends MessagesCollector
{
protected $lines = 124;
public function __construct($path = null, $name = 'logs')
{
parent::__construct($name);
$path = $path ?: $this->getLogsFile();
$this->getStorageLogs($path);
}
/**
* Get the path to the logs file
*
* @return string
*/
public function getLogsFile()
{
// default daily rotating logs (Laravel 5.0)
$path = storage_path() . '/logs/laravel-' . date('Y-m-d') . '.log';
// single file logs
if (!file_exists($path)) {
$path = storage_path() . '/logs/laravel.log';
}
return $path;
}
/**
* get logs apache in app/storage/logs
* only 24 last of current day
*
* @param string $path
*
* @return array
*/
public function getStorageLogs($path)
{
if (!file_exists($path)) {
return;
}
//Load the latest lines, guessing about 15x the number of log entries (for stack traces etc)
$file = implode("", $this->tailFile($path, $this->lines));
foreach ($this->getLogs($file) as $log) {
$this->addMessage($log['header'] . $log['stack'], $log['level'], false);
}
}
/**
* By Ain Tohvri (ain)
* http://tekkie.flashbit.net/php/tail-functionality-in-php
* @param string $file
* @param int $lines
* @return array
*/
protected function tailFile($file, $lines)
{
$handle = fopen($file, "r");
$linecounter = $lines;
$pos = -2;
$beginning = false;
$text = [];
while ($linecounter > 0) {
$t = " ";
while ($t != "\n") {
if (fseek($handle, $pos, SEEK_END) == -1) {
$beginning = true;
break;
}
$t = fgetc($handle);
$pos--;
}
$linecounter--;
if ($beginning) {
rewind($handle);
}
$text[$lines - $linecounter - 1] = fgets($handle);
if ($beginning) {
break;
}
}
fclose($handle);
return array_reverse($text);
}
/**
* Search a string for log entries
* Based on https://github.com/mikemand/logviewer/blob/master/src/Kmd/Logviewer/Logviewer.php by mikemand
*
* @param $file
* @return array
*/
public function getLogs($file)
{
$pattern = "/\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\].*/";
$log_levels = $this->getLevels();
// There has GOT to be a better way of doing this...
preg_match_all($pattern, $file, $headings);
$log_data = preg_split($pattern, $file);
$log = [];
foreach ($headings as $h) {
for ($i = 0, $j = count($h); $i < $j; $i++) {
foreach ($log_levels as $ll) {
if (strpos(strtolower($h[$i]), strtolower('.' . $ll))) {
$log[] = ['level' => $ll, 'header' => $h[$i], 'stack' => $log_data[$i]];
}
}
}
}
$log = array_reverse($log);
return $log;
}
/**
* Get the log levels from psr/log.
* Based on https://github.com/mikemand/logviewer/blob/master/src/Kmd/Logviewer/Logviewer.php by mikemand
*
* @access public
* @return array
*/
public function getLevels()
{
$class = new ReflectionClass(new LogLevel());
return $class->getConstants();
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use Illuminate\Auth\SessionGuard;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Support\Str;
/**
* Collector for Laravel's Auth provider
*/
class MultiAuthCollector extends AuthCollector
{
/** @var array $guards */
protected $guards;
/**
* @param \Illuminate\Auth\AuthManager $auth
* @param array $guards
*/
public function __construct($auth, $guards)
{
parent::__construct($auth);
$this->guards = $guards;
}
/**
* @{inheritDoc}
*/
public function collect()
{
$data = [];
$names = '';
foreach($this->guards as $guardName) {
try {
$user = $this->resolveUser($this->auth->guard($guardName));
} catch (\Exception $e) {
continue;
}
$data['guards'][$guardName] = $this->getUserInformation($user);
if(!is_null($user)) {
$names .= $guardName . ": " . $data['guards'][$guardName]['name'] . ', ';
}
}
foreach ($data['guards'] as $key => $var) {
if (!is_string($data['guards'][$key])) {
$data['guards'][$key] = $this->formatVar($var);
}
}
$data['names'] = rtrim($names, ', ');
return $data;
}
private function resolveUser(Guard $guard)
{
// if we're logging in using remember token
// then we must resolve user „manually”
// to prevent csrf token regeneration
$recaller = $guard instanceof SessionGuard
? $guard->getRequest()->cookies->get($guard->getRecallerName())
: null;
if (is_string($recaller) && Str::contains($recaller, '|')) {
$segments = explode('|', $recaller);
if (count($segments) == 2 && trim($segments[0]) !== '' && trim($segments[1]) !== '') {
return $guard->getProvider()->retrieveByToken($segments[0], $segments[1]);
}
}
return $guard->user();
}
/**
* @{inheritDoc}
*/
public function getWidgets()
{
$widgets = [
"auth" => [
"icon" => "lock",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "auth.guards",
"default" => "{}"
]
];
if ($this->showName) {
$widgets['auth.name'] = [
'icon' => 'user',
'tooltip' => 'Auth status',
'map' => 'auth.names',
'default' => '',
];
}
return $widgets;
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use DebugBar\DataCollector\DataCollector;
use DebugBar\DataCollector\DataCollectorInterface;
use DebugBar\DataCollector\Renderable;
class SessionCollector extends DataCollector implements DataCollectorInterface, Renderable
{
/** @var \Symfony\Component\HttpFoundation\Session\SessionInterface|\Illuminate\Contracts\Session\Session $session */
protected $session;
/**
* Create a new SessionCollector
*
* @param \Symfony\Component\HttpFoundation\Session\SessionInterface|\Illuminate\Contracts\Session\Session $session
*/
public function __construct($session)
{
$this->session = $session;
}
/**
* {@inheritdoc}
*/
public function collect()
{
$data = [];
foreach ($this->session->all() as $key => $value) {
$data[$key] = is_string($value) ? $value : $this->formatVar($value);
}
return $data;
}
/**
* {@inheritDoc}
*/
public function getName()
{
return 'session';
}
/**
* {@inheritDoc}
*/
public function getWidgets()
{
return [
"session" => [
"icon" => "archive",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "session",
"default" => "{}"
]
];
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use DebugBar\DataCollector\DataCollector;
use DebugBar\DataCollector\DataCollectorInterface;
use DebugBar\DataCollector\Renderable;
use Symfony\Component\HttpFoundation\Response;
/**
*
* Based on \Symfony\Component\HttpKernel\DataCollector\RequestDataCollector by Fabien Potencier <fabien@symfony.com>
*
*/
class SymfonyRequestCollector extends DataCollector implements DataCollectorInterface, Renderable
{
/** @var \Symfony\Component\HttpFoundation\Request $request */
protected $request;
/** @var \Symfony\Component\HttpFoundation\Request $response */
protected $response;
/** @var \Symfony\Component\HttpFoundation\Session\SessionInterface $session */
protected $session;
/**
* Create a new SymfonyRequestCollector
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Symfony\Component\HttpFoundation\Request $response
* @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session
*/
public function __construct($request, $response, $session = null)
{
$this->request = $request;
$this->response = $response;
$this->session = $session;
}
/**
* {@inheritDoc}
*/
public function getName()
{
return 'request';
}
/**
* {@inheritDoc}
*/
public function getWidgets()
{
return [
"request" => [
"icon" => "tags",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "request",
"default" => "{}"
]
];
}
/**
* {@inheritdoc}
*/
public function collect()
{
$request = $this->request;
$response = $this->response;
$responseHeaders = $response->headers->all();
$cookies = [];
foreach ($response->headers->getCookies() as $cookie) {
$cookies[] = $this->getCookieHeader(
$cookie->getName(),
$cookie->getValue(),
$cookie->getExpiresTime(),
$cookie->getPath(),
$cookie->getDomain(),
$cookie->isSecure(),
$cookie->isHttpOnly()
);
}
if (count($cookies) > 0) {
$responseHeaders['Set-Cookie'] = $cookies;
}
$statusCode = $response->getStatusCode();
$data = [
'format' => $request->getRequestFormat(),
'content_type' => $response->headers->get('Content-Type') ? $response->headers->get(
'Content-Type'
) : 'text/html',
'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '',
'status_code' => $statusCode,
'request_query' => $request->query->all(),
'request_request' => $request->request->all(),
'request_headers' => $request->headers->all(),
'request_server' => $request->server->all(),
'request_cookies' => $request->cookies->all(),
'response_headers' => $responseHeaders,
'path_info' => $request->getPathInfo(),
];
if ($this->session) {
$sessionAttributes = [];
foreach ($this->session->all() as $key => $value) {
$sessionAttributes[$key] = $value;
}
$data['session_attributes'] = $sessionAttributes;
}
foreach ($data['request_server'] as $key => $value) {
if (str_is('*_KEY', $key) || str_is('*_PASSWORD', $key)
|| str_is('*_SECRET', $key) || str_is('*_PW', $key)) {
$data['request_server'][$key] = '******';
}
}
if (isset($data['request_headers']['php-auth-pw'])) {
$data['request_headers']['php-auth-pw'] = '******';
}
if (isset($data['request_server']['PHP_AUTH_PW'])) {
$data['request_server']['PHP_AUTH_PW'] = '******';
}
foreach ($data as $key => $var) {
if (!is_string($data[$key])) {
$data[$key] = $this->formatVar($var);
}
}
return $data;
}
private function getCookieHeader($name, $value, $expires, $path, $domain, $secure, $httponly)
{
$cookie = sprintf('%s=%s', $name, urlencode($value));
if (0 !== $expires) {
if (is_numeric($expires)) {
$expires = (int) $expires;
} elseif ($expires instanceof \DateTime) {
$expires = $expires->getTimestamp();
} else {
$expires = strtotime($expires);
if (false === $expires || -1 == $expires) {
throw new \InvalidArgumentException(
sprintf('The "expires" cookie parameter is not valid.', $expires)
);
}
}
$cookie .= '; expires=' . substr(
\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'),
0,
-5
);
}
if ($domain) {
$cookie .= '; domain=' . $domain;
}
$cookie .= '; path=' . $path;
if ($secure) {
$cookie .= '; secure';
}
if ($httponly) {
$cookie .= '; httponly';
}
return $cookie;
}
}
<?php
namespace Barryvdh\Debugbar\DataCollector;
use DebugBar\Bridge\Twig\TwigCollector;
use Illuminate\View\View;
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
class ViewCollector extends TwigCollector
{
protected $templates = [];
protected $collect_data;
/**
* Create a ViewCollector
*
* @param bool $collectData Collects view data when tru
*/
public function __construct($collectData = true)
{
$this->collect_data = $collectData;
$this->name = 'views';
$this->templates = [];
$this->exporter = new ValueExporter();
}
public function getName()
{
return 'views';
}
public function getWidgets()
{
return [
'views' => [
'icon' => 'leaf',
'widget' => 'PhpDebugBar.Widgets.TemplatesWidget',
'map' => 'views',
'default' => '[]'
],
'views:badge' => [
'map' => 'views.nb_templates',
'default' => 0
]
];
}
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
$path = $view->getPath();
if (!is_object($path)) {
if ($path) {
$path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
}
if (substr($path, -10) == '.blade.php') {
$type = 'blade';
} else {
$type = pathinfo($path, PATHINFO_EXTENSION);
}
} else {
$type = get_class($view);
$path = '';
}
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = [];
foreach ($view->getData() as $key => $value) {
$data[$key] = $this->exporter->exportValue($value);
}
$params = $data;
}
$this->templates[] = [
'name' => $path ? sprintf('%s (%s)', $name, $path) : $name,
'param_count' => count($params),
'params' => $params,
'type' => $type,
];
}
public function collect()
{
$templates = $this->templates;
return [
'nb_templates' => count($templates),
'templates' => $templates,
];
}
}
<?php
namespace Barryvdh\Debugbar\DataFormatter;
use DebugBar\DataFormatter\DataFormatter;
class QueryFormatter extends DataFormatter
{
/**
* Removes extra spaces at the beginning and end of the SQL query and its lines.
*
* @param string $sql
* @return string
*/
public function formatSql($sql)
{
return trim(preg_replace("/\s*\n\s*/", "\n", $sql));
}
/**
* Check bindings for illegal (non UTF-8) strings, like Binary data.
*
* @param $bindings
* @return mixed
*/
public function checkBindings($bindings)
{
foreach ($bindings as &$binding) {
if (is_string($binding) && !mb_check_encoding($binding, 'UTF-8')) {
$binding = '[BINARY DATA]';
}
}
return $bindings;
}
/**
* Make the bindings safe for outputting.
*
* @param array $bindings
* @return array
*/
public function escapeBindings($bindings)
{
foreach ($bindings as &$binding) {
$binding = htmlentities($binding, ENT_QUOTES, 'UTF-8', false);
}
return $bindings;
}
/**
* Format a source object.
*
* @param object|null $source If the backtrace is disabled, the $source will be null.
* @return string
*/
public function formatSource($source)
{
if (! is_object($source)) {
return '';
}
$parts = [];
if ($source->namespace) {
$parts['namespace'] = $source->namespace . '::';
}
$parts['name'] = $source->name;
$parts['line'] = ':' . $source->line;
return implode($parts);
}
}
<?php namespace Barryvdh\Debugbar;
class Facade extends \Illuminate\Support\Facades\Facade
{
/**
* {@inheritDoc}
*/
protected static function getFacadeAccessor()
{
return 'debugbar';
}
}
<?php namespace Barryvdh\Debugbar;
use DebugBar\DebugBar;
use DebugBar\JavascriptRenderer as BaseJavascriptRenderer;
use Illuminate\Routing\UrlGenerator;
/**
* {@inheritdoc}
*/
class JavascriptRenderer extends BaseJavascriptRenderer
{
// Use XHR handler by default, instead of jQuery
protected $ajaxHandlerBindToJquery = false;
protected $ajaxHandlerBindToXHR = true;
public function __construct(DebugBar $debugBar, $baseUrl = null, $basePath = null)
{
parent::__construct($debugBar, $baseUrl, $basePath);
$this->cssFiles['laravel'] = __DIR__ . '/Resources/laravel-debugbar.css';
$this->cssVendors['fontawesome'] = __DIR__ . '/Resources/vendor/font-awesome/style.css';
$this->jsFiles['laravel-sql'] = __DIR__ . '/Resources/sqlqueries/widget.js';
}
/**
* Set the URL Generator
*
* @param \Illuminate\Routing\UrlGenerator $url
* @deprecated
*/
public function setUrlGenerator($url)
{
}
/**
* {@inheritdoc}
*/
public function renderHead()
{
$cssRoute = route('debugbar.assets.css', [
'v' => $this->getModifiedTime('css')
]);
$jsRoute = route('debugbar.assets.js', [
'v' => $this->getModifiedTime('js')
]);
$cssRoute = preg_replace('/\Ahttps?:/', '', $cssRoute);
$jsRoute = preg_replace('/\Ahttps?:/', '', $jsRoute);
$html = "<link rel='stylesheet' type='text/css' property='stylesheet' href='{$cssRoute}'>";
$html .= "<script type='text/javascript' src='{$jsRoute}'></script>";
if ($this->isJqueryNoConflictEnabled()) {
$html .= '<script type="text/javascript">jQuery.noConflict(true);</script>' . "\n";
}
return $html;
}
/**
* Get the last modified time of any assets.
*
* @param string $type 'js' or 'css'
* @return int
*/
protected function getModifiedTime($type)
{
$files = $this->getAssets($type);
$latest = 0;
foreach ($files as $file) {
$mtime = filemtime($file);
if ($mtime > $latest) {
$latest = $mtime;
}
}
return $latest;
}
/**
* Return assets as a string
*
* @param string $type 'js' or 'css'
* @return string
*/
public function dumpAssetsToString($type)
{
$files = $this->getAssets($type);
$content = '';
foreach ($files as $file) {
$content .= file_get_contents($file) . "\n";
}
return $content;
}
/**
* Makes a URI relative to another
*
* @param string|array $uri
* @param string $root
* @return string
*/
protected function makeUriRelativeTo($uri, $root)
{
if (!$root) {
return $uri;
}
if (is_array($uri)) {
$uris = [];
foreach ($uri as $u) {
$uris[] = $this->makeUriRelativeTo($u, $root);
}
return $uris;
}
if (substr($uri, 0, 1) === '/' || preg_match('/^([a-zA-Z]+:\/\/|[a-zA-Z]:\/|[a-zA-Z]:\\\)/', $uri)) {
return $uri;
}
return rtrim($root, '/') . "/$uri";
}
}
<?php namespace Barryvdh\Debugbar;
use Laravel\Lumen\Application;
class LumenServiceProvider extends ServiceProvider
{
/** @var Application */
protected $app;
/**
* Get the active router.
*
* @return Application
*/
protected function getRouter()
{
return $this->app;
}
/**
* Get the config path
*
* @return string
*/
protected function getConfigPath()
{
return base_path('config/debugbar.php');
}
/**
* Register the Debugbar Middleware
*
* @param string $middleware
*/
protected function registerMiddleware($middleware)
{
$this->app->middleware([$middleware]);
}
/**
* Check the App Debug status
*/
protected function checkAppDebug()
{
return env('APP_DEBUG');
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['debugbar', 'command.debugbar.clear'];
}
}
<?php namespace Barryvdh\Debugbar\Middleware;
use Error;
use Closure;
use Exception;
use Illuminate\Http\Request;
use Barryvdh\Debugbar\LaravelDebugbar;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Symfony\Component\Debug\Exception\FatalThrowableError;
class Debugbar
{
/**
* The App container
*
* @var Container
*/
protected $container;
/**
* The DebugBar instance
*
* @var LaravelDebugbar
*/
protected $debugbar;
/**
* Create a new middleware instance.
*
* @param Container $container
* @param LaravelDebugbar $debugbar
*/
public function __construct(Container $container, LaravelDebugbar $debugbar)
{
$this->container = $container;
$this->debugbar = $debugbar;
}
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
try {
/** @var \Illuminate\Http\Response $response */
$response = $next($request);
} catch (Exception $e) {
$response = $this->handleException($request, $e);
} catch (Error $error) {
$e = new FatalThrowableError($error);
$response = $this->handleException($request, $e);
}
// Modify the response to add the Debugbar
$this->debugbar->modifyResponse($request, $response);
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);
}
}
# Font Squirrel Font-face Generator Configuration File
# Upload this file to the generator to recreate the settings
# you used to create these fonts.
{"mode":"expert","formats":["woff"],"tt_instructor":"keep","fallback":"none","fallback_custom":"100","options_subset":"none","subset_custom":"","subset_custom_range":"","subset_ot_features":"all","subset_ot_features_list":"","base64":"Y","css_stylesheet":"style.css","filename_suffix":"","emsquare":"2048","spacing_adjustment":"0","rememberme":"Y"}
\ No newline at end of file
This diff could not be displayed because it is too large.
<?php namespace Barryvdh\Debugbar;
use Illuminate\Routing\Router;
use Illuminate\Session\SessionManager;
class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$configPath = __DIR__ . '/../config/debugbar.php';
$this->mergeConfigFrom($configPath, 'debugbar');
$this->app->alias(
'DebugBar\DataFormatter\DataFormatter',
'DebugBar\DataFormatter\DataFormatterInterface'
);
$this->app->singleton('debugbar', function ($app) {
$debugbar = new LaravelDebugbar($app);
if ($app->bound(SessionManager::class)) {
$sessionManager = $app->make(SessionManager::class);
$httpDriver = new SymfonyHttpDriver($sessionManager);
$debugbar->setHttpDriver($httpDriver);
}
return $debugbar;
}
);
$this->app->alias('debugbar', 'Barryvdh\Debugbar\LaravelDebugbar');
$this->app->singleton('command.debugbar.clear',
function ($app) {
return new Console\ClearCommand($app['debugbar']);
}
);
$this->commands(['command.debugbar.clear']);
}
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$app = $this->app;
$configPath = __DIR__ . '/../config/debugbar.php';
$this->publishes([$configPath => $this->getConfigPath()], 'config');
// If enabled is null, set from the app.debug value
$enabled = $this->app['config']->get('debugbar.enabled');
if (is_null($enabled)) {
$enabled = $this->checkAppDebug();
}
if (! $enabled) {
return;
}
$routeConfig = [
'namespace' => 'Barryvdh\Debugbar\Controllers',
'prefix' => $this->app['config']->get('debugbar.route_prefix'),
'domain' => $this->app['config']->get('debugbar.route_domain'),
];
$this->getRouter()->group($routeConfig, function($router) {
$router->get('open', [
'uses' => 'OpenHandlerController@handle',
'as' => 'debugbar.openhandler',
]);
$router->get('clockwork/{id}', [
'uses' => 'OpenHandlerController@clockwork',
'as' => 'debugbar.clockwork',
]);
$router->get('assets/stylesheets', [
'uses' => 'AssetController@css',
'as' => 'debugbar.assets.css',
]);
$router->get('assets/javascript', [
'uses' => 'AssetController@js',
'as' => 'debugbar.assets.js',
]);
});
if ($app->runningInConsole() || $app->environment('testing')) {
return;
}
/** @var LaravelDebugbar $debugbar */
$debugbar = $this->app['debugbar'];
$debugbar->enable();
$debugbar->boot();
$this->registerMiddleware('Barryvdh\Debugbar\Middleware\Debugbar');
}
/**
* Get the active router.
*
* @return Router
*/
protected function getRouter()
{
return $this->app['router'];
}
/**
* Get the config path
*
* @return string
*/
protected function getConfigPath()
{
return config_path('debugbar.php');
}
/**
* Publish the config file
*
* @param string $configPath
*/
protected function publishConfig($configPath)
{
$this->publishes([$configPath => config_path('debugbar.php')], 'config');
}
/**
* Register the Debugbar Middleware
*
* @param string $middleware
*/
protected function registerMiddleware($middleware)
{
$kernel = $this->app['Illuminate\Contracts\Http\Kernel'];
$kernel->pushMiddleware($middleware);
}
/**
* Check the App Debug status
*/
protected function checkAppDebug()
{
return $this->app['config']->get('app.debug');
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['debugbar', 'command.debugbar.clear'];
}
}
<?php
namespace Barryvdh\Debugbar\Storage;
use DebugBar\Storage\StorageInterface;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
/**
* Stores collected data into files
*/
class FilesystemStorage implements StorageInterface
{
protected $dirname;
protected $files;
protected $gc_lifetime = 24; // Hours to keep collected data;
protected $gc_probability = 5; // Probability of GC being run on a save request. (5/100)
/**
* @param \Illuminate\Filesystem\Filesystem $files The filesystem
* @param string $dirname Directories where to store files
*/
public function __construct($files, $dirname)
{
$this->files = $files;
$this->dirname = rtrim($dirname, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
}
/**
* {@inheritDoc}
*/
public function save($id, $data)
{
if (!$this->files->isDirectory($this->dirname)) {
if ($this->files->makeDirectory($this->dirname, 0777, true)) {
$this->files->put($this->dirname . '.gitignore', "*\n!.gitignore");
} else {
throw new \Exception("Cannot create directory '$this->dirname'..");
}
}
try {
$this->files->put($this->makeFilename($id), json_encode($data));
} catch (\Exception $e) {
//TODO; error handling
}
// Randomly check if we should collect old files
if (rand(1, 100) <= $this->gc_probability) {
$this->garbageCollect();
}
}
/**
* Create the filename for the data, based on the id.
*
* @param $id
* @return string
*/
public function makeFilename($id)
{
return $this->dirname . basename($id) . ".json";
}
/**
* Delete files older then a certain age (gc_lifetime)
*/
protected function garbageCollect()
{
foreach (Finder::create()->files()->name('*.json')->date('< ' . $this->gc_lifetime . ' hour ago')->in(
$this->dirname
) as $file) {
$this->files->delete($file->getRealPath());
}
}
/**
* {@inheritDoc}
*/
public function get($id)
{
return json_decode($this->files->get($this->makeFilename($id)), true);
}
/**
* {@inheritDoc}
*/
public function find(array $filters = [], $max = 20, $offset = 0)
{
// Sort by modified time, newest first
$sort = function (\SplFileInfo $a, \SplFileInfo $b) {
return strcmp($b->getMTime(), $a->getMTime());
};
// Loop through .json files, filter the metadata and stop when max is found.
$i = 0;
$results = [];
foreach (Finder::create()->files()->name('*.json')->in($this->dirname)->sort($sort) as $file) {
if ($i++ < $offset && empty($filters)) {
$results[] = null;
continue;
}
$data = json_decode($file->getContents(), true);
$meta = $data['__meta'];
unset($data);
if ($this->filter($meta, $filters)) {
$results[] = $meta;
}
if (count($results) >= ($max + $offset)) {
break;
}
}
return array_slice($results, $offset, $max);
}
/**
* Filter the metadata for matches.
*
* @param $meta
* @param $filters
* @return bool
*/
protected function filter($meta, $filters)
{
foreach ($filters as $key => $value) {
if (!isset($meta[$key]) || fnmatch($value, $meta[$key]) === false) {
return false;
}
}
return true;
}
/**
* {@inheritDoc}
*/
public function clear()
{
foreach (Finder::create()->files()->name('*.json')->in($this->dirname) as $file) {
$this->files->delete($file->getRealPath());
}
}
}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
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