提交 e9ccda84 编写于 作者: D devil_gong

api附件路径优化

上级 d8d2ca57
......@@ -137,6 +137,7 @@ class Orderaftersale extends Common
'return_money_goods_reason' => empty($return_money_goods_reason) ? [] : explode("\n", $return_money_goods_reason),
'aftersale_type_list' => lang('common_order_aftersale_type_list'),
'return_goods_address' => MyC('home_order_aftersale_return_goods_address', '管理员未填写', true),
'editor_path_type' => 'orderaftersale-'.$this->user['id'].'-'.$order_id.'-'.$order_detail_id,
];
return DataReturn('success', 0, $result);
}
......
......@@ -48,7 +48,7 @@ class Ueditor extends Common
*/
public function Index()
{
$ret = UeditorService::Run($this->data_post);
$ret = UeditorService::Run($this->data_request);
if($ret['code'] == 0 && !empty($ret['data']['url']))
{
$ret['data']['url'] = ResourcesService::AttachmentPathViewHandle($ret['data']['url']);
......
......@@ -24,11 +24,12 @@
*/
function PathToParams($key = null, $default = null, $path = '')
{
$data = $_REQUEST;
if(empty($path) && isset($_REQUEST['s']))
{
$path = $_REQUEST['s'];
}
if(!empty($path))
if(!empty($path) && !array_key_exists($key, $data))
{
if(substr($path, 0, 1) == '/')
{
......@@ -41,7 +42,7 @@ function PathToParams($key = null, $default = null, $path = '')
}
$arr = explode('/', $path);
$data = [];
$index = 0;
foreach($arr as $k=>$v)
{
......@@ -51,13 +52,13 @@ function PathToParams($key = null, $default = null, $path = '')
$index = $k;
}
}
if($key !== null)
{
return array_key_exists($key, $data) ? $data[$key] : $default;
}
return $data;
}
return null;
if($key !== null)
{
return array_key_exists($key, $data) ? $data[$key] : $default;
}
return $data;
}
/**
......
......@@ -149,7 +149,7 @@ class Orderaftersale extends Common
$this->assign('common_order_aftersale_type_list', lang('common_order_aftersale_type_list'));
// 编辑器文件存放地址
$this->assign('editor_path_type', 'aftersale_'.$this->user['id'].'_'.$order_id.'_'.$order_detail_id);
$this->assign('editor_path_type', 'orderaftersale-'.$this->user['id'].'-'.$order_id.'-'.$order_detail_id);
$this->assign('params', $params);
return $this->fetch();
......
......@@ -12,7 +12,12 @@
// +----------------------------------------------------------------------
// | 百度编辑器配置信息
// +----------------------------------------------------------------------
// path_type指定的路径值
$config_path_type = PathToParams('path_type', 'other');
// 上传指定路径值 - 符号换成目录分隔符
$upload_path = str_replace('-', '/', $config_path_type);
return [
// 上传图片配置项
// 执行上传图片的action名称
......@@ -40,7 +45,7 @@ return [
'imageUrlPrefix' => '',
// 上传保存路径,可以自定义保存路径和文件名格式
'imagePathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.$config_path_type.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
'imagePathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.$upload_path.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
// 涂鸦图片上传配置项
......@@ -51,7 +56,7 @@ return [
'scrawlFieldName' => 'upfile',
// 上传保存路径,可以自定义保存路径和文件名格式
'scrawlPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.$config_path_type.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
'scrawlPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.$upload_path.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
// 上传大小限制,单位B
'scrawlMaxSize' => MyC('home_max_limit_image', 2048000, true),
......@@ -71,7 +76,7 @@ return [
'snapscreenActionName' => 'uploadimage',
// 上传保存路径,可以自定义保存路径和文件名格式
'snapscreenPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.$config_path_type.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
'snapscreenPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.$upload_path.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
// 图片访问路径前缀
'snapscreenUrlPrefix' => '',
......@@ -91,7 +96,7 @@ return [
'catcherFieldName' => 'source',
// 上传保存路径,可以自定义保存路径和文件名格式
'catcherPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.$config_path_type.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
'catcherPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.$upload_path.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
// 图片访问路径前缀
'catcherUrlPrefix' => '',
......@@ -111,7 +116,7 @@ return [
'videoFieldName' => 'upfile',
// 上传保存路径,可以自定义保存路径和文件名格式
'videoPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/video/'.$config_path_type.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
'videoPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/video/'.$upload_path.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
// 视频访问路径前缀
'videoUrlPrefix' => '',
......@@ -131,7 +136,7 @@ return [
'fileFieldName' => 'upfile',
// 上传保存路径,可以自定义保存路径和文件名格式
'filePathFormat' => __MY_ROOT_PUBLIC__.'static/upload/file/'.$config_path_type.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
'filePathFormat' => __MY_ROOT_PUBLIC__.'static/upload/file/'.$upload_path.'/{yyyy}/{mm}/{dd}/{time}{rand:6}',
// 文件访问路径前缀
'fileUrlPrefix' => '',
......
......@@ -8,6 +8,7 @@ Page({
popup_delivery_status: false,
// 接口数据
editor_path_type: '',
order_data: null,
new_aftersale_data: null,
step_data: null,
......@@ -147,6 +148,7 @@ Page({
data_bottom_line_status: true,
data_list_loding_msg: '',
editor_path_type: data.editor_path_type || '',
order_data: data.order_data || null,
new_aftersale_data: ((data.new_aftersale_data || null) == null || data.new_aftersale_data.length <= 0) ? null : data.new_aftersale_data,
step_data: data.step_data || null,
......@@ -286,6 +288,7 @@ Page({
fileType: 'image',
formData: {
action: 'uploadimage',
path_type: self.data.editor_path_type
},
success: function (res) {
success++;
......
......@@ -8,6 +8,7 @@ Page({
popup_delivery_status: false,
// 接口数据
editor_path_type: '',
order_data: null,
new_aftersale_data: null,
step_data: null,
......@@ -127,6 +128,7 @@ Page({
data_bottom_line_status: true,
data_list_loding_msg: '',
editor_path_type: data.editor_path_type || '',
order_data: data.order_data || null,
new_aftersale_data: (data.new_aftersale_data || null) == null || data.new_aftersale_data.length <= 0 ? null : data.new_aftersale_data,
step_data: data.step_data || null,
......@@ -264,7 +266,8 @@ Page({
filePath: img_paths[count],
name: 'upfile',
formData: {
action: 'uploadimage'
action: 'uploadimage',
path_type: self.data.editor_path_type
},
success: function (res) {
success++;
......
......@@ -8,6 +8,7 @@ Page({
popup_delivery_status: false,
// 接口数据
editor_path_type: '',
order_data: null,
new_aftersale_data: null,
step_data: null,
......@@ -147,6 +148,7 @@ Page({
data_bottom_line_status: true,
data_list_loding_msg: '',
editor_path_type: data.editor_path_type || '',
order_data: data.order_data || null,
new_aftersale_data: ((data.new_aftersale_data || null) == null || data.new_aftersale_data.length <= 0) ? null : data.new_aftersale_data,
step_data: data.step_data || null,
......@@ -285,6 +287,7 @@ Page({
name: 'upfile',
formData: {
action: 'uploadimage',
path_type: self.data.editor_path_type
},
success: function (res) {
success++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册