提交 406eb26c 编写于 作者: D devil

cj

上级 8536186e
......@@ -86,19 +86,19 @@ class Index extends Common
$order_complete_money = StatisticalService::OrderCompleteMoneyYesterdayTodayTotal();
$this->assign('order_complete_money', $order_complete_money['data']);
// 近30日成交金额走势
// 近30日订单成交金额走势
$order_profit_chart = StatisticalService::OrderProfitSevenTodayTotal();
$this->assign('order_profit_chart', $order_profit_chart['data']);
// 近15日订单交易走势
// 近30日订单交易走势
$order_trading_trend = StatisticalService::OrderTradingTrendSevenTodayTotal();
$this->assign('order_trading_trend', $order_trading_trend['data']);
// 近15日订单支付方式
$order_type_number = StatisticalService::OrderPayTypeSevenTodayTotal();
$this->assign('order_type_number', $order_type_number['data']);
// 近30日支付方式
$pay_type_number = StatisticalService::PayTypeSevenTodayTotal();
$this->assign('pay_type_number', $pay_type_number['data']);
// 近15日热销商品
// 近30日热销商品
$goods_hot_sale = StatisticalService::GoodsHotSaleSevenTodayTotal();
$this->assign('goods_hot_sale', $goods_hot_sale['data']);
......
......@@ -73,11 +73,11 @@
</ul>
</div>
<!-- 近30日成交金额走势 -->
<!-- 近30日订单成交金额走势 -->
<div class="echarts-container">
<div class="echarts-title">
<span class="icon"></span>
<span class="title">近30日成交金额走势</span>
<span class="title">近30日订单成交金额走势</span>
</div>
<div id="echarts-order-profit"></div>
</div>
......@@ -103,12 +103,12 @@
</li>
<li>
<!-- 近30日订单支付方式 -->
<!-- 近30日支付方式 -->
<div class="echarts-title">
<span class="icon"></span>
<span class="title">近30日订单支付方式</span>
<span class="title">近30日支付方式</span>
</div>
<div id="echarts-order-pay-type"></div>
<div id="echarts-pay-type"></div>
</li>
</ul>
......@@ -167,7 +167,7 @@
<script type="text/javascript">
$(function()
{
// 近30日成交金额走势
// 近30日订单成交金额走势
var order_profit_chart = echarts.init(document.getElementById('echarts-order-profit'), 'macarons');
var option = {
tooltip : {
......@@ -306,14 +306,14 @@ $(function()
};
goods_hot_chart.setOption(option);
// 近30日订单支付方式
var order_pay_type_chart = echarts.init(document.getElementById('echarts-order-pay-type'), 'macarons');
// 近30日支付方式
var order_pay_type_chart = echarts.init(document.getElementById('echarts-pay-type'), 'macarons');
var option = {
tooltip : {
trigger: 'axis'
},
legend: {
data: {{:json_encode($order_type_number.title_arr)}}
data: {{:json_encode($pay_type_number.title_arr)}}
},
toolbox: {
show : {{if IsMobile()}}false{{else}}true{{/if}},
......@@ -322,7 +322,7 @@ $(function()
dataView : {show: true, readOnly: false},
magicType : {show: true, type: ['line', 'bar']},
restore : {show: false},
saveAsImage : {name:'近30日订单支付方式', show: true}
saveAsImage : {name:'近30日支付方式', show: true}
}
},
calculable : true,
......@@ -330,7 +330,7 @@ $(function()
{
type : 'category',
boundaryGap : false,
data : {{:json_encode($order_type_number.name_arr)}}
data : {{:json_encode($pay_type_number.name_arr)}}
}
],
yAxis : [
......@@ -338,7 +338,7 @@ $(function()
type : 'value'
}
],
series : {{:json_encode($order_type_number.data)}}
series : {{:json_encode($pay_type_number.data)}}
};
order_pay_type_chart.setOption(option);
......
......@@ -142,7 +142,7 @@ class GoodsService
* @desc description
* @param [array] $data [商品分类数据 二维数组]
*/
private static function GoodsCategoryDataDealWith($data)
public static function GoodsCategoryDataDealWith($data)
{
if(!empty($data) && is_array($data))
{
......@@ -1064,7 +1064,7 @@ class GoodsService
* @param [array] $params [输入参数]
* @param [int] $goods_id [商品id]
*/
private static function GoodsParametersInsert($params, $goods_id)
public static function GoodsParametersInsert($params, $goods_id)
{
// 删除商品参数
Db::name('GoodsParams')->where(['goods_id'=>$goods_id])->delete();
......@@ -1107,7 +1107,7 @@ class GoodsService
* @param [array] $params [输入参数]
* @param [int] $goods_id [商品id]
*/
private static function GoodsSaveBaseUpdate($params, $goods_id)
public static function GoodsSaveBaseUpdate($params, $goods_id)
{
$data = Db::name('GoodsSpecBase')->field('min(price) AS min_price, max(price) AS max_price, sum(inventory) AS inventory, min(original_price) AS min_original_price, max(original_price) AS max_original_price')->where(['goods_id'=>$goods_id])->find();
if(empty($data))
......@@ -1139,7 +1139,7 @@ class GoodsService
* @desc description
* @param [array] $params [输入参数]
*/
private static function GetFormGoodsSpecificationsParams($params = [])
public static function GetFormGoodsSpecificationsParams($params = [])
{
$data = [];
$title = [];
......@@ -1311,7 +1311,7 @@ class GoodsService
* @desc description
* @param [array] $params [输入参数]
*/
private static function GetFormGoodsSpecificationsBaseParams($params = [])
public static function GetFormGoodsSpecificationsBaseParams($params = [])
{
$result = [];
foreach($params as $k=>$v)
......@@ -1338,7 +1338,7 @@ class GoodsService
* @param [array] $params [输入参数]
* @return [array] [一维数组但图片地址]
*/
private static function GetFormGoodsPhotoParams($params = [])
public static function GetFormGoodsPhotoParams($params = [])
{
if(empty($params['photo']))
{
......@@ -1365,7 +1365,7 @@ class GoodsService
* @desc description
* @param [array] $params [输入参数]
*/
private static function GetFormGoodsContentAppParams($params = [])
public static function GetFormGoodsContentAppParams($params = [])
{
// 开始处理
$result = [];
......@@ -1399,7 +1399,7 @@ class GoodsService
* @param [int] $goods_id [商品id]
* @return [array] [boolean | msg]
*/
private static function GoodsCategoryInsert($data, $goods_id)
public static function GoodsCategoryInsert($data, $goods_id)
{
Db::name('GoodsCategoryJoin')->where(['goods_id'=>$goods_id])->delete();
if(!empty($data))
......@@ -1431,7 +1431,7 @@ class GoodsService
* @param [int] $goods_id [商品id]
* @return [array] [boolean | msg]
*/
private static function GoodsContentAppInsert($data, $goods_id)
public static function GoodsContentAppInsert($data, $goods_id)
{
Db::name('GoodsContentApp')->where(['goods_id'=>$goods_id])->delete();
if(!empty($data))
......@@ -1465,7 +1465,7 @@ class GoodsService
* @param [int] $goods_id [商品id]
* @return [array] [boolean | msg]
*/
private static function GoodsPhotoInsert($data, $goods_id)
public static function GoodsPhotoInsert($data, $goods_id)
{
Db::name('GoodsPhoto')->where(['goods_id'=>$goods_id])->delete();
if(!empty($data))
......@@ -1499,7 +1499,7 @@ class GoodsService
* @param [int] $goods_id [商品id]
* @return [array] [boolean | msg]
*/
private static function GoodsSpecificationsInsert($data, $goods_id)
public static function GoodsSpecificationsInsert($data, $goods_id)
{
// 删除原来的数据
Db::name('GoodsSpecType')->where(['goods_id'=>$goods_id])->delete();
......
......@@ -413,21 +413,22 @@ class StatisticalService
}
/**
* 订单支付方式, 30天数据
* 支付方式, 30天数据
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
* @param [array] $params [输入参数]
*/
public static function OrderPayTypeSevenTodayTotal($params = [])
public static function PayTypeSevenTodayTotal($params = [])
{
// 初始化
self::Init($params);
// 获取支付方式名称
$where = [
['business_type', '=', 1],
['business_type', '<>', ''],
['status', '=', 1],
];
$pay_name_arr = Db::name('PayLog')->where($where)->group('payment_name')->column('payment_name');
......
......@@ -29,6 +29,7 @@ class Excel
private $horizontal_center;
private $vertical_center;
private $warap_text;
private $writer_type;
/**
* [__construct 构造方法]
......@@ -79,6 +80,9 @@ class Excel
// 内容自动换行
$this->warap_text = isset($params['warap_text']) ? intval($params['warap_text']) : 1;
// excel写入类型
$this->writer_type = empty($params['writer_type']) ? 'Excel2007' : teim($params['writer_type']);
// 引入PHPExcel类库
require ROOT.'extend'.DS.'phpexcel'.DS.'PHPExcel.php';
}
......@@ -117,7 +121,7 @@ class Excel
// 默认EXCEL
default:
$writer = \PHPExcel_IOFactory::createWriter($excel, 'Excel5');
$writer = \PHPExcel_IOFactory::createWriter($excel, $this->writer_type);
}
// 获取配置编码类型
......@@ -220,21 +224,14 @@ class Excel
public function Import($file = '')
{
// 文件为空则取全局文变量excel的临时文件
if(empty($file) && !empty($_FILES['excel']['tmp_name']))
{
$file = $_FILES['excel']['tmp_name'];
}
// 文件地址是否有误,title数据是否有数据
if(empty($file) || empty($this->title))
if(empty($file) && (empty($_FILES['file']) || empty($_FILES['file']['tmp_name'])))
{
echo '<script>alert("'.$this->msg.'");</script>';
echo '<script>window.location.href="'.$this->jump_url.'"</script>';
die;
return DataReturn('文件为空', -1);
}
$file = empty($file) ? $_FILES['file']['tmp_name'] : $file;
// 取得文件基础数据
$reader = \PHPExcel_IOFactory::createReader('Excel5');
$reader = \PHPExcel_IOFactory::createReader($this->writer_type);
$excel = $reader->load($file);
// 取得总行数
......@@ -250,42 +247,34 @@ class Excel
$highest_column_index = \PHPExcel_Cell::columnIndexFromString($highest_column);
// 定义变量
$result = [];
$field = [];
$data = [];
$title = [];
// 读取数据
for($row=1; $row<=$highest_row; $row++)
{
// 临时数据
$info = [];
// 注意 highest_column_index 的列数索引从0开始
$info = [];
for($col = 0; $col < $highest_column_index; $col++)
{
$value = $worksheet->getCellByColumnAndRow($col, $row)->getFormattedValue();
$value = trim($worksheet->getCellByColumnAndRow($col, $row)->getFormattedValue());
if($row == 1)
{
foreach($this->title as $tk=>$tv)
{
if($value == $tv['name'])
{
$tv['field'] = $tk;
$field[$col] = $tv;
}
}
$title[] = $value;
} else {
if(!empty($field))
{
$info[$field[$col]['field']] = ($field[$col]['type'] == 'int') ? trim(ScienceNumToString($value)) : trim($value);
}
$info[] = $value;
}
}
if($row > 1)
{
$result[] = $info;
$data[] = $info;
}
}
return $result;
$result = [
'title' => $title,
'data' => $data,
];
return DataReturn('处理成功', 0, $result);
}
}
?>
\ No newline at end of file
......@@ -136,7 +136,7 @@ html, body {
/**
* 支付方式
*/
#echarts-order-pay-type {
#echarts-pay-type {
margin-top: 10px;
height: 400px;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册