Bladeren bron

Merge branch 'master' of http://59.57.98.130:3000/jjhc/odd_job

jiangzixin 1 jaar geleden
bovenliggende
commit
fbc36a7feb

+ 11 - 2
app/admin/controller/Broker.php

@@ -43,8 +43,8 @@ class Broker extends BaseController
 
     public function editBroker()
     {
-        $id          = input('id/d');
-        $data        = [
+        $id   = input('id/d');
+        $data = [
             'title'       => input('title/s', ""),
             'mobile'      => input('mobile/s', ""),
             'weixin'      => input('weixin/s', ""),
@@ -56,8 +56,17 @@ class Broker extends BaseController
             'details'     => input('details/s', ""),
             'powerreport' => input('powerreport/d') == 1 ? 1 : 2,
             'status'      => input('status/d') == 1 ? 1 : 2,
+            'latitude'    => input('latitude/f', 0),
+            'longitude'   => input('longitude/f', 0),
         ];
 
+        if (empty($data['latitude']) || empty($data['longitude'])) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => '请选择地理位置',
+            ]));
+        }
+
         //镇街
         $townvillage = input('townvillage');
         if (empty($townvillage)) {

+ 311 - 205
app/admin/controller/Notice.php

@@ -1,217 +1,323 @@
 <?php
+
 namespace app\admin\controller;
 
-use think\facade\Session;
 use app\admin\BaseController;
 use app\common\model\Notice as NoticeModel;
 use app\common\model\NoticeCate as NoticeCateModel;
+use app\common\model\BrokerNotice as BrokerNoticeModel;
 
 class Notice extends BaseController
 {
 
-	// 删除
-	public function delNotice()
-	{
-		$idarr = input('idarr/a');
-		NoticeModel::whereIn('id',$idarr)->delete();
-		exit(json_encode(array(
-			'code' 	=> 0,
-			'msg'	=> ""
-		)));
-	}
-
-	// 编辑&添加
-	public function editNotice()
-	{
-		$id = input('id/d');
-		if (empty($id)){
-			NoticeModel::create([
-				'cateid'      => input('cateid/d'),
-				'title'       => input('title/s'),
-				'details'     => input('details/s'),
-				'priority'    => input('priority/d'),
-				'createtime'  => input('createtime/s'),
-				'status'	  => input('status/d')==1 ? 1 : 2,
-				'volume'      => input('volume/d') 
-			]);
-		}else{
-			NoticeModel::update([
-				'id'		  => $id,
-				'cateid'      => input('cateid/d'),
-				'title'       => input('title/s'),
-				'details'     => input('details/s'),
-				'priority'    => input('priority/d'),
-				'createtime'  => input('createtime/s'),
-				'status'	  => input('status/d')==1 ? 1 : 2,
-				'volume'      => input('volume/d') 
-			]);
-		}
-		exit(json_encode(array(
-			'code' 	=> 0
-		)));
-	}
-	 
-	// 列表
-	public function noticeList()
-	{
-		$catelist = NoticeCateModel::order(['priority'=>'desc','id'=>'desc'])->select();;
-		return view('artapp/notice/noticelist',[
-			'catelist'	=> $catelist
-		]);
-	}
-	
-	public function noticeForm()
-	{
-		$catelist = NoticeCateModel::order(['priority'=>'desc','id'=>'desc'])->select();
-		$id = input('id/d, 0');
-		$notice = NoticeModel::findOrEmpty($id);
-		if ($notice->isEmpty()){
-			$notice['atype'] = 1;
-		}
-		return view('artapp/notice/noticeform',[
-			'catelist'	=> $catelist,
-			'notice'	=> $notice
-		]);
-	}
-	
-	public function fieldNotice()
-	{
-		$id = input('id/d',0); 
-		$info = NoticeModel::findOrEmpty($id);
-		if ($info->isEmpty()){
-			exit(json_encode(array(
-				'code' 	=> 1,
-				'msg'	=> "信息不存在"
-			)));
-		}else{
-			$info->save([
-				input('field/s')  => input('value/s', "")
-			]);
-		}
-		exit(json_encode(array(
-			'code' 	=> 0
-		)));
-	}
-	
-	
-	public function listNotice()
-	{
-		$limit = input('limit');
-		$page = input('page');
-		$map = array();
-		$keywords = input('keywords/s');
-		if (!empty($keywords)){
-			$map[] =['title', 'like', '%'.$keywords.'%'];
-		}
-		$cateid = input('cateid/d');
-		if (!empty($cateid)){
-			$map[] = ['cateid', '=', $cateid];
-		}
-		$status = input('status/d');
-		if (!empty($status)){
-			$map[] = ['status', '=', $status];
-		}
-		$list = NoticeModel::with('noticeCate')->where($map)->order(['priority'=>'desc','id'=>'desc'])->limit($limit)->page($page)->append(['status_text'])->select();
-		$count = NoticeModel::where($map)->count();
-		if ($count==0){
-			exit(json_encode(array(
-				'code' 	=> 1,
-				'msg'	=> "未查询到数据"
-			)));
-		}
-		exit(json_encode(array(
-			'code' 	=> 0,
-			'msg'	=> "",
-			'count' => $count,
-			'data'  => $list
-		)));
-	}
-
-
-	// 分类
-	public function cateList()
-	{
-		return view('artapp/notice/catelist');
-	}
-	
-	public function cateForm()
-	{
-		$id = input('id/d, 0');
-		$cate = NoticeCateModel::findOrEmpty($id);
-		return view('artapp/notice/cateform',[
-			'cate'	=> $cate
-		]);
-	}
-	
-	public function listCate()
-	{
-		$limit = input('limit');
-		$page = input('page');
-		$list = NoticeCateModel::order(['priority'=>'desc','id'=>'desc'])->limit($limit)->page($page)->append(['status_text'])->select();
-		$count = NoticeCateModel::count();
-		if ($count==0){
-			exit(json_encode(array(
-				'code' 	=> 1,
-				'msg'	=> "未查询到数据"
-			)));
-		}
-		exit(json_encode(array(
-			'code' 	=> 0,
-			'msg'	=> "",
-			'count' => $count,
-			'data'  => $list
-		)));
-	}	
-	
-	public function fieldCate()
-	{
-		$id = input('id/d');
-		$cate = NoticeCateModel::find($id);
-		if ($cate==null){
-			exit(json_encode(array(
-				'code' 	=> 1,
-				'msg'	=> "分类信息不存在"
-			)));
-		}else{
-			$cate->save([
-				input('field/s')  => input('value/s', "")
-			]);
-		}
-		exit(json_encode(array(
-			'code' 	=> 0
-		)));
-	}
-	
-	public function editCate()
-	{
-		$id = input('id/d');
-		if (empty($id)){
-			$cate = NoticeCateModel::create([
-				'title' 	=> input('title/s'),
-				'status'    => input('status/d')==1 ? 1 : 2,
-				'priority'  => input('priority/d')
-			]);
-		}else{
-			$cate = NoticeCateModel::find($id);
-			$cate->save([
-				'title' 	=> input('title/s'),
-				'status'    => input('status/d')==1 ? 1 : 2,
-				'priority'  => input('priority/d')
-			]);
-		}
-		exit(json_encode(array(
-			'code' 	=> 0
-		)));
-	}
-	
-	public function delCate()
-	{
-		$id = input('id/d');
-		NoticeCateModel::where('id',$id)->delete();
-		exit(json_encode(array(
-			'code' 	=> 0,
-			'msg'	=> ""
-		)));
-	}
+    // 删除
+    public function delNotice()
+    {
+        $idarr = input('idarr/a');
+        NoticeModel::whereIn('id', $idarr)->delete();
+        exit(json_encode([
+            'code' => 0,
+            'msg'  => "",
+        ]));
+    }
+
+    // 编辑&添加
+    public function editNotice()
+    {
+        $id = input('id/d');
+        if (empty($id)) {
+            NoticeModel::create([
+                'cateid'     => input('cateid/d'),
+                'title'      => input('title/s'),
+                'details'    => input('details/s'),
+                'priority'   => input('priority/d'),
+                'createtime' => input('createtime/s'),
+                'status'     => input('status/d') == 1 ? 1 : 2,
+                'volume'     => input('volume/d'),
+            ]);
+        } else {
+            NoticeModel::update([
+                'id'         => $id,
+                'cateid'     => input('cateid/d'),
+                'title'      => input('title/s'),
+                'details'    => input('details/s'),
+                'priority'   => input('priority/d'),
+                'createtime' => input('createtime/s'),
+                'status'     => input('status/d') == 1 ? 1 : 2,
+                'volume'     => input('volume/d'),
+            ]);
+        }
+        exit(json_encode([
+            'code' => 0,
+        ]));
+    }
+
+    // 列表
+    public function noticeList()
+    {
+        $catelist = NoticeCateModel::order(['priority' => 'desc', 'id' => 'desc'])->select();;
+        return view('artapp/notice/noticelist', [
+            'catelist' => $catelist,
+        ]);
+    }
+
+    public function noticeForm()
+    {
+        $catelist = NoticeCateModel::order(['priority' => 'desc', 'id' => 'desc'])->select();
+        $id       = input('id/d, 0');
+        $notice   = NoticeModel::findOrEmpty($id);
+        if ($notice->isEmpty()) {
+            $notice['atype'] = 1;
+        }
+        return view('artapp/notice/noticeform', [
+            'catelist' => $catelist,
+            'notice'   => $notice,
+        ]);
+    }
+
+    public function fieldNotice()
+    {
+        $id   = input('id/d', 0);
+        $info = NoticeModel::findOrEmpty($id);
+        if ($info->isEmpty()) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => "信息不存在",
+            ]));
+        } else {
+            $info->save([
+                input('field/s') => input('value/s', ""),
+            ]);
+        }
+        exit(json_encode([
+            'code' => 0,
+        ]));
+    }
+
+
+    public function listNotice()
+    {
+        $limit    = input('limit');
+        $page     = input('page');
+        $map      = [];
+        $keywords = input('keywords/s');
+        if (!empty($keywords)) {
+            $map[] = ['title', 'like', '%' . $keywords . '%'];
+        }
+        $cateid = input('cateid/d');
+        if (!empty($cateid)) {
+            $map[] = ['cateid', '=', $cateid];
+        }
+        $status = input('status/d');
+        if (!empty($status)) {
+            $map[] = ['status', '=', $status];
+        }
+        $list  = NoticeModel::with('noticeCate')->where($map)->order(['priority' => 'desc', 'id' => 'desc'])->limit($limit)->page($page)->append(['status_text'])->select();
+        $count = NoticeModel::where($map)->count();
+        if ($count == 0) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => "未查询到数据",
+            ]));
+        }
+        exit(json_encode([
+            'code'  => 0,
+            'msg'   => "",
+            'count' => $count,
+            'data'  => $list,
+        ]));
+    }
+
+
+    // 分类
+    public function cateList()
+    {
+        return view('artapp/notice/catelist');
+    }
+
+    public function cateForm()
+    {
+        $id   = input('id/d, 0');
+        $cate = NoticeCateModel::findOrEmpty($id);
+        return view('artapp/notice/cateform', [
+            'cate' => $cate,
+        ]);
+    }
+
+    public function listCate()
+    {
+        $limit = input('limit');
+        $page  = input('page');
+        $list  = NoticeCateModel::order(['priority' => 'desc', 'id' => 'desc'])->limit($limit)->page($page)->append(['status_text'])->select();
+        $count = NoticeCateModel::count();
+        if ($count == 0) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => "未查询到数据",
+            ]));
+        }
+        exit(json_encode([
+            'code'  => 0,
+            'msg'   => "",
+            'count' => $count,
+            'data'  => $list,
+        ]));
+    }
+
+    public function fieldCate()
+    {
+        $id   = input('id/d');
+        $cate = NoticeCateModel::find($id);
+        if ($cate == null) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => "分类信息不存在",
+            ]));
+        } else {
+            $cate->save([
+                input('field/s') => input('value/s', ""),
+            ]);
+        }
+        exit(json_encode([
+            'code' => 0,
+        ]));
+    }
+
+    public function editCate()
+    {
+        $id = input('id/d');
+        if (empty($id)) {
+            $cate = NoticeCateModel::create([
+                'title'    => input('title/s'),
+                'status'   => input('status/d') == 1 ? 1 : 2,
+                'priority' => input('priority/d'),
+            ]);
+        } else {
+            $cate = NoticeCateModel::find($id);
+            $cate->save([
+                'title'    => input('title/s'),
+                'status'   => input('status/d') == 1 ? 1 : 2,
+                'priority' => input('priority/d'),
+            ]);
+        }
+        exit(json_encode([
+            'code' => 0,
+        ]));
+    }
+
+    public function delCate()
+    {
+        $id = input('id/d');
+        NoticeCateModel::where('id', $id)->delete();
+        exit(json_encode([
+            'code' => 0,
+            'msg'  => "",
+        ]));
+    }
+
+    // 列表
+    public function brokerNotice()
+    {
+        return view('artapp/notice/brokernotice');
+    }
+
+    public function listBrokerNotice()
+    {
+        $limit    = input('limit');
+        $page     = input('page');
+        $map      = [];
+        $keywords = input('keywords/s');
+        if (!empty($keywords)) {
+            $map[] = ['title', 'like', '%' . $keywords . '%'];
+        }
+        $status = input('status/d');
+        if (!empty($status)) {
+            $map[] = ['status', '=', $status];
+        }
+        $list  = BrokerNoticeModel::where($map)->order(['priority' => 'desc', 'id' => 'desc'])->limit($limit)->page($page)->append(['status_text'])->select();
+        $count = BrokerNoticeModel::where($map)->count();
+        if ($count == 0) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => "未查询到数据",
+            ]));
+        }
+        exit(json_encode([
+            'code'  => 0,
+            'msg'   => "",
+            'count' => $count,
+            'data'  => $list,
+        ]));
+    }
+
+    public function fieldBrokerNotice()
+    {
+        $id   = input('id/d', 0);
+        $info = BrokerNoticeModel::findOrEmpty($id);
+        if ($info->isEmpty()) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => "信息不存在",
+            ]));
+        } else {
+            $info->save([
+                input('field/s') => input('value/s', ""),
+            ]);
+        }
+        exit(json_encode([
+            'code' => 0,
+        ]));
+    }
+
+    // 删除
+    public function delBrokerNotice()
+    {
+        $idarr = input('idarr/a');
+        BrokerNoticeModel::whereIn('id', $idarr)->delete();
+        exit(json_encode([
+            'code' => 0,
+            'msg'  => "",
+        ]));
+    }
+
+    public function brokerNoticeForm()
+    {
+        $id       = input('id/d, 0');
+        $notice   = BrokerNoticeModel::findOrEmpty($id);
+        if ($notice->isEmpty()) {
+            $notice['atype'] = 1;
+        }
+        return view('artapp/notice/brokernoticeform', [
+            'notice'   => $notice,
+        ]);
+    }
 
