diff --git a/app/admin/controller/nk/Community.php b/app/admin/controller/nk/Community.php new file mode 100644 index 0000000..6f4b190 --- /dev/null +++ b/app/admin/controller/nk/Community.php @@ -0,0 +1,121 @@ +adminInfo = get_login_admin(); + $this->url=[ + '/admin/nk.community/index', + '/admin/nk.community/add', + '/admin/nk.community/edit', + '/admin/nk.community/del', + '/admin/nk.community/read', + ]; + } + /** + * 数据列表 + */ + public function index() + { + if (request()->isAjax()) { + $params= get_params(); + $where['status']=1; + $where = []; + if (isset($params['keywords'])){ +// $where[]=['title','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if ($user_address['auth_range'] == 2){ + $where['street_id'] = $user_address['street_id']; + }elseif ($user_address['auth_range'] == 3){ + $where['area_id'] = $user_address['area_id']; + }else{ + $where['village_id'] = $user_address['village_id']; + } + }else{ + $where['village_id'] = ''; + } + } + + $total = Db::connect('shop')->name('community_address') + ->where($where) + ->count(); + if ($total!=0){ + $list = Db::connect('shop')->name('community_address') + ->where($where) + ->page($params['page']) + ->limit($params['limit']) + ->select(); + $arr=[]; + foreach ($list as $k=>$v){ + $arr[]=$v['community_id']; + } + $list2=Db::connect('shop')->name('community')->where('community_id','in',$arr)->select(); + }else{ + $list2=[]; + } + + $result = ['total' => $total, 'data' => $list2]; + return table_assign(0, '', $result); + } + else{ + return view('nk/community/index',['url'=>$this->url]); + } + } + + + /** + * 查看信息 + */ + public function read() + { + $param= get_params(); + $id = isset($param['id']) ? $param['id'] : 0; + $detail = Db::connect('shop')->name('community')->where('community_id',$id)->find(); + if (!empty($detail)) { + View::assign('detail', $detail); + return view(); + } + else{ + throw new \think\exception\HttpException(404, '找不到页面'); + } + } + /** + * 删除 + */ + public function del() + { + $param= get_params(); + $id = isset($param['id']) ? $param['id'] : 0; + $res = Db::connect('shop')->name('community')->where('community_id',$id)->delete(); + Db::connect('shop')->name('community_address')->where('community_id',$id)->delete(); + if ($res){ + return to_assign(); + }else{ + return to_assign(1, '操作失败,原因:'.$res); + } + } + + +} diff --git a/app/admin/controller/nk/Merchant.php b/app/admin/controller/nk/Merchant.php new file mode 100644 index 0000000..7d076b6 --- /dev/null +++ b/app/admin/controller/nk/Merchant.php @@ -0,0 +1,67 @@ +adminInfo = get_login_admin(); + $this->url=[ + '/admin/nk.merchant/index', + ]; + } + /** + * 查看 + */ + public function index() + { + $total=0; + $list=[]; + $brokerage_price=0; + $find=Db::table('fa_szxc_information_useraddress')->where('user_id',$this->adminInfo['id'])->value('street_id'); + if (request()->isAjax()) { + $params= get_params(); + if ($find!=0){ + $total=Db::connect('shop')->name('merchant_address')->where('street_id',$find) + ->where('status',1)->count(); + $merchant_id=Db::connect('shop')->name('merchant_address')->where('street_id',$find) + ->where('status',1) + ->page($params['page']) + ->limit($params['limit']) + ->field('mer_id')->select(); + $arr=[]; + foreach ($merchant_id as $k=>$v){ + $arr[]=$v['mer_id']; + } + $list=Db::connect('shop')->name('merchant')->where('mer_id','in',$arr)->select(); + } + $result = ['total' => $total, 'data' => $list]; + return table_assign(0, '', $result); + } + View::assign('brokerage_price', $brokerage_price); + + return view('',['url'=>$this->url]); + } + /** + * 查看信息 + */ + public function read() + { + $params = get_params(); + + return view('',['url'=>$this->url]); + + } + +} \ No newline at end of file diff --git a/app/admin/controller/nk/RegionCommission.php b/app/admin/controller/nk/RegionCommission.php new file mode 100644 index 0000000..0f68b6f --- /dev/null +++ b/app/admin/controller/nk/RegionCommission.php @@ -0,0 +1,62 @@ +adminInfo = get_login_admin(); + $this->url=[ + '/admin/nk.regioncommission/index', + ]; + } + /** + * 查看 + */ + public function index() + { + $total=0; + $list=[]; + $brokerage_price=0; + $find=Db::table('fa_szxc_information_useraddress')->where('user_id',$this->adminInfo['id'])->value('street_id'); + if ($find!=0) { + $brokerage_price=Db::connect('shop')->name('store_order_region_commission')->where('street_id',$find)->sum('commission_rate'); + } + if (request()->isAjax()) { + $params= get_params(); + if ($find!=0){ + $list=Db::connect('shop')->name('store_order_region_commission')->where('street_id',$find) + ->page($params['page']) + ->limit($params['limit']) + ->select(); + } + $result = ['total' => $total, 'data' => $list]; + return table_assign(0, '', $result); + } + View::assign('brokerage_price', $brokerage_price); + + return view('',['url'=>$this->url]); + } + /** + * 查看信息 + */ + public function read() + { + $params = get_params(); + + return view('',['url'=>$this->url]); + + } + +} \ No newline at end of file diff --git a/app/admin/controller/nk/RuralWelfare.php b/app/admin/controller/nk/RuralWelfare.php new file mode 100644 index 0000000..711ab66 --- /dev/null +++ b/app/admin/controller/nk/RuralWelfare.php @@ -0,0 +1,83 @@ +adminInfo = get_login_admin(); + $this->category_id=352; + $this->url=[ + '/admin/nk.ruralwelfare/index?category_id='.$this->category_id, + '/admin/nk.ruralwelfare/add', + '/admin/nk.ruralwelfare/edit', + '/admin/nk.ruralwelfare/del', + '/admin/nk.ruralwelfare/read', + ]; + } + /** + * 查看 + */ + public function index() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id']=$this->category_id; + (new Article())->index($params); + } + return view('nk/article/index',['url'=>$this->url]); + } + /** + * 添加 + */ + public function add() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id']=$this->category_id; + (new Article())->add($params); + }else{ + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view('nk/article/add'); + } + } + /** + * 修改 + */ + public function edit() + { + $params= get_params(); + (new Article())->edit($params); + return view('nk/article/edit',['url'=>$this->url]); + } + /** + * 查看信息 + */ + public function read() + { + $params = get_params(); + (new Article())->read($params); + + return view('nk/article/read',['url'=>$this->url]); + + } + /** + * 修改 + */ + public function del() + { + $params= get_params(); + (new Article())->del($params); + } +} \ No newline at end of file diff --git a/app/admin/controller/nk/Spread.php b/app/admin/controller/nk/Spread.php new file mode 100644 index 0000000..3dd4c33 --- /dev/null +++ b/app/admin/controller/nk/Spread.php @@ -0,0 +1,65 @@ +adminInfo = get_login_admin(); + $this->category_id=309; + $this->url=[ + '/admin/nk.spread/index', + '/admin/nk.spread/read', + ]; + } + /** + * 查看 + */ + public function index() + { + $nk_user=Db::connect('shop')->name('nk_user')->where('n_user_id',$this->adminInfo['id'])->value('user_id'); + $total=0; + $list=[]; + $brokerage_price=Db::connect('shop')->name('user')->where('uid',$nk_user)->value('brokerage_price'); + + if (request()->isAjax()) { + $params= get_params(); + if ($nk_user!=0){ + $list=Db::connect('shop')->name('store_order')->where('spread_uid',$nk_user) + ->where('status',3) + ->field('uid,order_sn,pay_time,extension_one,extension_two,is_selfbuy') + ->page($params['page']) + ->limit($params['limit']) + ->select(); + } + $result = ['total' => $total, 'data' => $list]; + return table_assign(0, '', $result); + } + View::assign('brokerage_price', $brokerage_price); + return view('',['url'=>$this->url]); + } + /** + * 查看信息 + */ + public function read() + { + $params = get_params(); + + return view('',['url'=>$this->url]); + + } + +} \ No newline at end of file diff --git a/app/admin/view/nk/community/index.html b/app/admin/view/nk/community/index.html new file mode 100644 index 0000000..2b9c2e6 --- /dev/null +++ b/app/admin/view/nk/community/index.html @@ -0,0 +1,122 @@ +{extend name="common/base"/} + +{block name="body"} + +
标题* | +{$detail.title} | +||||||
内容 | +|||||||
+ {$detail.content|raw} + | +