浏览代码

Merge branch 'master' of http://121.36.46.135:3000/huangzhidong/guoyao-jiankang

ss 1 年之前
父节点
当前提交
edf55faf6e

+ 117 - 0
application/admin/controller/Monitor.php

@@ -0,0 +1,117 @@
+<?php
+namespace app\admin\controller;
+
+use app\common\util\YsUtil;
+use think\App;
+use think\Db;
+
+class Monitor extends Auth
+{
+
+    public function __construct(App $app = null) {
+        parent::__construct($app);
+        $this->model= new \app\common\model\Monitor();
+        $this->table= $this->model->table;
+
+    }
+    public function index(){
+        if(request()->isAjax()){
+            //分页参数
+            $length = input('rows',10,'intval');   //每页条数
+            $page = input('page',1,'intval');      //第几页
+            $start = ($page - 1) * $length;     //分页开始位置
+            //排序
+            $sortRow = input('sidx','id','trim');      //排序列
+            $sort = input('sord','desc','trim');        //排序方式
+            $order = $sortRow.' '.$sort;
+
+            $title = input('title','','trim');
+            if($title){
+                $map[] = ['title','like','%'.$title.'%'];
+            }
+            $enable = input('enable','','trim');
+            if($enable != ''){
+                $map[] = ['enable','=',$enable];
+            }
+            $map[] = ['del','=',0];
+            $map[] = ['org_id','=',$this->orgId];
+            $map= empty($map) ? true: $map;
+            //数据查询
+            $lists = db($this->table)->where($map)->limit($start,$length)->order($order)->select();
+            foreach ($lists as $k=>$v){
+                $lists[$k]['idx'] = think_encrypt($v['id']);
+            }
+            //数据返回
+            $totalCount = db($this->table)->where($map)->count();
+            $totalPage = ceil($totalCount/$length);
+            $result['page'] = $page;
+            $result['total'] = $totalPage;
+            $result['records'] = $totalCount;
+            $result['rows'] = $lists;
+            return json($result);
+        }else{
+            $this->assign('meta_title',"监控设备列表");
+            return $this->fetch();
+        }
+    }
+
+    /**
+     * 新增/编辑
+     */
+    public function add($id=0){
+        if(request()->isPost()){
+            $res = $this->model->updates();
+            if($res){
+                $this->success('操作成功');
+            }else{
+                $this->error($this->model->getError());
+            }
+        }else{
+            $meta_title = '新增监控设备';
+            if($id){
+                $info =db($this->table)->where('id',$id)->find();
+
+                $this->assign('info',$info);
+                $meta_title = '编辑监控设备';
+            }
+            $this->assign('meta_title',$meta_title);
+
+            return $this->fetch();
+        }
+    }
+
+    /**
+     * 删除记录
+     * @param int $id
+     */
+    public function del($id=0){
+        if(!$id){
+            $this->error('参数错误');
+        }
+        $res = db($this->table)->where('id',$id)->setField('del',1);
+        if($res){
+            $this->success('删除成功');
+        }else{
+            $this->error('删除失败');
+        }
+    }
+
+    /**
+     * 改变字段值
+     * @param int $fv
+     * @param string $fn
+     * @param int $fv
+     */
+    public function changeField($id=0,$fn='',$fv=0){
+        if(!$fn||!$id){
+            $this->error('参数错误');
+        }
+        $res = db($this->table)->where('id',$id)->setField($fn,$fv);
+        if($res){
+            $this->success('操作成功');
+        }else{
+            $this->error('操作失败');
+        }
+    }
+
+}

+ 6 - 0
application/admin/view/address/add.html

@@ -61,6 +61,12 @@
                             <input type="text" class="form-control" name="user" value="{$info.user|default=''}">
                         </div>
                     </div>
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">UE5标识</label>
+                        <div class="col-sm-6">
+                            <input type="text" class="form-control" name="ueid" value="{$info.ueid|default=''}">
+                        </div>
+                    </div>
                     <div class="hr-line-dashed"></div>
                     <div class="form-group">
                         <div class="col-sm-6 col-sm-offset-2">

+ 77 - 0
application/admin/view/monitor/add.html