+    // 编辑&添加
+    public function editBrokerNotice()
+    {
+        $id = input('id/d');
+        if (empty($id)) {
+            BrokerNoticeModel::create([
+                'title'      => input('title/s'),
+                'details'    => input('details/s'),
+                'priority'   => input('priority/d'),
+                'createtime' => input('createtime/s'),
+                'status'     => input('status/d') == 1 ? 1 : 2,
+                'volume'     => input('volume/d'),
+            ]);
+        } else {
+            BrokerNoticeModel::update([
+                'id'         => $id,
+                'title'      => input('title/s'),
+                'details'    => input('details/s'),
+                'priority'   => input('priority/d'),
+                'createtime' => input('createtime/s'),
+                'status'     => input('status/d') == 1 ? 1 : 2,
+                'volume'     => input('volume/d'),
+            ]);
+        }
+        exit(json_encode([
+            'code' => 0,
+        ]));
+    }
 }

+ 180 - 0
app/admin/view/artapp/notice/brokernotice.html

@@ -0,0 +1,180 @@
+<div class="layui-fluid">
+	<div class="layui-card">
+		<div class="layui-form layui-form-pane layui-card-header layuiadmin-card-header-auto" lay-filter="LAY-artapp-notice-noticelist-search">
+			<div class="layui-form-item">
+				<div class="layui-inline">
+					<label class="layui-form-label">标题</label>
+					<div class="layui-input-block">
+						<input type="text" name="keywords" placeholder="请输入" autocomplete="off" class="layui-input">
+					</div>
+				</div>
+				<div class="layui-inline">
+					<label class="layui-form-label">状态</label>
+					<div class="layui-input-block">
+						<select name="status">
+							<option value="">全部状态</option>
+							<option value="1">已发布</option>
+							<option value="2">待修改</option>
+						</select>
+					</div>
+				</div>
+				<div class="layui-inline">
+					<button class="layui-btn" lay-submit lay-filter="LAY-artapp-notice-noticelist-search-btn">
+						<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
+					</button>
+				</div>
+			</div>
+		</div>
+
+		<div class="layui-card-body">
+			<div style="padding-bottom: 10px;">
+				<button class="layui-btn layuiadmin-btn" data-type="batchdel">删除</button>
+				<button class="layui-btn layuiadmin-btn" data-type="add">添加</button>
+			</div>
+			<table id="LAY-artapp-notice-noticelist-table" lay-filter="LAY-artapp-notice-noticelist-table"></table>
+			<script type="text/html" id="priorityTpl">
+				{{chnNumChar[d.priority]}}
+			</script>
+			<script type="text/html" id="setTpl">
+				<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
+				<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
+			</script>
+		</div>
+
+	</div>
+</div>
+
+<script>
+	var chnNumChar = ["", "置顶一", "置顶二", "置顶三", "置顶四", "置顶五", "置顶六", "置顶七", "置顶八", "置顶九"];
+	layui.config({
+		base: '/static/echoui/' //静态资源所在路径
+	}).extend({
+		index: 'lib/index' //主入口模块
+	}).use(['index', 'form', 'set', 'table'], function() {
+		var $ = layui.$,
+			setter = layui.setter,
+			admin = layui.admin,
+			form = layui.form,
+			table = layui.table;
+		form.render();
+
+		//列表
+		table.render({
+			elem: '#LAY-artapp-notice-noticelist-table',
+			url: setter.baseAdminUrl + 'notice/listBrokerNotice',
+			cols: [
+				[
+					{ type: 'checkbox', fixed: 'left' },
+					{ field: 'id', width: 80, title: '表ID', sort: true },
+					{ field: 'priority', width: 80, title: '置顶', templet: '#priorityTpl' },
+					{ field: 'title', title: '标题', edit: 'text' },
+					{ field: 'createtime', width: 200, title: '发布时间', sort: true },
+					{ field: 'volume', width: 100, title: '浏览量', sort: true },
+					{ field: 'status_text', width: 100, title: '状态', minWidth: 80, align: 'center' },
+					{ title: '操作', width: 200, align: 'center', fixed: 'right', toolbar: '#setTpl' }
+				]
+			],
+			page: true,
+			limit: 50,
+			cellMinWidth: 150,
+			text: '对不起,加载出现异常!'
+		});
+
+		//监听搜索
+		form.on('submit(LAY-artapp-notice-noticelist-search-btn)', function(data) {
+			table.reload('LAY-artapp-notice-noticelist-table', {
+				where: data.field,
+				page: {
+					curr: 1
+				}
+			});
+		});
+		
+		//监听单元格编辑
+		table.on('edit(LAY-artapp-notice-noticelist-table)', function(obj) {
+			var id = obj.data.id,
+				field = obj.field,
+				value = obj.value;
+			admin.req({
+				url: setter.baseAdminUrl + 'notice/fieldBrokerNotice',
+				data: { id: id, field: field, value: value },
+				done: function(res) {
+					layer.msg('修改成功');
+					layui.table.reload('LAY-artapp-notice-noticelist-table');
+				}
+			});
+		});
+
+		//事件
+		var active = {
+			batchdel: function() {
+				var checkStatus = table.checkStatus('LAY-artapp-notice-noticelist-table'),
+					checkData = checkStatus.data; //得到选中的数据
+				if (checkData.length === 0) {
+					return layer.msg('请选择数据');
+				}
+				var idarr = [];
+				for (var i = 0; i < checkData.length; i++) {
+					idarr.push(checkData[i].id);
+				}
+				layer.confirm('确定删除所选通知公告吗?', function(index) {
+					admin.req({
+						url: setter.baseAdminUrl + 'notice/delBrokerNotice',
+						data: {
+							idarr: idarr
+						},
+						done: function(res) {
+							table.reload('LAY-artapp-notice-noticelist-table');
+							layer.msg('已删除');
+						}
+					});
+					layer.close(index);
+				});
+			},
+			add: function() {
+				var index = layer.open({
+					type: 2,
+					title: '添加通知公告',
+					content: 'brokerNoticeForm.html?id=0',
+					maxmin: true,
+					area: ['550px', '550px']
+				});
+				layer.full(index);
+			}
+		};
+
+		//监听工具条
+		table.on('tool(LAY-artapp-notice-noticelist-table)', function(obj) {
+			var data = obj.data;
+			if (obj.event === 'del') {
+				layer.confirm('确定删除此通知公告吗?', function(index) {
+					admin.req({
+						url: setter.baseAdminUrl + 'notice/delBrokerNotice',
+						data: {
+							idarr: [data.id]
+						},
+						done: function(res) {
+							obj.del();
+							layer.msg('已删除');
+						}
+					});
+					layer.close(index);
+				});
+			} else if (obj.event === 'edit') {
+				var index = layer.open({
+					type: 2,
+					title: '编辑通知公告',
+					content: 'brokerNoticeForm.html?id=' + data.id,
+					maxmin: true,
+					area: ['550px', '550px']
+				});
+				layer.full(index);
+			}
+		});
+
+		$('.layui-btn.layuiadmin-btn').on('click', function() {
+			var type = $(this).data('type');
+			active[type] ? active[type].call(this) : '';
+		});
+	});
+</script>

