Showing
5 changed files
with
112 additions
and
29 deletions
| @@ -343,15 +343,19 @@ class Auth extends Common | @@ -343,15 +343,19 @@ class Auth extends Common | ||
| 343 | } | 343 | } |
| 344 | //增加运营管理人员 | 344 | //增加运营管理人员 |
| 345 | public function operateDel(){ | 345 | public function operateDel(){ |
| 346 | - //缓存60秒 不请求。 | ||
| 347 | - $arr = cache('qrcod_url'); | ||
| 348 | - if(!$arr){ | ||
| 349 | - $arr= file_get_contents("http://xt.colorcun.com/WechatApi/WechatApi/CreateOperateQrcode/"); | 346 | + if(Request::isAjax()){ |
| 347 | + $data = Request::except('file'); | ||
| 348 | + $arr= file_get_contents("http://xt04.colorcun.com/index.php?service=App.Seller.DelSellerInfo&id=".$data['id']); | ||
| 350 | $arr = json_decode($arr,TRUE); | 349 | $arr = json_decode($arr,TRUE); |
| 351 | - cache('qrcod_url',$arr, 50); | 350 | + if($arr['data'][0]==1){ |
| 351 | + $result['code'] = 1; | ||
| 352 | + $result['msg'] = '删除成功!'; | ||
| 353 | + }else{ | ||
| 354 | + $result['code'] = 0; | ||
| 355 | + $result['msg'] = '请求错误!'; | ||
| 356 | + } | ||
| 357 | + return $result; | ||
| 352 | } | 358 | } |
| 353 | - | ||
| 354 | - $this->assign('qrcode_path',$arr['data']); | ||
| 355 | return view(); | 359 | return view(); |
| 356 | } | 360 | } |
| 357 | } | 361 | } |
| 1 | <?php | 1 | <?php |
| 2 | namespace app\admin\controller; | 2 | namespace app\admin\controller; |
| 3 | +use think\Db; | ||
| 3 | use think\facade\Env; | 4 | use think\facade\Env; |
| 5 | +use think\facade\Request; | ||
| 4 | class Template extends Common{ | 6 | class Template extends Common{ |
| 5 | protected $filepath,$publicpath,$viewSuffix; | 7 | protected $filepath,$publicpath,$viewSuffix; |
| 6 | function initialize() | 8 | function initialize() |
| @@ -243,28 +245,65 @@ class Template extends Common{ | @@ -243,28 +245,65 @@ class Template extends Common{ | ||
| 243 | */ | 245 | */ |
| 244 | public function uploadFile(){ | 246 | public function uploadFile(){ |
| 245 | if(request()->isPost()){ | 247 | if(request()->isPost()){ |
| 246 | - //参数获取 | ||
| 247 | - | ||
| 248 | - /*[param] => Array | ||
| 249 | - ( | ||
| 250 | - [name] => 1231 | ||
| 251 | - [pic] => /uploads/20180830/e9b8b46312a7ad1c6a52e2f762c524bf.jpg | ||
| 252 | - [file] => | ||
| 253 | - [content] => 123131 | ||
| 254 | - [ad_id] => | ||
| 255 | - ) | ||
| 256 | - [post] => Array | ||
| 257 | - ( | ||
| 258 | - [name] => 1231 | ||
| 259 | - [pic] => /uploads/20180830/e9b8b46312a7ad1c6a52e2f762c524bf.jpg | ||
| 260 | - [file] => | ||
| 261 | - [content] => 123131 | ||
| 262 | - [ad_id] => | ||
| 263 | - )*/ | ||
| 264 | - //print_r(request()->param());die; | 248 | + //构建数组 |
| 249 | + $data = Request::except('file'); | ||
| 250 | + if(empty($data['pic'])){ | ||
| 251 | + $result['code'] = 0; | ||
| 252 | + $result['msg'] = '请确保图片已经上传!'; | ||
| 253 | + $result['url'] = url('uploadFile'); | ||
| 254 | + return $result; | ||
| 255 | + } | ||
| 256 | + //查询是否存在该名字 | ||
| 257 | + $scList=db('cookbook_material')->where(array('name'=>$data['name']))->find(); | ||
| 258 | + if(isset($scList)){ | ||
| 259 | + $result['code'] = 0; | ||
| 260 | + $result['msg'] = '该名称已存在!'; | ||
| 261 | + $result['url'] = url('uploadFile'); | ||
| 262 | + return $result; | ||
| 263 | + } | ||
| 264 | + $data['addtime'] = time(); | ||
| 265 | + db('cookbook_material')->insert($data); | ||
| 266 | + $result['code'] = 1; | ||
| 267 | + $result['msg'] = '素材添加成功!'; | ||
| 268 | + $result['url'] = url('uploadFile'); | ||
| 269 | + return $result; | ||
| 265 | } | 270 | } |
| 266 | $this->assign ( 'title','GIF、短视频上传' ); | 271 | $this->assign ( 'title','GIF、短视频上传' ); |
| 267 | return $this->fetch(); | 272 | return $this->fetch(); |
| 268 | } | 273 | } |
| 269 | 274 | ||
| 275 | + /** | ||
| 276 | + * 商家list | ||
| 277 | + */ | ||
| 278 | + public function sellerList(){ | ||
| 279 | + if(Request::isAjax()){ | ||
| 280 | + $data = Request::except('file'); | ||
| 281 | + $limit = '&x='.$data["page"].'&y='.$data["limit"]; | ||
| 282 | + //获取运营人员列表 | ||
| 283 | + $list= file_get_contents('http://www.dc-api.com/public/index.php?service=App.Seller.GetSellerList'.$limit); | ||
| 284 | + $array = json_decode($list,TRUE); | ||
| 285 | + if($array['ret']==200){ | ||
| 286 | + $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0],'rel'=>1]; | ||
| 287 | + } | ||
| 288 | + return $result; | ||
| 289 | + } | ||
| 290 | + $this->assign ( 'title','商户菜品配置' ); | ||
| 291 | + return $this->fetch(); | ||
| 292 | + } | ||
| 293 | + | ||
| 294 | + | ||
| 295 | + /** | ||
| 296 | + * 配置商家菜品信息 | ||
| 297 | + */ | ||
| 298 | + public function configMer(){ | ||
| 299 | + $data = Request::except('file'); | ||
| 300 | + //获取运营人员列表 | ||
| 301 | + $list= file_get_contents('http://www.dc-api.com/public/index.php?service=App.Cookbook.GetCookbookByClass&sellerid='.$data['id']); | ||
| 302 | + $array = json_decode($list,TRUE); | ||
| 303 | + $this->assign ( 'data',$data); //商户信息 | ||
| 304 | + $this->assign('list',$array['data'][0]['list']); //该商户所有分类下的菜品 | ||
| 305 | + $this->assign ( 'title','商户菜品配置' ); | ||
| 306 | + return $this->fetch(); | ||
| 307 | + } | ||
| 308 | + | ||
| 270 | } | 309 | } |
| @@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
| 36 | var data = obj.data; | 36 | var data = obj.data; |
| 37 | if(obj.event === 'del'){ | 37 | if(obj.event === 'del'){ |
| 38 | layer.confirm('{:lang("Are you sure you want to delete it")}', function(index){ | 38 | layer.confirm('{:lang("Are you sure you want to delete it")}', function(index){ |
| 39 | - $.post("{:url('operateDel')}",{admin_id:data.admin_id},function(res){ | 39 | + $.post("{:url('operateDel')}",{id:data.id},function(res){ |
| 40 | if(res.code==1){ | 40 | if(res.code==1){ |
| 41 | layer.msg(res.msg,{time:1000,icon:1}); | 41 | layer.msg(res.msg,{time:1000,icon:1}); |
| 42 | obj.del(); | 42 | obj.del(); |
| 1 | +{include file="common/head"/} | ||
| 2 | +<div class="admin-main layui-anim layui-anim-upbit"> | ||
| 3 | + <fieldset class="layui-elem-field layui-field-title"> | ||
| 4 | + <legend>{:$title}</legend> | ||
| 5 | + </fieldset> | ||
| 6 | + <blockquote class="layui-elem-quote"> | ||
| 7 | + <a href="{:url('sellerList')}" class="layui-btn layui-btn-sm layui-btn-danger"> | ||
| 8 | + <i class="fa fa-file-image-o"></i> 商家信息列表 | ||
| 9 | + </a> | ||
| 10 | + <a href="{:url('uploadFile')}" class="layui-btn layui-btn-sm"> | ||
| 11 | + <i class="fa fa-file-image-o"></i> GIF图片、短视频上传 | ||
| 12 | + </a> | ||
| 13 | + </blockquote> | ||
| 14 | + <table class="layui-table" id="list" lay-filter="list"></table> | ||
| 15 | +</div> | ||
| 16 | +{include file="common/foot"/} | ||
| 17 | +<script type="text/html" id="action"> | ||
| 18 | + <a href="{:url('configMer')}?id={{d.id}}&name={{d.sellername}}" class="layui-btn layui-btn-xs">配置菜品</a> | ||
| 19 | +</script> | ||
| 20 | +<script> | ||
| 21 | + layui.use(['table','form'], function() { | ||
| 22 | + var table = layui.table,$ = layui.jquery; | ||
| 23 | + var tableIn = table.render({ | ||
| 24 | + elem: '#list', | ||
| 25 | + url: '{:url("sellerList")}', | ||
| 26 | + method: 'post', | ||
| 27 | + page:true, | ||
| 28 | + cols: [[ | ||
| 29 | + {field: 'id', title: '{:lang("id")}', width:60, fixed: true}, | ||
| 30 | + {field: 'sellername', title: '商家名称', width: 150}, | ||
| 31 | + {field: 'phone', title: '商家电话', width: 150}, | ||
| 32 | + {field: 'map_address', title: '商家地址', width: 300}, | ||
| 33 | + {field: 'cdate', align: 'center',title: '创建日期', width: 120}, | ||
| 34 | + {width: 200, align: 'center',title: '操作', toolbar: '#action'} | ||
| 35 | + ]] | ||
| 36 | + }); | ||
| 37 | + }) | ||
| 38 | +</script> |
| @@ -4,6 +4,9 @@ | @@ -4,6 +4,9 @@ | ||
| 4 | <legend>{$title}</legend> | 4 | <legend>{$title}</legend> |
| 5 | </fieldset> | 5 | </fieldset> |
| 6 | <blockquote class="layui-elem-quote"> | 6 | <blockquote class="layui-elem-quote"> |
| 7 | + <a href="{:url('sellerList')}" class="layui-btn layui-btn-sm"> | ||
| 8 | + <i class="fa fa-file-image-o"></i> 商家信息列表 | ||
| 9 | + </a> | ||
| 7 | <a href="{:url('uploadFile')}" class="layui-btn layui-btn-sm layui-btn-danger"> | 10 | <a href="{:url('uploadFile')}" class="layui-btn layui-btn-sm layui-btn-danger"> |
| 8 | <i class="fa fa-file-image-o"></i> GIF图片、短视频上传 | 11 | <i class="fa fa-file-image-o"></i> GIF图片、短视频上传 |
| 9 | </a> | 12 | </a> |
| @@ -50,7 +53,7 @@ | @@ -50,7 +53,7 @@ | ||
| 50 | <script> | 53 | <script> |
| 51 | var m = angular.module('hd',[]); | 54 | var m = angular.module('hd',[]); |
| 52 | m.controller('ctrl',['$scope',function($scope) { | 55 | m.controller('ctrl',['$scope',function($scope) { |
| 53 | - $scope.field = {type_id:'',ad_id:'',name:'',url:'',open:1,sort:50,pic:'',content:''}; | 56 | + $scope.field = {type_id:'',name:'',url:'',open:1,sort:50,pic:'',content:''}; |
| 54 | layui.use(['form', 'layer','upload'], function () { | 57 | layui.use(['form', 'layer','upload'], function () { |
| 55 | var form = layui.form, $ = layui.jquery, upload = layui.upload; | 58 | var form = layui.form, $ = layui.jquery, upload = layui.upload; |
| 56 | if($scope.field.pic){ | 59 | if($scope.field.pic){ |
| @@ -58,7 +61,6 @@ | @@ -58,7 +61,6 @@ | ||
| 58 | } | 61 | } |
| 59 | form.on('submit(submit)', function (data) { | 62 | form.on('submit(submit)', function (data) { |
| 60 | // 提交到方法 默认为本身 | 63 | // 提交到方法 默认为本身 |
| 61 | - data.field.ad_id = $scope.field.ad_id; | ||
| 62 | var loading = layer.load(1, {shade: [0.1, '#fff']}); | 64 | var loading = layer.load(1, {shade: [0.1, '#fff']}); |
| 63 | $.post("{:url('uploadFile')}", data.field, function (res) { | 65 | $.post("{:url('uploadFile')}", data.field, function (res) { |
| 64 | layer.close(loading); | 66 | layer.close(loading); |
-
Please register or login to post a comment