diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 9b68589..ea75c50 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -44,30 +44,36 @@ class Index extends BaseController public function main() { + $street_id=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->value('street_id'); + $street_name=Db::table('fa_geo_street')->where('street_code',$street_id)->value('street_name'); if ($this->adminInfo['group_access']==4){ - $street_id=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->value('street_id'); - return << - 跳转大屏 - - - - -EOT; + $urls="http://zhen.lihaink.cn/#/?street_id=$street_id"."&street_name=".$street_name; + View::assign('urls',$urls); + return View('main3'); + }elseif($this->adminInfo['group_access']==5){ + $day_price=Db::connect('shop')->table('eb_product_order_log')->where('street_id',$street_id) + ->where('status',1) + ->whereDay('create_time') + ->sum('product_price'); + $day_order=Db::connect('shop')->table('eb_product_order_log')->where('street_id',$street_id) + ->where('status',1) + ->whereDay('create_time') + ->count(); + $Month_price=Db::connect('shop')->table('eb_product_order_log')->where('street_id',$street_id) + ->where('status',1) + ->whereMonth('create_time') + ->sum('product_price'); + $Month_order=Db::connect('shop')->table('eb_product_order_log')->where('street_id',$street_id) + ->where('status',1) + ->whereMonth('create_time') + ->count(); + $urls="http://zhenqiye.lihaink.cn/#/?street_id=$street_id"."&street_name=".$street_name; + View::assign('urls',$urls); + View::assign('day_order',$day_order); + View::assign('day_price',$day_price); + View::assign('month_price',$Month_price); + View::assign('month_order',$Month_order); + return View('main2'); } if ($this->adminInfo['id']!=1){ $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->adminInfo['user_id'])->find(); diff --git a/app/admin/controller/nk/Article.php b/app/admin/controller/nk/Article.php index f3f85fb..dffa5ff 100644 --- a/app/admin/controller/nk/Article.php +++ b/app/admin/controller/nk/Article.php @@ -44,7 +44,7 @@ class Article extends BaseController $category_id =$params['category_id']; if($category_id){ - $map[] = ['category_id','=',$category_id]; + $map[] = ['category_id','in',$category_id]; }else{ $map = []; } diff --git a/app/admin/controller/nk/Life.php b/app/admin/controller/nk/Life.php new file mode 100644 index 0000000..cae5962 --- /dev/null +++ b/app/admin/controller/nk/Life.php @@ -0,0 +1,232 @@ +adminInfo = get_login_admin(); + $this->category_id=360; + $this->url=[ + '/admin/nk.life/index?category_id='.$this->category_id, + '/admin/nk.life/add', + '/admin/nk.life/edit', + '/admin/nk.life/del', + '/admin/nk.life/read', + ]; + } + /** + * 查看 + */ + public function index() + { + if (request()->isAjax()) { + $params= get_params(); + $params['category_id'] = Db::table('fa_category')->where(['status' => 'normal', 'pid' => '360'])->column('id'); + (new Article())->index($params); + } + return view('nk/life/index',['url'=>$this->url]); + } + /** + * 添加 + */ + public function add() + { + if (request()->isAjax()) { + $param= get_params(); + + // 检验完整性 + try { + validate(\app\admin\validate\nk\ArticleValidate::class)->check($param); + } catch (ValidateException $e) { + // 验证失败 输出错误信息 + return to_assign(1, $e->getError()); + } + $adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find(); + if($this->adminInfo['position_id'] != 1) { //不是超级管理员 + $param['county']=$adds['area_id']; + $param['township']=$adds['street_id']; + $param['village']=$adds['village_id']; + $param['user_id']=$adds['user_id']; + }else{ + if(empty($param['county'])){ + $param['county']=$adds['area_id']; + } + if(empty($param['township'])){ + $param['township']=$adds['street_id']; + } + if(empty($param['village'])){ + $param['village']=$adds['village_id']; + } + if(empty($param['user_id'])){ + $param['user_id']=$adds['user_id']; + } + } + + $param['view_time']=date('Y-m-d H:i:s'); + if(empty($param['category_type'])){ + $param['category_type'] = 0; + } + if(empty($param['end_time'])){ + $param['end_time'] = date('Y-m-d H:i:s'); + } + + $res=Db::table('fa_article')->strict(false)->field(true)->insertGetId($param); + if ($res){ + if(!empty($param['is_vote']) && $param['is_vote']==1){ + $data=['start_time'=>date('Y-m-d H:i:s'),'end_time'=>$param['end_time'],'article_id'=>$res,'county'=>$adds['area_id'],'township'=>$adds['street_id'],'village'=>$adds['village_id']]; + Db::table('fa_article_vote_side_tables')->insert($data); + } +// 写入关联表 + $life_data['article_id'] = $res; + $life_data['price'] = $param['price']; + $life_data['star'] = rtrim($param['star'],'星'); + $life_data['lat'] = $param['lat']; + $life_data['lng'] = $param['lng']; + Db::table('fa_article_life')->strict(false)->field(true)->insert($life_data); + return to_assign(0,'操作成功',['aid'=>$res]); + } + return to_assign(1, '操作失败,原因:'.$res); +// (new Article())->add($params); + }else{ + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + // 获取用户信息 + $this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select(); + View::assign('users', $this->users); + $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); +// 分类 + $category = Db::table('fa_category')->where(['status' => 'normal', 'pid' => '360'])->select(); + View::assign('category', $category); + return view('nk/life/add'); + } + } + /** + * 修改 + */ + public function edit(){ + $param= get_params(); + if (request()->isAjax()) { + try { + validate(\app\admin\validate\nk\ArticleValidate::class)->check($param); + } catch (ValidateException $e) { + // 验证失败 输出错误信息 + return to_assign(1, $e->getError()); + } + + $adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find(); + if($this->adminInfo['position_id'] == 1) { //是超级管理员 + if(empty($param['county'])){ + $param['county']=$adds['area_id']; + } + if(empty($param['township'])){ + $param['township']=$adds['street_id']; + } + if(empty($param['village'])){ + $param['village']=$adds['village_id']; + } + if(empty($param['user_id'])){ + $param['user_id']=$adds['user_id']; + } + } + + $res=Db::table('fa_article')->where('id',$param['id'])->strict(false)->field(true)->update($param); + + if(!empty($param['is_vote']) && $param['is_vote']==1){ + Db::table('fa_article_vote_side_tables')->where('article_id',$param['id'])->update(['end_time'=>$param['end_time']]); + } + // 写入关联表 + $life_data['price'] = $param['price']; + $life_data['star'] = rtrim($param['star'],'星'); + $life_data['lat'] = $param['lat']; + $life_data['lng'] = $param['lng']; + Db::table('fa_article_life')->where('article_id',$param['id'])->update($life_data); + return to_assign(); + + }else{ + $id = isset($param['id']) ? $param['id'] : 0; + $detail = Db::table('fa_article')->where('id',$id)->find(); + View::assign('editor', get_system_config('other','editor')); + if (!empty($detail)) { + $ress = Db::table('fa_article_life')->where('article_id',$param['id'])->find(); + $detail['price'] = $ress['price']; + $detail['star'] = $ress['star']; + $detail['lat'] = $ress['lat']; + $detail['lng'] = $ress['lng']; + View::assign('detail', $detail); + // 获取用户信息 + $this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select(); + View::assign('users', $this->users); + $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); + // 分类 + $category = Db::table('fa_category')->where(['status' => 'normal', 'pid' => '360'])->select(); + View::assign('category', $category); + return view('nk/life/edit',['url'=>$this->url]); + } + else{ + throw new \think\exception\HttpException(404, '找不到页面'); + } + } + } + + + /** + * 查看信息 + */ + public function read() + { + $param = get_params(); + $id = isset($param['id']) ? $param['id'] : 0; + $detail = Db::table('fa_article')->where('id',$id)->find(); + if (!empty($detail)) { + $detail['comment'] = Db::table('fa_article_comment') + ->where('vote_id',$id) + ->withAttr('user_info',function ($value,$data){ + return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('name'); + }) + ->select(); + $ress = Db::table('fa_article_life')->where('article_id',$param['id'])->find(); + $detail['price'] = $ress['price']; + $detail['star'] = $ress['star']; + $detail['lat'] = $ress['lat']; + $detail['lng'] = $ress['lng']; + View::assign('detail', $detail); + // 分类 + $category = Db::table('fa_category')->where(['status' => 'normal', 'pid' => '360'])->select(); + View::assign('category', $category); + View::assign('admin_id', $this->adminInfo['id']); + } + else{ + throw new \think\exception\HttpException(404, '找不到页面'); + } + return view('nk/life/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/Regioncommission.php b/app/admin/controller/nk/Regioncommission.php new file mode 100644 index 0000000..4c128af --- /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/model/StoreProduct.php b/app/admin/model/StoreProduct.php index 0cbd642..1d6243b 100644 --- a/app/admin/model/StoreProduct.php +++ b/app/admin/model/StoreProduct.php @@ -18,7 +18,7 @@ class StoreProduct extends Model { $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit']; $order = empty($param['order']) ? 'product_id desc' : $param['order']; - $list = self::where($where)->field('product_id,mer_id,store_name,store_info,keyword,brand_id,cate_id,unit_name,sort,sales,price,cost,ot_price,stock,is_hot,is_benefit,temp_id,spec_type,image,slider_image,once_max_count,once_min_count,integral_rate,integral_total,integral_price_total,labels,delivery_free,type,extend,pay_limit,svip_price_type,svip_price,mer_svip_status,param_temp_id')->order($order)->paginate($rows, false, ['query' => $param]); + $list = self::where($where)->order($order)->paginate($rows, false, ['query' => $param]); return $list; } diff --git a/app/admin/view/index/main2.html b/app/admin/view/index/main2.html new file mode 100644 index 0000000..2302dfd --- /dev/null +++ b/app/admin/view/index/main2.html @@ -0,0 +1,104 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+
+
+
+
今日订单金额
+
+
{$day_price}
+ + + + + + + +
+
+
+
+
+
今日订单数
+
+
{$day_order}
+
+
+
+
+
+
当月订单金额
+
+
{$month_price}
+
+
+
+
+
+
当月订单数
+
+
{$month_order}
+
+
+
+
+ + + +
+{/block} + + + +{block name="script"} + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/index/main3.html b/app/admin/view/index/main3.html new file mode 100644 index 0000000..9fdc189 --- /dev/null +++ b/app/admin/view/index/main3.html @@ -0,0 +1,63 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} + + +
+ 跳转大屏
+ + +{/block} + + + +{block name="script"} + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/nk/life/add.html b/app/admin/view/nk/life/add.html new file mode 100644 index 0000000..1a6c391 --- /dev/null +++ b/app/admin/view/nk/life/add.html @@ -0,0 +1,310 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

新建文章

+ + + + + + {notempty name="is_vote"} + + + + + {/notempty} + + + + + + + + {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/life/edit.html b/app/admin/view/nk/life/edit.html new file mode 100644 index 0000000..b21936b --- /dev/null +++ b/app/admin/view/nk/life/edit.html @@ -0,0 +1,333 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

编辑文章表

+ + + + + + {notempty name="is_vote"} + + + + + {/notempty} + + + + + + + + {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/life/index.html b/app/admin/view/nk/life/index.html new file mode 100644 index 0000000..9af757a --- /dev/null +++ b/app/admin/view/nk/life/index.html @@ -0,0 +1,144 @@ +{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/life/read.html b/app/admin/view/nk/life/read.html new file mode 100644 index 0000000..a538693 --- /dev/null +++ b/app/admin/view/nk/life/read.html @@ -0,0 +1,113 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

文章详情

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if in_array($detail.category_id,[149,157,158,148,147,165]) } + + + + + {/if} + + {if in_array($detail.category_id,[149,157,158,148,147,165]) } + + + + + {/if} + + +
文章标题{$detail.title}
创建时间{$detail.view_time}状态 + {eq name="$detail.status" value="1"}正常{/eq} + {eq name="$detail.status" value="0"}下架{/eq} +
文章摘要{$detail.describe}
价格{$detail.price}"
星级 +
{$detail.star} 星
+
坐标 +

经度:{$detail.lng}

+

纬度:{$detail.lat}

+
文章内容 + {$detail.content|raw} +
回复内容: + {volist name="$detail.comment" id="vo"} + {$vo.user_info}的回复:{$vo.content}
+ {/volist} +
回复: + +
+ {if in_array($detail.category_id,[149,157,158,148,147,165]) } +
+ + + + +
+ {/if} +
+{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/nk/slideinfo/add.html b/app/admin/view/nk/slideinfo/add.html index 739ed3b..237a79d 100644 --- a/app/admin/view/nk/slideinfo/add.html +++ b/app/admin/view/nk/slideinfo/add.html @@ -58,8 +58,8 @@ - 跳转路径* - 跳转路径 + diff --git a/app/admin/view/nk/slideinfo/edit.html b/app/admin/view/nk/slideinfo/edit.html index 71a193e..018900b 100644 --- a/app/admin/view/nk/slideinfo/edit.html +++ b/app/admin/view/nk/slideinfo/edit.html @@ -58,8 +58,8 @@ - 跳转路径* - 跳转路径 + @@ -80,7 +80,20 @@ function gouguInit() { var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate; - + //上传缩略图 + var upload_thumb = layui.upload.render({ + elem: '#upload_btn_thumb', + url: '/admin/api/upload', + done: function (res) { + //如果上传失败 + if (res.code == 1) { + return layer.msg('上传失败'); + } + //上传成功 + $('#upload_box_thumb input').attr('value', res.data.filepath); + $('#upload_box_thumb img').attr('src', res.data.filepath); + } + }); //监听提交 form.on('submit(webform)', function (data) { diff --git a/app/admin/view/store_product/add.html b/app/admin/view/store_product/add.html index a351cc6..d5368fe 100644 --- a/app/admin/view/store_product/add.html +++ b/app/admin/view/store_product/add.html @@ -68,10 +68,10 @@
+ style=" overflow: hidden;"> @@ -90,7 +90,7 @@
+ style="overflow: hidden;">
diff --git a/app/admin/view/store_product/datalist.html b/app/admin/view/store_product/datalist.html index fcc2a6f..a2bb254 100644 --- a/app/admin/view/store_product/datalist.html +++ b/app/admin/view/store_product/datalist.html @@ -24,7 +24,6 @@ {/block} - {block name="script"}