+ 124 - 0
app/admin/view/artapp/notice/brokernoticeform.html

@@ -0,0 +1,124 @@
+<div class="layui-fluid">
+	<div class="layui-row layui-col-space15">
+		<div class="layui-col-md12">
+			<div class="layui-card">
+				<div class="layui-card-header">通知公告信息</div>
+				<div class="layui-card-body" pad15>
+
+
+					<div class="layui-form layui-form-pane" lay-filter="LAY-artapp-notice-noticeform-edit">
+						<input type="hidden" name="id" value="{$notice.id}">
+						<div class="layui-form-item">
+							<label class="layui-form-label"><span style="color:#f90c05;">*</span>标题</label>
+							<div class="layui-input-block">
+								<input type="text" name="title" value="{$notice.title}" lay-verify="required" placeholder="请输入标题" autocomplete="off"
+								 class="layui-input">
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label">详情</label>
+							<div class="layui-input-block">
+								<textarea class="layui-textarea" name="details" id="details" placeholder="请输入详情" style="display: none"
+								 lay-verify="editcontent">
+											{$notice.details}
+										</textarea>
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label"><span style="color:#f90c05;">*</span>发布时间</label>
+							<div class="layui-input-block">
+								<input type="text" name="createtime" id="createtime" value="{$notice.createtime}" lay-verify="required"
+								 placeholder="请选择发布时间" autocomplete="off" class="layui-input">
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label">置顶</label>
+							<div class="layui-input-block">
+								<select name="priority">
+									<option value="0" {$notice.priority===0 ? 'selected' : '' }>不置顶</option>
+									<option value="1" {$notice.priority===1 ? 'selected' : '' }>置顶一</option>
+									<option value="2" {$notice.priority===2 ? 'selected' : '' }>置顶二</option>
+									<option value="3" {$notice.priority===3 ? 'selected' : '' }>置顶三</option>
+									<option value="4" {$notice.priority===4 ? 'selected' : '' }>置顶四</option>
+									<option value="5" {$notice.priority===5 ? 'selected' : '' }>置顶五</option>
+									<option value="6" {$notice.priority===6 ? 'selected' : '' }>置顶六</option>
+									<option value="7" {$notice.priority===7 ? 'selected' : '' }>置顶七</option>
+									<option value="8" {$notice.priority===8 ? 'selected' : '' }>置顶八</option>
+									<option value="9" {$notice.priority===9 ? 'selected' : '' }>置顶九</option>
+								</select>
+								<div class="layui-form-mid layui-word-aux">倒序,值越大越靠前</div>
+							</div>
+						</div>
+						<div class="layui-form-item" pane>
+							<label class="layui-form-label">状态</label>
+							<div class="layui-input-block">
+								<input type="checkbox" lay-filter="switch" name="status" {eq name="notice.status|default=1" value="1" }checked{/eq}
+								 lay-skin="switch" lay-text="已发布|待修改" value="1">
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label">浏览量</label>
+							<div class="layui-input-block">
+								<input type="text" name="volume" value="{$notice.volume|default=0}" lay-verify="required|number" placeholder="请输入浏览量"
+								 autocomplete="off" class="layui-input">
+							</div>
+						</div>
+						<div class="layui-form-item">
+							<div class="layui-input-block">
+								<input type="button" lay-submit lay-filter="LAY-artapp-notice-noticeform-edit-submit" value="确认提交" class="layui-btn">
+							</div>
+						</div>
+					</div>
+
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
+
+<script>
+	layui.config({
+		base: '/static/echoui/' //静态资源所在路径
+	}).extend({
+		index: 'lib/index' //主入口模块
+	}).use(['index', 'form', 'set', 'layedit', 'laydate', 'upload'], function() {
+		var $ = layui.$,
+			setter = layui.setter,
+			admin = layui.admin,
+			layedit = layui.layedit,
+			laydate = layui.laydate,
+			form = layui.form,
+			upload = layui.upload;
+		form.render();
+
+		var details = layedit.build('details', {
+			uploadImage: { url: setter.baseAdminUrl + 'attachment/tplfieldimage', type: 'post' }
+		});
+		form.verify({
+			editcontent: function(value) {
+				layedit.sync(details);
+			}
+		});
+		laydate.render({
+			elem: '#createtime',
+			type: 'datetime'
+		});
+
+		form.on('submit(LAY-artapp-notice-noticeform-edit-submit)', function(obj) {
+			var index = parent.layer.getFrameIndex(window.name);
+			admin.req({
+				url: setter.baseAdminUrl + 'notice/editBrokerNotice',
+				type: 'post',
+				data: obj.field,
+				done: function(res) {
+					layer.msg("提交成功", {
+						icon: 1
+					});
+					parent.layui.table.reload('LAY-artapp-notice-noticelist-table'); //重载表格
+					parent.layer.close(index);
+				}
+			});
+		});
+
+	});
+</script>

