|
|
|
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use think\Db;
|
|
|
|
use think\facade\Env;
|
|
|
|
use think\facade\Request;
|
|
|
|
class Template extends Common{
|
|
|
|
protected $filepath,$publicpath,$viewSuffix;
|
|
|
|
function initialize()
|
|
...
|
...
|
@@ -243,28 +245,65 @@ class Template extends Common{ |
|
|
|
*/
|
|
|
|
public function uploadFile(){
|
|
|
|
if(request()->isPost()){
|
|
|
|
//参数获取
|
|
|
|
|
|
|
|
/*[param] => Array
|
|
|
|
(
|
|
|
|
[name] => 1231
|
|
|
|
[pic] => /uploads/20180830/e9b8b46312a7ad1c6a52e2f762c524bf.jpg
|
|
|
|
[file] =>
|
|
|
|
[content] => 123131
|
|
|
|
[ad_id] =>
|
|
|
|
)
|
|
|
|
[post] => Array
|
|
|
|
(
|
|
|
|
[name] => 1231
|
|
|
|
[pic] => /uploads/20180830/e9b8b46312a7ad1c6a52e2f762c524bf.jpg
|
|
|
|
[file] =>
|
|
|
|
[content] => 123131
|
|
|
|
[ad_id] =>
|
|
|
|
)*/
|
|
|
|
//print_r(request()->param());die;
|
|
|
|
//构建数组
|
|
|
|
$data = Request::except('file');
|
|
|
|
if(empty($data['pic'])){
|
|
|
|
$result['code'] = 0;
|
|
|
|
$result['msg'] = '请确保图片已经上传!';
|
|
|
|
$result['url'] = url('uploadFile');
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
//查询是否存在该名字
|
|
|
|
$scList=db('cookbook_material')->where(array('name'=>$data['name']))->find();
|
|
|
|
if(isset($scList)){
|
|
|
|
$result['code'] = 0;
|
|
|
|
$result['msg'] = '该名称已存在!';
|
|
|
|
$result['url'] = url('uploadFile');
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
$data['addtime'] = time();
|
|
|
|
db('cookbook_material')->insert($data);
|
|
|
|
$result['code'] = 1;
|
|
|
|
$result['msg'] = '素材添加成功!';
|
|
|
|
$result['url'] = url('uploadFile');
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','GIF、短视频上传' );
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 商家list
|
|
|
|
*/
|
|
|
|
public function sellerList(){
|
|
|
|
if(Request::isAjax()){
|
|
|
|
$data = Request::except('file');
|
|
|
|
$limit = '&x='.$data["page"].'&y='.$data["limit"];
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents('http://www.dc-api.com/public/index.php?service=App.Seller.GetSellerList'.$limit);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
if($array['ret']==200){
|
|
|
|
$result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0],'rel'=>1];
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
$this->assign ( 'title','商户菜品配置' );
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 配置商家菜品信息
|
|
|
|
*/
|
|
|
|
public function configMer(){
|
|
|
|
$data = Request::except('file');
|
|
|
|
//获取运营人员列表
|
|
|
|
$list= file_get_contents('http://www.dc-api.com/public/index.php?service=App.Cookbook.GetCookbookByClass&sellerid='.$data['id']);
|
|
|
|
$array = json_decode($list,TRUE);
|
|
|
|
$this->assign ( 'data',$data); //商户信息
|
|
|
|
$this->assign('list',$array['data'][0]['list']); //该商户所有分类下的菜品
|
|
|
|
$this->assign ( 'title','商户菜品配置' );
|
|
|
|
return $this->fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|