diff --git a/app/admin/controller/nk/Street.php b/app/admin/controller/nk/Street.php new file mode 100644 index 0000000..f0330c0 --- /dev/null +++ b/app/admin/controller/nk/Street.php @@ -0,0 +1,163 @@ +adminInfo = get_login_admin(); + $this->url=[ + '/admin/nk.street/index', + '/admin/nk.street/add', + '/admin/nk.street/edit', + '/admin/nk.street/del', + '/admin/nk.street/read', + ]; + } + /** + * 查看 + */ + public function index() + { + if (request()->isAjax()) { + $params= get_params(); + $where[]=['status','=',1]; + $where[]=['village_id','=','']; + if (isset($params['keywords'])){ + $where[]=['title','like','%'.$params['keywords'].'%']; + } + $total = Db::table('fa_szxc_village') + ->where($where)->count(); + $list = Db::table('fa_szxc_village') + ->withAttr('is_hot',function ($value,$data){ + return $value==1?'是':'否'; + }) + ->withAttr('is_tourism',function ($value,$data){ + return $value==1?'是':'否'; + }) + ->where($where) + ->page($params['page']) + ->limit($params['limit']) + ->order('id desc') + ->select(); + $result = ['total' => $total, 'data' => $list]; + return table_assign(0, '', $result); + } + View::assign('url', $this->url); + return view(); + } + /** + * 添加 + */ + public function add() + { + if (request()->isAjax()) { + $params= get_params(); + if (!empty($params['is_hot'])&&$params['is_hot']=='on'){ + $params['is_hot']=1; + }else{ + $params['is_hot']=0; + } + if (!empty($params['is_tourism'])&&$params['is_tourism']=='on'){ + $params['is_tourism']=1; + }else{ + $params['is_tourism']=0; + } + $area_code=Db::table('fa_geo_area')->where('area_code',$params['area_id'])->value('area_name'); + $street_code=Db::table('fa_geo_street')->where('street_code',$params['street_id'])->value('street_name'); + $village_id=Db::table('fa_geo_village')->where('village_id',$params['village_id'])->value('village_name'); + $params['address']='泸州市'.$area_code.$street_code.$village_id; + $params['createtime']=time(); + $res=Db::table('fa_szxc_village')->strict(false)->field(true)->insertGetId($params); + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + return to_assign(1, '操作失败,原因:'.$res); + } + + $street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500']) + ->field('area_id id,area_code code,area_name name') + ->select(); + View::assign('street', $street); + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view(); + } + /** + * 修改 + */ + public function edit() + { + $params= get_params(); + if (request()->isAjax()) { + if (!empty($params['is_hot'])&&$params['is_hot']=='on'){ + $params['is_hot']=1; + }else{ + $params['is_hot']=0; + } + if (!empty($params['is_tourism'])&&$params['is_tourism']=='on'){ + $params['is_tourism']=1; + }else{ + $params['is_tourism']=0; + } + $area_code=Db::table('fa_geo_area')->where('area_code',$params['area_id'])->value('area_name'); + $street_code=Db::table('fa_geo_street')->where('street_code',$params['street_id'])->value('street_name'); + $village_id=Db::table('fa_geo_village')->where('village_id',$params['village_id'])->value('village_name'); + $params['address']='泸州市'.$area_code.$street_code.$village_id; + $res=Db::table('fa_szxc_village')->where('id',$params['id'])->strict(false)->field(true)->update($params); + if ($res){ + return to_assign(); + }else{ + return to_assign(1, '操作失败,原因:'.$res); + } + } + $detail = Db::table('fa_szxc_village')->where('id',$params['id'])->find(); + $street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500']) + ->field('area_id id,area_code code,area_name name') + ->select(); + View::assign('street', $street); + View::assign('detail', $detail); + View::assign('url', $this->url); + return view(); + } + /** + * 查看信息 + */ + public function read() + { + $params = get_params(); + $detail = Db::table('fa_szxc_village')->where('id',$params['id'])->find(); + View::assign('url', $this->url); + View::assign('detail', $detail); + return view(); + + } + /** + * 修改 + */ + public function del() + { + $param= get_params(); + $id = isset($param['id']) ? $param['id'] : 0; + $type = isset($param['type']) ? $param['type'] : 0; + $res = Db::table('fa_szxc_village')->where('id',$id)->update(['status'=>$type]); + if ($res){ + return to_assign(); + }else{ + return to_assign(1, '操作失败,原因:'.$res); + } + } +} \ No newline at end of file diff --git a/app/admin/controller/nk/Village.php b/app/admin/controller/nk/Village.php index c490fa4..46bdbda 100644 --- a/app/admin/controller/nk/Village.php +++ b/app/admin/controller/nk/Village.php @@ -35,6 +35,7 @@ class Village extends BaseController if (request()->isAjax()) { $params= get_params(); $where[]=['status','=',1]; + $where[]=['village_id','<>','']; if (isset($params['keywords'])){ $where[]=['title','like','%'.$params['keywords'].'%']; } diff --git a/app/admin/view/nk/street/add.html b/app/admin/view/nk/street/add.html new file mode 100644 index 0000000..9ad1bbd --- /dev/null +++ b/app/admin/view/nk/street/add.html @@ -0,0 +1,192 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加内容

+ + + + + + + + + + + + + + + + + + + {if {:session('gougu_admin')['group_access']==1} + + + + + {/if} + + + + + + + +
标题*
人数* + 标签(多选)* + + +
简介 + + 缩略图 +
+ +
+ + +
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+
+
文章内容
+ +
+
+ + +
+
+{/block} + + + +{block name="script"} + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/nk/street/edit.html b/app/admin/view/nk/street/edit.html new file mode 100644 index 0000000..6d5a74d --- /dev/null +++ b/app/admin/view/nk/street/edit.html @@ -0,0 +1,210 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

编辑文章表

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
标题*
人数* + 标签(多选)* + + +
简介 + + 缩略图 +
+ +
+ + +
+
+
+
+ +
+ {if {:session('gougu_admin')['group_access']==1} + + {else /} + {volist name='street' id='vo'} + {if $address.area_id==$vo.code} + + {/if} + {/volist} + {/if} +
+
+
+
+ +
+
+
+
+
文章内容
+ +
+
+ + + +
+
+{/block} + + + +{block name="script"} + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/nk/street/index.html b/app/admin/view/nk/street/index.html new file mode 100644 index 0000000..5179344 --- /dev/null +++ b/app/admin/view/nk/street/index.html @@ -0,0 +1,152 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/nk/street/read.html b/app/admin/view/nk/street/read.html new file mode 100644 index 0000000..7054e71 --- /dev/null +++ b/app/admin/view/nk/street/read.html @@ -0,0 +1,55 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

文章详情

+ + + + + + + + + + + + + + + + + + + + + + + + + +
标题*{$detail.title}
人数*{$detail.people_num}标签(多选)* + + +
简介 + {$detail.info} + 缩略图 +
+ +
+ +
+
+
文章内容
+ {$detail.introduce|raw} +
+
+{/block} + \ No newline at end of file diff --git a/app/admin/view/nk/village/add.html b/app/admin/view/nk/village/add.html index 927e862..02fbd11 100644 --- a/app/admin/view/nk/village/add.html +++ b/app/admin/view/nk/village/add.html @@ -55,7 +55,7 @@ {if {:session('gougu_admin')['group_access']==1} - +
@@ -67,7 +67,7 @@
- +
@@ -75,7 +75,7 @@
- +
diff --git a/app/admin/view/nk/village/edit.html b/app/admin/view/nk/village/edit.html index 4dc6be0..10cd56c 100644 --- a/app/admin/view/nk/village/edit.html +++ b/app/admin/view/nk/village/edit.html @@ -54,7 +54,7 @@ - +
@@ -74,7 +74,7 @@
- +
@@ -82,7 +82,7 @@
- +
diff --git a/app/admin/view/nk/village/read.html b/app/admin/view/nk/village/read.html index 236e453..7054e71 100644 --- a/app/admin/view/nk/village/read.html +++ b/app/admin/view/nk/village/read.html @@ -20,7 +20,7 @@ 标签(多选)* - +