+ 57 - 0
app/admin/view/broker/brokerform.html

@@ -1,3 +1,15 @@
+<style type="text/css">
+	.amap-sug-result{
+		z-index:999999999;
+	}
+	#pickerInput{
+		z-index: 999999;
+		position: absolute;
+		right: 30px;
+		top: 20px;
+		width: 200px;
+	}
+</style>
 <div class="layui-fluid">
 	<div class="layui-row layui-col-space15">
 		<div class="layui-col-md12">
@@ -77,6 +89,21 @@
 								<input type="text" name="region" value="{$broker.region}" placeholder="请输入..." autocomplete="off" class="layui-input">
 							</div>
 						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label"><span style="color:#f90c05;">*</span>经纬度</label>
+							<div class="layui-input-inline">
+								<input type="text" name="longitude" value="{$broker.longitude}" lay-verify="required" placeholder="经度"
+									   autocomplete="off" class="layui-input">
+							</div>
+							<div class="layui-input-inline">
+								<input type="text" name="latitude" value="{$broker.latitude}" lay-verify="required" placeholder="纬度"
+									   autocomplete="off" class="layui-input">
+							</div>
+							<div id="maplocation" style="width:500px;height:500px;display: none;">
+								<input id="pickerInput" class="layui-input" placeholder="输入关键字选取地点"/>
+							</div>
+							<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-map-lnglat">选择地理位置</button>
+						</div>
 						<div class="layui-form-item" id="formdetails">
 							<label class="layui-form-label">基本介绍</label>
 							<div class="layui-input-block">