@@ -0,0 +1,77 @@
+{extend name="common/common2" /}
+{block name="main"}
+<div class="row">
+    <div class="col-sm-12">
+        <div class="ibox float-e-margins">
+            <div class="ibox-content">
+                <form method="post" action="{:url('add')}" class="form-horizontal">
+                    <input type="hidden" name="id" value="{$info['id']|default='0'}">
+
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">名称</label>
+                        <div class="col-sm-6">
+                            <input type="text" class="form-control" name="title" value="{$info.title|default=''}">
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">图片</label>
+                        <div class="col-sm-6">
+                            {:widget_view('common/upimg',['name'=>'img','multi'=>0,'val'=>isset($info)?$info['img']:''])}
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">直播地址</label>
+                        <div class="col-sm-6">
+                            <input type="text" class="form-control" name="url" value="{$info.url|default=''}">
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">UE5标识</label>
+                        <div class="col-sm-6">
+                            <input type="text" class="form-control" name="ueid" value="{$info.ueid|default=''}">
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">状态</label>
+                        <div class="col-sm-6">
+                            <label class="cr-inline">
+                                <input type="radio" value="1" name="enable">正常&nbsp;&nbsp;
+                            </label>
+                            <label class="cr-inline">
+                                <input type="radio" value="0" name="enable">禁用
+                            </label>
+                        </div>
+                    </div>
+
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">备注</label>
+                        <div class="col-sm-6">
+                            <input type="text" class="form-control" name="remark" value="{$info.remark|default=''}">
+                        </div>
+                    </div>
+
+                    <div class="hr-line-dashed"></div>
+                    <div class="form-group">
+                        <div class="col-sm-4 col-sm-offset-2">
+                            <button class="btn btn-primary ajax-post" data-layer="1" target-form="form-horizontal" type="submit">确 定</button>
+<!--                            <a href="{:url('index')}" class="btn btn-default">取 消</a>-->
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+</div>
+{/block}
+{block name="script"}
+<script>
+    $(document).ready(function(){
+        formSetValue("enable", {$info.enable|default=1});
+    });
+
+</script>
+{/block}

+ 101 - 0
application/admin/view/monitor/index.html

@@ -0,0 +1,101 @@
+{extend name="common/common2" /}
+{block name="main"}
+
+<div class="ibox">
+    <div class="ibox-content">
+
+        <div class="row">
+            <div class="col-xs-3">
+                <a url="{:url('add')}" href="javascript:;" data-title="新增" onclick="layer_open(this,1)" class="btn btn-sm btn-primary">新增</a>
+            </div>
+            <div class="col-xs-9" style="text-align: right;">
+                <form class="form-inline" id="form-search" action="{:url('index')}">
+                    <div class="input-group">
+                        <input type="text" class="form-control" name="title" placeholder="名称">
+                    </div>
+                    <div class="input-group">
+                        <select name="enable" class="form-control">
+                            <option value="">选择状态</option>
+                            <option value="0">禁用</option>
+                            <option value="1">正常</option>
+                        </select>
+                    </div>
+                    <div class="input-group">
+                        <span class="input-group-btn">
+                            <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
+                        </span>&nbsp;
+                        <span class="input-group-btn">
+                            <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
+                        </span>
+                    </span>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+    <div class="ibox-content">
+        <div class="jqGrid_wrapper">
+            <table id="table" style="border-collapse: collapse"></table>
+            <div id="pager"></div>
+        </div>
+    </div>
+</div>
+{/block}
+{block name="script"}
+<script>
+    $(function () {
+
+        $(window).bind("resize",function(){
+            var width=$(".jqGrid_wrapper").width();
+            $("#table").setGridWidth(width);
+        });
+
+        $.jgrid.defaults.styleUI="Bootstrap";
+        $("#table").jqGrid({
+            url:"{:url('index')}",
+            datatype: "json",
+            colModel:[
+                {label:'名称',name:'title',index:'title',width:100,editable: false,sortable: false},
+                {label:'图片',name:'img',index:'img',width:40,editable: false,sortable: false,formatter: function (a, b, c) {
+                        return '<img src="'+a+'" width="40" onclick="open_img(this)" />';
+                    }},
+                {label:'备注',name:'remark',index:'remark',width:130,editable: false,sortable: false},
+                {label:'状态',name:'status',index:'status',width:80,editable: false,sortable: false,formatter: function (a, b, c) {
+                    if(a == 0){
+                        return '禁用';
+                    }else{
+                        return '正常';
+                    }
+                }},
+                {label:'操作',width:100,sortable: false,formatter: function (a, b, c) {
+                    var editurl = "{:url('add',[],'')}/id/"+c.id;
+                    var delurl = "{:url('del',[],'')}/id/"+c.id;
+                    var monurl = "{:url('h5/Index/monitor',[],'')}/id/"+c.idx;
+                    var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
+                    btn += '<a url="'+monurl+'" href="javascript:;" data-title="监控" onclick="layer_open(this,1)"><span class="label label-primary" title="监控">监控</span></a>&nbsp;';
+                    btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
+                    return btn;
+                }},
+            ],
+            rowNum:10,
+            rowList:[10,20,30,50,100],
+            pager: '#pager',
+            sortname: 'id',
+            viewrecords: true,
+            autowidth:true,
+            mtype: 'post',
+            height: 'auto',
+            emptyrecords: "暂无数据",
+            sortorder: "desc",
+            caption:"{$meta_title}",
+            loadComplete: function (xhr) {
+                if(xhr.code==0){
+                    layer.msg(xhr.msg);
+                    return false;
+                }
+            },
+        });
+    });
+
+</script>
+{/block}

+ 10 - 3
application/api/controller/ue/Order.php

