Commit 7b38f176 by lzzzzl

新增

parent ad9db969
......@@ -303,6 +303,7 @@ class AccessController extends Controller
*/
public function addBoard($request, $data, $id) {
$data['title'] = '添加';
$data['time'] = date("Y-m-d H:i:s");
return view('spiderwindow', $data);
}
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Config;
use DB;
use RedisDB;
class DataManageModel extends Model
{
protected $connection = 'dashboard';
protected $table = 'data_manage';
public $timestamps = false;
/**
* 数据列表
* @param $limit
* @param $p
* @return mixed
*/
public function dataList($limit, $p) {
$limit = !empty($limit) ? $limit : '';
$p = !empty($p) ? $p : 1;
$data = $this->paginate($limit,['*'],'p',$p)->toArray();
foreach ($data['data'] as $k => $v) {
$data['data'][$k]['platform_type'] = platform_type($v['platform_type']);
$data['data'][$k]['status_name'] = platform_status($v['status']);
$data['data'][$k]['frequency'] = timestamp_to_hour($v['frequency']);
$data['data'][$k]['start_time'] = date("Y-m-d H:i:s", $v['start_time']);
$data['data'][$k]['end_time'] = date("Y-m-d H:i:s", $v['end_time']);
}
return $data;
}
public function dataSingle($id) {
$arr = [];
$data = $this->where('id','=',$id)->get();
foreach ($data as $k => $v) {
$arr['platform_name'] = $v['platform_name'];
$arr['platform_cn_name'] = $v['platform_cn_name'];
$arr['key'] = $v['key'];
$arr['frequency'] = $v['frequency'];
$arr['start_time'] = date("Y-m-d H:i:s", $v['start_time']);
$arr['end_time'] = date("Y-m-d H:i:s", $v['end_time']);
$arr['condition'] = $v['condition'];
$arr['condition_desc'] = $v['condition_desc'];
$arr['canal'] = $v['canal'];
$arr['hk_delivery_time'] = $v['hk_delivery_time'];
$arr['cn_delivery_time'] = $v['cn_delivery_time'];
$arr['rmb_ratio'] = $v['rmb_ratio'];
$arr['usd_ratio'] = $v['usd_ratio'];
$arr['file_addr'] = $v['file_addr'];
$arr['file_name'] = $v['file_name'];
$arr['id'] = $v['id'];
}
return $arr;
}
public function updateOnOff() {
$collect = Request::all();
$map['id'] = !empty($collect['id']) ? $collect['id'] : '';
$collect = TrimX($collect, false, ['on_off']);
$result = $this->where($map)->update($collect);
if ($result) {
return [0,'成功'];
} else {
return [1,'失败'];
}
}
public function updateManualPush() {
$collect = Request::all();
$map['id'] = !empty($collect['id']) ? $collect['id'] : '';
$collect = TrimX($collect, false, ['manual_push']);
$result = $this->where($map)->update($collect);
if ($result) {
return [0,'成功'];
} else {
return [1,'失败'];
}
}
public function updateContent() {
$collect = Request::all();
$map['id'] = !empty($collect['id']) ? $collect['id'] : '';
$collect['start_time'] = strtotime($collect['start_time']);
$collect['end_time'] = strtotime($collect['end_time']);
$collect = TrimX($collect, false, ['platform_name','platform_cn_name','key','frequency','start_time','end_time','condition','condition_desc','canal','hk_delivery_time','cn_delivery_time','rmb_ratio','usd_ratio']);
unset($collect['s']);
$result = $this->where($map)->update($collect);
if ($result) {
return [0,'成功'];
} else {
return [1,'失败'];
}
}
public function insertContent() {
$collect = Request::all();
$collect['start_time'] = strtotime($collect['start_time']);
$collect['status'] = 1;
unset($collect['s']);
return $this->insert($collect);
}
public function updateExcelContent() {
$collect = Request::all();
$id = !empty($collect['id']) ? $collect['id'] : 0;
$collect = TrimX($collect, false, ['file_addr','file_name']);
unset($collect['s']);
$result = DB::connection('dashboard')->table('data_manage_file')->insert(array('manage_id' => $id, 'file_addr' => $collect['file_addr'], 'file_name' => $collect['file_name']));
if ($result) {
return [0,'成功'];
} else {
return [1,'失败'];
}
}
public function fileList() {
$collect = Request::all();
$id = !empty($collect['id']) ? $collect['id'] : 0;
$result = DB::connection('dashboard')->table('data_manage_file')->where('manage_id','=',$id)->get();
return ['data' => $result, 'total' => sizeof($result)];
}
public function deleteFile() {
$collect = Request::all();
$id = !empty($collect['id']) ? $collect['id'] : 0;
$result = DB::connection('dashboard')->table('data_manage_file')->where('id','=',$id)->delete();
if ($result) {
return [0,'成功'];
} else {
return [1,'失败'];
}
}
}
......@@ -29,7 +29,10 @@ class SpiderModel extends Model
if (!empty($task_code))
$map[] = ['task_code', '=', $task_code];
$data = $this->where('status','!=',2)->where($map)->paginate($limit,['*'],'p',$p)->toArray();
$map[] = ['status', '!=', 2];
$map[] = ['status', '!=', 3];
$data = $this->where($map)->paginate($limit,['*'],'p',$p)->toArray();
foreach ($data['data'] as $k => $v) {
$data['data'][$k]['status_name'] = platform_status($v['status']);
......@@ -67,7 +70,6 @@ class SpiderModel extends Model
$collect = Request::all();
$collect['start_time'] = strtotime($collect['start_time']);
$collect['status'] = 0;
unset($collect['s']);
return $this->insert($collect);
......
var on_off = 1;
layui.use(['table', 'form', 'laydate', 'layer'], function () {
var laydate = layui.laydate;
......@@ -10,19 +8,16 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
type: 'datetime'
});
form.on('switch(on_off)', function(){
on_off = this.checked ? 1:2;
});
form.on('submit(submit)', function(){
var data = {
on_off: on_off,
status: 3,
platform: $("#platform").val(),
task_code:$("#task_code").val(),
concurrency:$("#concurrency").val(),
queue:$("#queue").val(),
start_time:$("#start_time").val(),
task_type:$("#task_type").val(),
unique_code: Math.round(new Date()/1000) + $("#task_code").val() + $("#concurrency").val(),
}
$.ajax({
url:'/api/ApiAddConfig',
......
<form action="" method="post" class="layui-form" style="margin:30px 50px 20px 0">
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<input type="checkbox" name="check" value="" lay-skin="switch" lay-text="启动|停止" lay-filter="on_off" checked>
</div>
</div>
{{--<div class="layui-form-item">--}}
{{--<label class="layui-form-label">状态</label>--}}
{{--<div class="layui-input-block">--}}
{{--<input type="checkbox" name="check" value="" lay-skin="switch" lay-text="启动|停止" lay-filter="on_off" checked>--}}
{{--</div>--}}
{{--</div>--}}
<div class="layui-form-item">
<label class="layui-form-label"><span class="layui-badge-dot"></span>平台名称</label>
<div class="layui-input-block">
......@@ -13,27 +13,27 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">任务码</label>
<label class="layui-form-label"><span class="layui-badge-dot"></span>任务码</label>
<div class="layui-input-block">
<input type="text" id="task_code" style="width: 250px" class="layui-input">
<input type="text" id="task_code" lay-verify="required" style="width: 250px" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">并发数</label>
<label class="layui-form-label"><span class="layui-badge-dot"></span>并发数</label>
<div class="layui-input-block">
<input type="number" name="concurrency" id="concurrency" style="width: 250px" class="layui-input">
<input type="number" name="concurrency" lay-verify="required" id="concurrency" style="width: 250px" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">队列</label>
<label class="layui-form-label"><span class="layui-badge-dot"></span>队列</label>
<div class="layui-input-block">
<input type="text" name="queue" id="queue" style="width: 250px" class="layui-input">
<input type="text" name="queue" id="queue" lay-verify="required" style="width: 250px" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label"><span class="layui-badge-dot"></span>开始时间</label>
<div class="layui-input-block">
<input type="text" name="start_time" id="start_time" style="width: 250px" lay-verify="required" class="layui-input">
<input type="text" name="start_time" value="{{$time}}" id="start_time" style="width: 250px" lay-verify="required" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
......
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