@@ -155,6 +182,36 @@
 				field: { idName: 'name', titleName: 'name', childName: 'child' }
 		});
 
+		var map = new AMap.Map('maplocation', {
+			center:[118.551494,24.781674],//地图中心位置
+			zoom: 12,
+		});
+		$('#layuiadmin-map-lnglat').on('click', function() {
+			var index = layer.open({
+				type: 1,
+				title: '点击获取地址坐标',
+				area: ['500px', '550px'],
+				content: $('#maplocation'),
+				success: function() {
+					//var map = new AMap.Map("maplocation", { resizeEnable: true });
+					map.on('click', function(e) {
+						$('input[name="longitude"]').val(e.lnglat.getLng());
+						$('input[name="latitude"]').val(e.lnglat.getLat());
+						layer.close(index);
+					});
+				}
+			});
+		});
+
+		var auto = new AMap.Autocomplete({ input: "pickerInput" });
+		var placeSearch = new AMap.PlaceSearch({ map: map });
+		window.select = function (e) {
+			console.log(e);
+			placeSearch.setCity(e.poi.adcode);
+			placeSearch.search(e.poi.name);
+		};
+		AMap.event.addListener(auto, "select", select);
+
 		form.on('submit(LAY-broker-brokerform-edit-submit)', function(obj) {
 			var index = parent.layer.getFrameIndex(window.name);
 			admin.req({

+ 9 - 0
app/agent/controller/Broker.php

@@ -53,8 +53,17 @@ class Broker extends BaseController
             'details'     => input('details/s', ""),
             'powerreport' => input('powerreport/d', 0) == 1 ? 1 : 2,
             'status'      => input('status/d') == 1 ? 1 : 2,
+            'latitude'    => input('latitude/f', 0),
+            'longitude'   => input('longitude/f', 0),
         ];
 
+        if (empty($data['latitude']) || empty($data['longitude'])) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => '请选择地理位置',
+            ]));
+        }
+
         //镇街
         $townvillage = input('townvillage');
         if (empty($townvillage)) {

+ 57 - 0
app/agent/view/broker/brokerform.html

@@ -1,3 +1,15 @@
+<style type="text/css">
+	.amap-sug-result{
+		z-index:999999999;
+	}
+	#pickerInput{
+		z-index: 999999;
+		position: absolute;
+		right: 30px;
+		top: 20px;
+		width: 200px;
+	}
+</style>
 <div class="layui-fluid">
 	<div class="layui-row layui-col-space15">
 		<div class="layui-col-md12">
