Commit 6fb17b90 by lzzzzl

新增过期sku

parent f14fd450
......@@ -169,4 +169,14 @@ class AccessApiController extends Controller
}
private function ApiExpireSku($request) {
$start_time = empty($request['start_time']) ? strtotime("-1 day") : strtotime($request['start_time']);
$end_time = empty($request['end_time']) ? strtotime("0 day") : strtotime($request['end_time']);
$data = (new SpiderModel())->expiredSku($start_time, $end_time);
$this->ExportLayui(0,'成功',$data,sizeof($data));
}
}
......@@ -382,4 +382,16 @@ class AccessController extends Controller
return view('spider_card', $data);
}
/**
* 过期SKU
* @param $request
* @param $data
* @param $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function expiredSku($request, $data, $id) {
$data['title'] = '过期SKU';
return view('spider_card', $data);
}
}
......@@ -312,6 +312,26 @@ class SpiderModel extends Model
}
public function expiredSku($start_time, $end_time) {
$map = [];
$map[] = ['time_stamp', '<=', $end_time];
$map[] = ['time_stamp', '>=', $start_time];
$data = DB::connection('dashboard')->table('spider_expired_rate')->where($map)->get();
$arr = [];
foreach ($data as $k => $v) {
$time = date("Y-m-d H:i:s", $v['time_stamp']);
if (!array_key_exists($time, $arr))
$arr[$time] = [];
array_push($arr[$time], [$v['platform'] => $v['expired_rate']]);
}
return $arr;
}
/**
* 补充人员数据
*/
......
......@@ -6,7 +6,8 @@ return [
'NotAuth'
),
//api不用验证方法
'ApiNotAuth'=>array('ApiSpiderList','ApiUpdateStatus','ApiConfigContent','ApiAddConfig','ApiUpdateNode','ApiUpdateAllNode','ApiUpdateAllBoard', 'ApiLogsList', 'ApiEffectSku'
'ApiNotAuth'=>array('ApiSpiderList','ApiUpdateStatus','ApiConfigContent','ApiAddConfig','ApiUpdateNode','ApiUpdateAllNode','ApiUpdateAllBoard', 'ApiLogsList', 'ApiEffectSku',
'ApiExpireSku'
),
'MenuSign'=>'/web/',//菜单去除掉标记,生成菜单时用
......
<div style="padding: 20px; background-color: #F2F2F2;">
<div class="layui-row layui-col-space10">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-input-inline">
<label class="layui-form-label">时间筛选:</label>
<div class="layui-input-inline">
<input type="text" name="start_time" id="start_time" autocomplete="off" class="layui-input" value="{{$_GET['start_time'] or ''}}">
</div>
-
<div class="layui-input-inline">
<input type="text" name="end_time" id="end_time" autocomplete="off" class="layui-input" value="{{$_GET['end_time'] or ''}}">
</div>
<div class="layui-inline">
<button class="btn btn btn-outline btn-primary load" lay-submit lay-filter="*" data-type="reload" id="search">搜索</button>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-col-md12">
<span style="font-size:20px;font-weight:bold">数据概览</span>
<span class="layui-badge-dot layui-bg-orange"></span>
</div>
<div id="page" style="width: auto;height: 600px"></div>
</div>
</div>
</div>
</div>
<script src="/js/echarts.min.js"></script>
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