@@ -151,9 +151,16 @@ class Order extends Base {
 
     // 热点耗材数据分析
     public function mates(){
-        $this->orgId = 3;
-        $map[] = ['org_id','=',$this->orgId];
-        $lists = Db::name('todo_mate_item')->where($map)->field('sum(total) as total,items_id')->group('items_id')->order('total desc')->limit(4)->select();
+        $map[] = ['b.org_id','=',$this->orgId];
+        $lists = Db::name('todo_mate_item')
+            ->alias('a')
+            ->join('todo_mate b','a.todo_mate_id = b.id')
+            ->where($map)
+            ->field('sum(a.total) as total,a.items_id')
+            ->group('a.items_id')
+            ->order('total desc')
+            ->limit(4)
+            ->select();
         $i = 1;
         foreach ($lists as $k=>$v){
             $lists[$k]['total'] = intval($v['total']);

+ 48 - 0
application/common/model/Monitor.php

@@ -0,0 +1,48 @@
+<?php
+namespace app\common\model;
+
+use think\Db;
+use tools\Phptree;
+
+class Monitor extends Base
+{
+    public $table = 'monitor';
+    public function updates(){
+        $data = request()->post();
+        $data['org_id'] = cur_org_id();
+        $result = validate('Monitor')->check($data,[],'');
+        if(true !== $result){
+            $this->error = validate('Monitor')->getError();
+            return false;
+        }
+        $id = $data['id'];
+        unset($data['id']);
+        if($id > 0){
+            $data['update_time'] = date('Y-m-d H:i:s');
+            $ret = $this->allowField(true)->save($data,['id'=>$id]);
+        }else{
+            $data['create_time'] = date('Y-m-d H:i:s');
+            $ret = $this->allowField(true)->save($data);
+        }
+        if(!$ret){
+            $this->error = '操作失败';
+            return false;
+        }
+        return true;
+    }
+
+    // 获取组织的监控设备及播放地址
+    public function getMonitors($orgId,$limit=10){
+        $map[] = ['org_id','=',$orgId];
+        $map[] = ['del','=',0];
+        $map[] = ['enable','=',1];
+        $lists = Db::name("monitor")->where($map)->field('id,title,url,img')->limit($limit)->order('id desc')->select();
+        foreach ($lists as $k=>$v){
+            $lists[$k]['url'] = url("h5/Index/monitor",['id'=>think_encrypt($v['id'])],false,true);
+        }
+
+        return $lists;
+    }
+
+
+}

+ 20 - 0
application/common/validate/Monitor.php

@@ -0,0 +1,20 @@
+<?php
+namespace app\common\validate;
+
+use think\Validate;
+
+class Monitor extends Validate{
+
+    protected $rule = [
+        'title|名称'  =>  'require|length:1,50',
+    ];
+
+    protected $message = [
+        'title.length' => '名称必须50字以内',
+    ];
+
+    protected $scene = [
+
+    ];
+
+}

+ 11 - 0
application/h5/controller/Index.php

@@ -80,6 +80,17 @@ class Index extends Controller
         return $this->fetch();
     }
 
+    public function monitor(){
+        $id = think_decrypt(input('id','','trim'));
+        $info = Db::name('monitor')->where('id',$id)->where('del',0)->find();
+        if(!$info){
+            $this->error("监控设备不存在");
+        }
+
+        $this->assign('info',$info);
+
+        return $this->fetch();
+    }
 
     //温控统计
     public function TemperatureTj(){

+ 40 - 0
application/h5/view/index/monitor.html

@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>监控</title>
+    <link href="/static/videojs8.3.0/video-js.css" rel="stylesheet" />
+    <script src="/static/videojs8.3.0/video.min.js"></script>
+    <style>
+        html,body{
+            padding: 0;
+            margin: 0;
+        }
+        #videobox{
+            position: fixed;
+            z-index: 10;
+            top: 0;
+            left: 0;
+            right: 0;
+            bottom: 0;
+        }
+    </style>
+</head>
+<body>
+<div id="videobox">
+    <video id="video" class="video-js vjs-default-skin" style="width:100%;height:100%;" controls autoplay></video>
+</div>
+<script>
+    var video = videojs("video", {
+        techOrder: ["html5", "flash"],
+        sources: [
+            {
+                src: "{$info.url}",
+                type: "application/x-mpegURL",
+            },
+        ],
+    });
+    // video.play();
+</script>
+</body>
+</html>
+

+ 1 - 1
public/.htaccess2

@@ -7,5 +7,5 @@
 #  RewriteRule ^(.*)$ index.html/$1 [QSA,PT,L]
   RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
 
-   SetEnvIf Authorization ^(.*) HTTP_AUTHORIZATION=$1
+  SetEnvIf Authorization ^(.*) HTTP_AUTHORIZATION=$1
 </IfModule>

+ 2 - 2
public/camera/config.js

@@ -1,7 +1,7 @@
 // 开放平台环境地址,无需修改
 // const base_url = 'https://www.cloud-dahua.com'
-const base_url = 'http://gyjk.jya-tech.com'
-// const base_url = 'http://gt60.demo.com'
+// const base_url = 'http://gyjk.jya-tech.com'
+const base_url = 'http://wy.yjafw.com'
 // 连接websocket默认端口,无需修改
 const websocket_port = '7500'
 

文件差异内容过多而无法显示
+ 1831 - 0
public/static/videojs8.3.0/video-js.css


文件差异内容过多而无法显示
+ 40 - 0
public/static/videojs8.3.0/video.min.js