@@ -79,6 +91,21 @@
 								<input type="text" name="region" value="{$broker.region}" placeholder="请输入..." autocomplete="off" class="layui-input">
 							</div>
 						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label"><span style="color:#f90c05;">*</span>经纬度</label>
+							<div class="layui-input-inline">
+								<input type="text" name="longitude" value="{$broker.longitude}" lay-verify="required" placeholder="经度"
+									   autocomplete="off" class="layui-input">
+							</div>
+							<div class="layui-input-inline">
+								<input type="text" name="latitude" value="{$broker.latitude}" lay-verify="required" placeholder="纬度"
+									   autocomplete="off" class="layui-input">
+							</div>
+							<div id="maplocation" style="width:500px;height:500px;display: none;">
+								<input id="pickerInput" class="layui-input" placeholder="输入关键字选取地点"/>
+							</div>
+							<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-map-lnglat">选择地理位置</button>
+						</div>
 						<div class="layui-form-item" id="formdetails">
 							<label class="layui-form-label">基本介绍</label>
 							<div class="layui-input-block">
@@ -148,6 +175,36 @@
 			field: { idName: 'name', titleName: 'name', childName: 'child' }
 		});
 
+		var map = new AMap.Map('maplocation', {
+			center:[118.551494,24.781674],//地图中心位置
+			zoom: 12,
+		});
+		$('#layuiadmin-map-lnglat').on('click', function() {
+			var index = layer.open({
+				type: 1,
+				title: '点击获取地址坐标',
+				area: ['500px', '550px'],
+				content: $('#maplocation'),
+				success: function() {
+					//var map = new AMap.Map("maplocation", { resizeEnable: true });
+					map.on('click', function(e) {
+						$('input[name="longitude"]').val(e.lnglat.getLng());
+						$('input[name="latitude"]').val(e.lnglat.getLat());
+						layer.close(index);
+					});
+				}
+			});
+		});
+
+		var auto = new AMap.Autocomplete({ input: "pickerInput" });
+		var placeSearch = new AMap.PlaceSearch({ map: map });
+		window.select = function (e) {
+			console.log(e);
+			placeSearch.setCity(e.poi.adcode);
+			placeSearch.search(e.poi.name);
+		};
+		AMap.event.addListener(auto, "select", select);
+
 		form.on('submit(LAY-broker-brokerform-edit-submit)', function(obj) {
 			var index = parent.layer.getFrameIndex(window.name);
 			admin.req({

+ 4 - 2
app/common/model/Broker.php

@@ -25,8 +25,8 @@ class Broker extends Model
         'province' => 'string',
         'city'     => 'string',
         'district' => 'string',
-        'town'       => 'string',
-        'village'    => 'string',
+        'town'     => 'string',
+        'village'  => 'string',
         'details'  => 'string',
 
         'status'       => 'tinyint',
@@ -35,6 +35,8 @@ class Broker extends Model
         'income'       => 'decimal',
         'income_total' => 'decimal',
         'region'       => 'string',
+        'latitude'     => 'float',
+        'longitude'    => 'float',
     ];
 
     // 设置字段自动转换类型

+ 36 - 0
app/common/model/BrokerNotice.php

@@ -0,0 +1,36 @@
+<?php
+namespace app\common\model;
+
+use think\Model;
+
+class BrokerNotice extends Model
+{
+	// 设置字段信息
+    protected $schema = [
+        'id'			=> 'int',
+		'title'			=> 'string',
+		'details'		=> 'string',
+		'priority'		=> 'int',
+        'createtime'	=> 'int',
+        'status'		=> 'tinyint',
+        'volume'		=> 'int'
+    ];
+	
+	// 设置字段自动转换类型
+	protected $type = [
+        'createtime'  => 'timestamp:Y-m-d H:i:s'
+    ];
+	
+	public function getStatusTextAttr($value,$data)
+	{
+		$status = [1=>'已发布',2=>'待修改'];
+		return $status[$data['status']];
+	}
+	
+	public function getCreatetimeTextAttr($value,$data)
+	{
+		return date('Y-m-d H:i', $data['createtime']);
+	}
+	
+	
+}

+ 3 - 3
app/mainapp/controller/Broker.php

@@ -34,9 +34,9 @@ class Broker extends BaseController
         if (!empty($searchval)) {
             $map[] = ['title|region', 'like', '%' . $searchval . '%'];
         }
-        $district = input('district/s', "");
-        if (!empty($district)) {
-            $map[] = ['district', '=', $district];
+        $town = input('town/s', "");
+        if (!empty($town)) {
+            $map[] = ['town', '=', $town];
         }
         $plist = BrokerModel::with(['muser'])->where($map)->order(['id' => 'desc'])->page($ppage)->limit($psize)->select();
         page_result(0, "", [

+ 13 - 1
app/mainapp/controller/Index.php

@@ -4,7 +4,6 @@ namespace app\mainapp\controller;
 
 use app\common\model\Config;
 use app\common\model\RensheCode;
-use app\common\model\Village;
 use app\common\model\WorkerThird;
 use app\common\service\RensheService;
 use app\mainapp\BaseController;
@@ -220,6 +219,12 @@ class Index extends BaseController
         page_result(0, "", $post);
     }
 
+    public function getAgent()
+    {
+        $agent = AgentModel::field('id,workerid,title')->where('status',1)->select();
+        page_result(0,'',$agent);
+    }
+
     public function getWorker()
     {
         $workerids = AgentModel::field('workerid')->where('status',1)->distinct(true)->select()->column('workerid');
@@ -245,4 +250,11 @@ class Index extends BaseController
         $town = file_get_contents(root_path('public/static/jscss').'town.json');
         page_result(0,'',json_decode($town,true));
     }
+
+    public function getStreet()
+    {
+        $town = file_get_contents(root_path('public/static/jscss').'town.json');
+        $street = json_decode($town,true)['town'];
+        page_result(0,'',$street);
+    }
 }

+ 27 - 1
app/mainapp/controller/Notice.php

@@ -1,10 +1,10 @@
 <?php
 namespace app\mainapp\controller;
 
-use think\facade\Session;
 use app\mainapp\BaseController;
 use app\common\model\Notice as NoticeModel;
 use app\common\model\NoticeCate as NoticeCateModel;
+use app\common\model\BrokerNotice as BrokerNoticeModel;
 
 class Notice extends BaseController
 {
@@ -50,5 +50,31 @@ class Notice extends BaseController
 		page_result(0, "", array('allcate'=>$allcate));
 	}
 
+    // 列表
+    public function listBrokerNotice()
+    {
+        $ppage = input('ppage/d', 1);
+        $psize = input('psize/d', 20);
+        $map[] = ['status','=',1];
+        $map[] = ['createtime','<=',time()];
+        $plist = BrokerNoticeModel::where($map)->order(['priority'=>'desc','id'=>'desc'])->page($ppage)->limit($psize)->append(['createtime_text'])->select();
+        page_result(0, "", array(
+            'plist' => $plist,
+            'pstatus' => $psize > count($plist) ? 'noMore' : 'more'
+        ));
+    }
 
+    public function brokerNoticeDetail()
+    {
+        $noticeid = input('noticeid/d', 0);
+        $notice = BrokerNoticeModel::findOrEmpty($noticeid);
+        if ($notice->isEmpty()){
+            page_result(1, "通知公告信息不存在");
+        }
+        $notice->volume += 1;
+        $notice->save();
+        page_result(0, "", array(
+            'notice' => $notice
+        ));
+    }
 }

+ 9 - 0
app/worker/controller/Broker.php

@@ -55,8 +55,17 @@ class Broker extends BaseController
             'details'     => input('details/s', ""),
             'powerreport' => input('powerreport/d', 0) == 1 ? 1 : 2,
             'status'      => input('status/d', 0) == 1 ? 1 : 2,
+            'latitude'    => input('latitude/f', 0),
+            'longitude'   => input('longitude/f', 0),
         ];
 
+        if (empty($data['latitude']) || empty($data['longitude'])) {
+            exit(json_encode([
+                'code' => 1,
+                'msg'  => '请选择地理位置',
+            ]));
+        }
+
         //镇街
         $townvillage = input('townvillage');
         if (empty($townvillage)) {

+ 57 - 0
app/worker/view/broker/brokerform.html

@@ -1,3 +1,15 @@
+<style type="text/css">
+	.amap-sug-result{
+		z-index:999999999;
+	}
+	#pickerInput{
+		z-index: 999999;
+		position: absolute;
+		right: 30px;
+		top: 20px;
+		width: 200px;
+	}
+</style>
 <div class="layui-fluid">
 	<div class="layui-row layui-col-space15">
 		<div class="layui-col-md12">
@@ -91,6 +103,21 @@
 								<input type="text" name="region" value="{$broker.region}" placeholder="请输入..." autocomplete="off" class="layui-input">
 							</div>
 						</div>
+						<div class="layui-form-item">
+							<label class="layui-form-label"><span style="color:#f90c05;">*</span>经纬度</label>
+							<div class="layui-input-inline">
+								<input type="text" name="longitude" value="{$broker.longitude}" lay-verify="required" placeholder="经度"
+									   autocomplete="off" class="layui-input">
+							</div>
+							<div class="layui-input-inline">
+								<input type="text" name="latitude" value="{$broker.latitude}" lay-verify="required" placeholder="纬度"
+									   autocomplete="off" class="layui-input">
+							</div>
+							<div id="maplocation" style="width:500px;height:500px;display: none;">
+								<input id="pickerInput" class="layui-input" placeholder="输入关键字选取地点"/>
+							</div>
+							<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-map-lnglat">选择地理位置</button>
+						</div>
 						<div class="layui-form-item" id="formdetails">
 							<label class="layui-form-label">基本介绍</label>
 							<div class="layui-input-block">
@@ -159,6 +186,36 @@
 			field: { idName: 'name', titleName: 'name', childName: 'child' }
 		});
 
+		var map = new AMap.Map('maplocation', {
+			center:[118.551494,24.781674],//地图中心位置
+			zoom: 12,
+		});
+		$('#layuiadmin-map-lnglat').on('click', function() {
+			var index = layer.open({
+				type: 1,
+				title: '点击获取地址坐标',
+				area: ['500px', '550px'],
+				content: $('#maplocation'),
+				success: function() {
+					//var map = new AMap.Map("maplocation", { resizeEnable: true });
+					map.on('click', function(e) {
+						$('input[name="longitude"]').val(e.lnglat.getLng());
+						$('input[name="latitude"]').val(e.lnglat.getLat());
+						layer.close(index);
+					});
+				}
+			});
+		});
+
+		var auto = new AMap.Autocomplete({ input: "pickerInput" });
+		var placeSearch = new AMap.PlaceSearch({ map: map });
+		window.select = function (e) {
+			console.log(e);
+			placeSearch.setCity(e.poi.adcode);
+			placeSearch.search(e.poi.name);
+		};
+		AMap.event.addListener(auto, "select", select);
+
 		form.on('submit(LAY-broker-brokerform-edit-submit)', function(obj) {
 			var index = parent.layer.getFrameIndex(window.name);
 			admin.req({