Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jamesyang1999
ShopXO
提交
9c1d0d9e
ShopXO
项目概览
jamesyang1999
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9c1d0d9e
编写于
12月 07, 2020
作者:
D
Devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
订单优化
上级
238d5346
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
346 addition
and
107 deletion
+346
-107
application/admin/controller/Common.php
application/admin/controller/Common.php
+3
-3
application/admin/view/default/pluginsadmin/save_info.html
application/admin/view/default/pluginsadmin/save_info.html
+1
-1
application/api/controller/Common.php
application/api/controller/Common.php
+66
-4
application/index/controller/Common.php
application/index/controller/Common.php
+3
-3
application/module/FormHandleModule.php
application/module/FormHandleModule.php
+122
-37
application/service/ExpressService.php
application/service/ExpressService.php
+23
-3
application/service/GoodsService.php
application/service/GoodsService.php
+15
-11
application/service/OrderService.php
application/service/OrderService.php
+53
-29
application/service/PaymentService.php
application/service/PaymentService.php
+30
-9
application/service/UserService.php
application/service/UserService.php
+30
-7
未找到文件。
application/admin/controller/Common.php
浏览文件 @
9c1d0d9e
...
@@ -276,13 +276,13 @@ class Common extends Controller
...
@@ -276,13 +276,13 @@ class Common extends Controller
public
function
FormTableInit
()
public
function
FormTableInit
()
{
{
// 获取表格模型
// 获取表格模型
$
data
=
FormModulePath
(
$this
->
data_request
);
$
module
=
FormModulePath
(
$this
->
data_request
);
if
(
!
empty
(
$
data
))
if
(
!
empty
(
$
module
))
{
{
// 调用表格处理
// 调用表格处理
$params
=
$this
->
data_request
;
$params
=
$this
->
data_request
;
$params
[
'system_admin'
]
=
$this
->
admin
;
$params
[
'system_admin'
]
=
$this
->
admin
;
$ret
=
(
new
FormHandleModule
())
->
Run
(
$
data
[
'module'
],
$data
[
'action'
],
$params
);
$ret
=
(
new
FormHandleModule
())
->
Run
(
$
module
[
'module'
],
$module
[
'action'
],
$params
);
if
(
$ret
[
'code'
]
==
0
)
if
(
$ret
[
'code'
]
==
0
)
{
{
$this
->
form_table
=
$ret
[
'data'
][
'table'
];
$this
->
form_table
=
$ret
[
'data'
][
'table'
];
...
...
application/admin/view/default/pluginsadmin/save_info.html
浏览文件 @
9c1d0d9e
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
</div>
</div>
<div
class=
"am-form-group am-form-file"
>
<div
class=
"am-form-group am-form-file"
>
<label
class=
"block"
>
LOGO
<span
class=
"am-form-group-label-tips"
>
建议130像
数X130像数
</span></label>
<label
class=
"block"
>
LOGO
<span
class=
"am-form-group-label-tips"
>
建议130像
素X130像素
</span></label>
<ul
class=
"plug-file-upload-view plugins-logo-view"
data-form-name=
"logo"
data-max-number=
"1"
data-delete=
"0"
data-dialog-type=
"images"
>
<ul
class=
"plug-file-upload-view plugins-logo-view"
data-form-name=
"logo"
data-max-number=
"1"
data-delete=
"0"
data-dialog-type=
"images"
>
<li>
<li>
<input
type=
"text"
name=
"logo"
value=
"{{if !empty($data['logo_old'])}}{{$data.logo_old}}{{/if}}"
data-validation-message=
"请上传图片"
required
/>
<input
type=
"text"
name=
"logo"
value=
"{{if !empty($data['logo_old'])}}{{$data.logo_old}}{{/if}}"
data-validation-message=
"请上传图片"
required
/>
...
...
application/api/controller/Common.php
浏览文件 @
9c1d0d9e
...
@@ -14,6 +14,7 @@ use think\Controller;
...
@@ -14,6 +14,7 @@ use think\Controller;
use
app\service\SystemService
;
use
app\service\SystemService
;
use
app\service\ConfigService
;
use
app\service\ConfigService
;
use
app\service\UserService
;
use
app\service\UserService
;
use
app\module\FormHandleModule
;
/**
/**
* 接口公共控制器
* 接口公共控制器
...
@@ -27,11 +28,29 @@ class Common extends Controller
...
@@ -27,11 +28,29 @@ class Common extends Controller
// 用户信息
// 用户信息
protected
$user
;
protected
$user
;
// 当前操作名称
protected
$module_name
;
protected
$controller_name
;
protected
$action_name
;
// 输入参数 post|get|request
// 输入参数 post|get|request
protected
$data_post
;
protected
$data_post
;
protected
$data_get
;
protected
$data_get
;
protected
$data_request
;
protected
$data_request
;
// 分页信息
protected
$page
;
protected
$page_size
;
// 动态表格
protected
$form_table
;
protected
$form_where
;
protected
$form_params
;
protected
$form_md5_key
;
protected
$form_user_fields
;
protected
$form_order_by
;
protected
$form_error
;
/**
/**
* 构造方法
* 构造方法
* @author Devil
* @author Devil
...
@@ -58,6 +77,9 @@ class Common extends Controller
...
@@ -58,6 +77,9 @@ class Common extends Controller
// 网站状态
// 网站状态
$this
->
SiteStstusCheck
();
$this
->
SiteStstusCheck
();
// 动态表格初始化
$this
->
FormTableInit
();
// 公共数据初始化
// 公共数据初始化
$this
->
CommonInit
();
$this
->
CommonInit
();
}
}
...
@@ -94,7 +116,7 @@ class Common extends Controller
...
@@ -94,7 +116,7 @@ class Common extends Controller
}
}
/**
/**
*
[SiteStstusCheck 网站状态]
*
网站状态
* @author Devil
* @author Devil
* @blog http://gong.gg/
* @blog http://gong.gg/
* @version 1.0.0
* @version 1.0.0
...
@@ -109,7 +131,7 @@ class Common extends Controller
...
@@ -109,7 +131,7 @@ class Common extends Controller
}
}
/**
/**
*
[IsLogin 登录校验]
*
登录校验
* @author Devil
* @author Devil
* @blog http://gong.gg/
* @blog http://gong.gg/
* @version 0.0.1
* @version 0.0.1
...
@@ -123,8 +145,39 @@ class Common extends Controller
...
@@ -123,8 +145,39 @@ class Common extends Controller
}
}
}
}
/**
* 动态表格初始化
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-02
* @desc description
*/
public
function
FormTableInit
()
{
// 获取表格模型
$module
=
FormModulePath
(
$this
->
data_request
);
if
(
!
empty
(
$module
))
{
// 调用表格处理
$params
=
$this
->
data_request
;
$ret
=
(
new
FormHandleModule
())
->
Run
(
$module
[
'module'
],
$module
[
'action'
],
$params
);
if
(
$ret
[
'code'
]
==
0
)
{
$this
->
form_table
=
$ret
[
'data'
][
'table'
];
$this
->
form_where
=
$ret
[
'data'
][
'where'
];
$this
->
form_params
=
$ret
[
'data'
][
'params'
];
$this
->
form_md5_key
=
$ret
[
'data'
][
'md5_key'
];
$this
->
form_user_fields
=
$ret
[
'data'
][
'user_fields'
];
$this
->
form_order_by
=
$ret
[
'data'
][
'order_by'
];
}
else
{
$this
->
form_error
=
$ret
[
'msg'
];
}
}
}
/**
/**
*
[CommonInit 公共数据初始化]
*
公共数据初始化
* @author Devil
* @author Devil
* @blog http://gong.gg/
* @blog http://gong.gg/
* @version 0.0.1
* @version 0.0.1
...
@@ -134,10 +187,19 @@ class Common extends Controller
...
@@ -134,10 +187,19 @@ class Common extends Controller
{
{
// 用户数据
// 用户数据
$this
->
user
=
UserService
::
LoginUserInfo
();
$this
->
user
=
UserService
::
LoginUserInfo
();
// 当前操作名称
$this
->
module_name
=
strtolower
(
request
()
->
module
());
$this
->
controller_name
=
strtolower
(
request
()
->
controller
());
$this
->
action_name
=
strtolower
(
request
()
->
action
());
// 分页信息
$this
->
page
=
max
(
1
,
isset
(
$this
->
data_request
[
'page'
])
?
intval
(
$this
->
data_request
[
'page'
])
:
1
);
$this
->
page_size
=
10
;
}
}
/**
/**
*
[_empty 空方法操作]
*
空方法操作
* @author Devil
* @author Devil
* @blog http://gong.gg/
* @blog http://gong.gg/
* @version 0.0.1
* @version 0.0.1
...
...
application/index/controller/Common.php
浏览文件 @
9c1d0d9e
...
@@ -435,13 +435,13 @@ class Common extends Controller
...
@@ -435,13 +435,13 @@ class Common extends Controller
public
function
FormTableInit
()
public
function
FormTableInit
()
{
{
// 获取表格模型
// 获取表格模型
$
data
=
FormModulePath
(
$this
->
data_request
);
$
module
=
FormModulePath
(
$this
->
data_request
);
if
(
!
empty
(
$
data
))
if
(
!
empty
(
$
module
))
{
{
// 调用表格处理
// 调用表格处理
$params
=
$this
->
data_request
;
$params
=
$this
->
data_request
;
$params
[
'system_user'
]
=
$this
->
user
;
$params
[
'system_user'
]
=
$this
->
user
;
$ret
=
(
new
FormHandleModule
())
->
Run
(
$
data
[
'module'
],
$data
[
'action'
],
$params
);
$ret
=
(
new
FormHandleModule
())
->
Run
(
$
module
[
'module'
],
$module
[
'action'
],
$params
);
if
(
$ret
[
'code'
]
==
0
)
if
(
$ret
[
'code'
]
==
0
)
{
{
$this
->
form_table
=
$ret
[
'data'
][
'table'
];
$this
->
form_table
=
$ret
[
'data'
][
'table'
];
...
...
application/module/FormHandleModule.php
浏览文件 @
9c1d0d9e
...
@@ -54,44 +54,11 @@ class FormHandleModule
...
@@ -54,44 +54,11 @@ class FormHandleModule
*/
*/
public
function
Run
(
$module
,
$action
=
'Run'
,
$params
=
[])
public
function
Run
(
$module
,
$action
=
'Run'
,
$params
=
[])
{
{
// 参数
// 参数校验
$this
->
out_params
=
$params
;
$ret
=
$this
->
ParamsCheckHandle
(
$module
,
$action
,
$params
);
if
(
$ret
[
'code'
]
!=
0
)
// 模块是否存在
if
(
!
class_exists
(
$module
))
{
return
DataReturn
(
'表格模块未定义['
.
$module
.
']'
,
-
1
);
}
// 指定方法检测
$this
->
module_obj
=
new
$module
(
$this
->
out_params
);
if
(
!
method_exists
(
$this
->
module_obj
,
$action
))
{
// 默认方法检测
$action
=
'Run'
;
if
(
!
method_exists
(
$this
->
module_obj
,
$action
))
{
return
DataReturn
(
'表格方法未定义['
.
$module
.
'->'
.
$action
.
'()]'
,
-
1
);
}
}
// 获取表格配置数据
$this
->
form_data
=
$this
->
module_obj
->
$action
(
$this
->
out_params
);
if
(
empty
(
$this
->
form_data
[
'base'
])
||
!
is_array
(
$this
->
form_data
[
'base'
])
||
empty
(
$this
->
form_data
[
'form'
])
||
!
is_array
(
$this
->
form_data
[
'form'
]))
{
{
return
DataReturn
(
'表格配置有误['
.
$module
.
'][base|form]'
,
-
1
);
return
$ret
;
}
// 数据唯一主字段
if
(
empty
(
$this
->
form_data
[
'base'
][
'key_field'
]))
{
return
DataReturn
(
'表格唯一字段配置有误['
.
$module
.
']base->[key_field]'
,
-
1
);
}
// 是否上下居中(0否,1是)默认1
if
(
!
isset
(
$this
->
form_data
[
'base'
][
'is_middle'
]))
{
$this
->
form_data
[
'base'
][
'is_middle'
]
=
1
;
}
}
// 钩子
// 钩子
...
@@ -141,6 +108,62 @@ class FormHandleModule
...
@@ -141,6 +108,62 @@ class FormHandleModule
return
DataReturn
(
'success'
,
0
,
$data
);
return
DataReturn
(
'success'
,
0
,
$data
);
}
}
/**
* 参数校验
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-12-06
* @desc description
* @param [string] $module [模块位置]
* @param [string] $action [模块方法(默认 Run 方法,可自动匹配控制器方法名)]
* @param [mixed] $params [参数数据]
*/
public
function
ParamsCheckHandle
(
$module
,
$action
,
$params
)
{
// 参数
$this
->
out_params
=
$params
;
// 模块是否存在
if
(
!
class_exists
(
$module
))
{
return
DataReturn
(
'表格模块未定义['
.
$module
.
']'
,
-
1
);
}
// 指定方法检测
$this
->
module_obj
=
new
$module
(
$this
->
out_params
);
if
(
!
method_exists
(
$this
->
module_obj
,
$action
))
{
// 默认方法检测
$action
=
'Run'
;
if
(
!
method_exists
(
$this
->
module_obj
,
$action
))
{
return
DataReturn
(
'表格方法未定义['
.
$module
.
'->'
.
$action
.
'()]'
,
-
1
);
}
}
// 获取表格配置数据
$this
->
form_data
=
$this
->
module_obj
->
$action
(
$this
->
out_params
);
if
(
empty
(
$this
->
form_data
[
'base'
])
||
!
is_array
(
$this
->
form_data
[
'base'
])
||
empty
(
$this
->
form_data
[
'form'
])
||
!
is_array
(
$this
->
form_data
[
'form'
]))
{
return
DataReturn
(
'表格配置有误['
.
$module
.
'][base|form]'
,
-
1
);
}
// 数据唯一主字段
if
(
empty
(
$this
->
form_data
[
'base'
][
'key_field'
]))
{
return
DataReturn
(
'表格唯一字段配置有误['
.
$module
.
']base->[key_field]'
,
-
1
);
}
// 是否上下居中(0否,1是)默认1
if
(
!
isset
(
$this
->
form_data
[
'base'
][
'is_middle'
]))
{
$this
->
form_data
[
'base'
][
'is_middle'
]
=
1
;
}
return
DataReturn
(
'success'
,
0
);
}
/**
/**
* 初始化
* 初始化
* @author Devil
* @author Devil
...
@@ -736,5 +759,67 @@ class FormHandleModule
...
@@ -736,5 +759,67 @@ class FormHandleModule
$this
->
where
=
$this
->
module_obj
->
condition_base
;
$this
->
where
=
$this
->
module_obj
->
condition_base
;
}
}
}
}
/**
* 表格数据列表处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-12-06
* @desc description
* @param [array] $data [数据列表]
* @param [array] $params [参数数据]
*/
public
function
FormTableDataListHandle
(
$data
,
$params
)
{
// 空或非数组则不处理
if
(
empty
(
$data
)
||
!
is_array
(
$data
)
||
empty
(
$params
)
||
!
is_array
(
$params
))
{
return
$data
;
}
// 获取表格模型处理表格列表数据
$module
=
FormModulePath
(
$params
);
if
(
empty
(
$module
))
{
return
$data
;
}
// 参数校验
$ret
=
$this
->
ParamsCheckHandle
(
$module
[
'module'
],
$module
[
'action'
],
$params
);
if
(
$ret
[
'code'
]
!=
0
)
{
return
$data
;
}
// 获取表单配置数据处理
$form
=
array_column
(
$this
->
form_data
[
'form'
],
null
,
'view_key'
);
foreach
(
$data
as
$k
=>&
$v
)
{
if
(
empty
(
$v
)
||
!
is_array
(
$v
))
{
continue
;
}
foreach
(
$v
as
$ks
=>
$vs
)
{
// view_type为field
// 必须存在view_data数据
if
(
!
array_key_exists
(
$ks
,
$form
)
||
empty
(
$form
[
$ks
][
'view_data'
])
||
!
is_array
(
$form
[
$ks
][
'view_data'
]))
{
continue
;
}
// 是否指定view_data_key配置、指定则view_data为二维数组
$key
=
$ks
.
'_name'
;
if
(
empty
(
$form
[
$ks
][
'view_data_key'
]))
{
$v
[
$key
]
=
isset
(
$form
[
$ks
][
'view_data'
][
$vs
])
?
$form
[
$ks
][
'view_data'
][
$vs
]
:
''
;
}
else
{
$v
[
$key
]
=
(
isset
(
$form
[
$ks
][
'view_data'
][
$vs
])
&&
isset
(
$form
[
$ks
][
'view_data'
][
$vs
][
$form
[
$ks
][
'view_data_key'
]]))
?
$form
[
$ks
][
'view_data'
][
$vs
][
$form
[
$ks
][
'view_data_key'
]]
:
''
;
}
}
}
return
$data
;
}
}
}
?>
?>
\ No newline at end of file
application/service/ExpressService.php
浏览文件 @
9c1d0d9e
...
@@ -29,11 +29,31 @@ class ExpressService
...
@@ -29,11 +29,31 @@ class ExpressService
* @version 1.0.0
* @version 1.0.0
* @date 2018-09-19
* @date 2018-09-19
* @desc description
* @desc description
* @param [
int] $express_id
[快递id]
* @param [
array|int] $express_ids
[快递id]
*/
*/
public
static
function
ExpressName
(
$express_id
=
0
)
public
static
function
ExpressName
(
$express_id
s
=
0
)
{
{
return
empty
(
$express_id
)
?
null
:
Db
::
name
(
'Express'
)
->
where
([
'id'
=>
intval
(
$express_id
)])
->
value
(
'name'
);
if
(
empty
(
$express_ids
))
{
return
null
;
}
// 参数处理查询数据
if
(
is_array
(
$express_ids
))
{
$express_ids
=
array_filter
(
array_unique
(
$express_ids
));
}
if
(
!
empty
(
$express_ids
))
{
$data
=
Db
::
name
(
'Express'
)
->
where
([
'id'
=>
$express_ids
])
->
column
(
'name'
,
'id'
);
}
// id数组则直接返回
if
(
is_array
(
$express_ids
))
{
return
empty
(
$data
)
?
[]
:
$data
;
}
return
(
!
empty
(
$data
)
&&
is_array
(
$data
)
&&
array_key_exists
(
$express_ids
,
$data
))
?
$data
[
$express_ids
]
:
null
;
}
}
/**
/**
...
...
application/service/GoodsService.php
浏览文件 @
9c1d0d9e
...
@@ -1284,7 +1284,7 @@ class GoodsService
...
@@ -1284,7 +1284,7 @@ class GoodsService
{
{
$data
[
$ks
][]
=
empty
(
$vs
)
?
null
:
htmlspecialchars_decode
(
$vs
);
$data
[
$ks
][]
=
empty
(
$vs
)
?
null
:
htmlspecialchars_decode
(
$vs
);
}
else
{
}
else
{
$data
[
$ks
][]
=
$vs
;
$data
[
$ks
][]
=
trim
(
$vs
)
;
}
}
}
}
}
}
...
@@ -1375,8 +1375,9 @@ class GoodsService
...
@@ -1375,8 +1375,9 @@ class GoodsService
$key
=
substr
(
$ks
,
21
);
$key
=
substr
(
$ks
,
21
);
if
(
!
empty
(
$params
[
'specifications_name_'
.
$key
]))
if
(
!
empty
(
$params
[
'specifications_name_'
.
$key
]))
{
{
$title
[
$params
[
'specifications_name_'
.
$key
]]
=
[
$spec_name
=
trim
(
$params
[
'specifications_name_'
.
$key
]);
'name'
=>
$params
[
'specifications_name_'
.
$key
],
$title
[
$spec_name
]
=
[
'name'
=>
$spec_name
,
'value'
=>
array_unique
(
$vs
),
'value'
=>
array_unique
(
$vs
),
];
];
$names_value
[]
=
$params
[
'specifications_name_'
.
$key
];
$names_value
[]
=
$params
[
'specifications_name_'
.
$key
];
...
@@ -1891,20 +1892,23 @@ class GoodsService
...
@@ -1891,20 +1892,23 @@ class GoodsService
{
{
foreach
(
$type_v
[
'value'
]
as
$type_vs
)
foreach
(
$type_v
[
'value'
]
as
$type_vs
)
{
{
if
(
$type_vs
[
'name'
]
==
$value_v
[
'value'
]
)
if
(
trim
(
$type_vs
[
'name'
])
==
trim
(
$value_v
[
'value'
])
)
{
{
$key
=
$type_v
[
'id'
];
$key
=
$type_v
[
'id'
];
break
;
break
;
}
}
}
}
}
}
$value
[
$value_v
[
'goods_spec_base_id'
]][]
=
[
if
(
!
empty
(
$key
))
'data_type'
=>
'spec'
,
{
'data'
=>
[
$value
[
$value_v
[
'goods_spec_base_id'
]][]
=
[
'key'
=>
$key
,
'data_type'
=>
'spec'
,
'value'
=>
$value_v
[
'value'
],
'data'
=>
[
],
'key'
=>
$key
,
];
'value'
=>
trim
(
$value_v
[
'value'
]),
],
];
}
}
}
}
}
...
...
application/service/OrderService.php
浏览文件 @
9c1d0d9e
...
@@ -1034,7 +1034,7 @@ class OrderService
...
@@ -1034,7 +1034,7 @@ class OrderService
{
{
// 地区数据
// 地区数据
$we_ids
=
array_unique
(
array_column
(
$data
,
'warehouse_id'
));
$we_ids
=
array_unique
(
array_column
(
$data
,
'warehouse_id'
));
$warehouse
=
Db
::
name
(
'Warehouse'
)
->
where
([
'id'
=>
$we_ids
])
->
column
(
'name'
,
'id'
);
$warehouse
_list
=
Db
::
name
(
'Warehouse'
)
->
where
([
'id'
=>
$we_ids
])
->
column
(
'name'
,
'id'
);
}
}
// 默认货币
// 默认货币
...
@@ -1043,6 +1043,24 @@ class OrderService
...
@@ -1043,6 +1043,24 @@ class OrderService
// 订单货币
// 订单货币
$currency_data
=
OrderCurrencyService
::
OrderCurrencyGroupList
(
array_column
(
$data
,
'id'
));
$currency_data
=
OrderCurrencyService
::
OrderCurrencyGroupList
(
array_column
(
$data
,
'id'
));
// 用户列表
if
(
in_array
(
'warehouse_id'
,
$keys
)
&&
isset
(
$params
[
'is_public'
])
&&
$params
[
'is_public'
]
==
0
)
{
$user_list
=
UserService
::
GetUserViewInfo
(
array_column
(
$data
,
'user_id'
));
}
// 快递名称
if
(
in_array
(
'express_id'
,
$keys
))
{
$express_list
=
ExpressService
::
ExpressName
(
array_column
(
$data
,
'express_id'
));
}
// 支付方式名称
$payment_list
=
PaymentService
::
OrderPaymentName
(
array_column
(
$data
,
'id'
));
// 取货码
$extraction_data
=
self
::
OrderExtractionData
(
array_column
(
$data
,
'id'
));
// 循环处理数据
// 循环处理数据
foreach
(
$data
as
&
$v
)
foreach
(
$data
as
&
$v
)
{
{
...
@@ -1061,12 +1079,12 @@ class OrderService
...
@@ -1061,12 +1079,12 @@ class OrderService
}
}
// 订单货币
// 订单货币
$v
[
'currency_data'
]
=
array_key_exists
(
$v
[
'id'
],
$currency_data
)
?
$currency_data
[
$v
[
'id'
]]
:
$currency_default
;
$v
[
'currency_data'
]
=
(
!
empty
(
$currency_data
)
&&
is_array
(
$currency_data
)
&&
array_key_exists
(
$v
[
'id'
],
$currency_data
)
)
?
$currency_data
[
$v
[
'id'
]]
:
$currency_default
;
// 订单所属仓库
// 订单所属仓库
if
(
isset
(
$v
[
'warehouse_id'
]))
if
(
isset
(
$v
[
'warehouse_id'
]))
{
{
$v
[
'warehouse_name'
]
=
isset
(
$warehouse
[
$v
[
'warehouse_id'
]])
?
$warehouse
[
$v
[
'warehouse_id'
]]
:
''
;
$v
[
'warehouse_name'
]
=
(
!
empty
(
$warehouse_list
)
&&
is_array
(
$warehouse_list
)
&&
array_key_exists
(
$v
[
'warehouse_id'
],
$warehouse_list
))
?
$warehouse_list
[
$v
[
'warehouse_id'
]]
:
''
;
}
}
// 订单模式处理
// 订单模式处理
...
@@ -1079,7 +1097,7 @@ class OrderService
...
@@ -1079,7 +1097,7 @@ class OrderService
// 自提模式 添加订单取货码
// 自提模式 添加订单取货码
if
(
$v
[
'order_model'
]
==
2
)
if
(
$v
[
'order_model'
]
==
2
)
{
{
$v
[
'extraction_data'
]
=
self
::
OrdersExtractionData
(
$v
[
'id'
])
;
$v
[
'extraction_data'
]
=
(
!
empty
(
$extraction_data
)
&&
array_key_exists
(
$v
[
'id'
],
$extraction_data
))
?
$extraction_data
[
$v
[
'id'
]]
:
[]
;
}
}
}
}
...
@@ -1088,7 +1106,7 @@ class OrderService
...
@@ -1088,7 +1106,7 @@ class OrderService
{
{
if
(
isset
(
$params
[
'is_public'
])
&&
$params
[
'is_public'
]
==
0
)
if
(
isset
(
$params
[
'is_public'
])
&&
$params
[
'is_public'
]
==
0
)
{
{
$v
[
'user'
]
=
UserService
::
GetUserViewInfo
(
$v
[
'user_id'
])
;
$v
[
'user'
]
=
(
!
empty
(
$user_list
)
&&
is_array
(
$user_list
)
&&
array_key_exists
(
$v
[
'user_id'
],
$user_list
))
?
$user_list
[
$v
[
'user_id'
]]
:
[]
;
}
}
}
}
...
@@ -1105,10 +1123,10 @@ class OrderService
...
@@ -1105,10 +1123,10 @@ class OrderService
$v
[
'pay_status_name'
]
=
$order_pay_status
[
$v
[
'pay_status'
]][
'name'
];
$v
[
'pay_status_name'
]
=
$order_pay_status
[
$v
[
'pay_status'
]][
'name'
];
// 快递公司
// 快递公司
$v
[
'express_name'
]
=
ExpressService
::
ExpressName
(
$v
[
'express_id'
])
;
$v
[
'express_name'
]
=
(
!
empty
(
$express_list
)
&&
is_array
(
$express_list
)
&&
array_key_exists
(
$v
[
'express_id'
],
$express_list
))
?
$express_list
[
$v
[
'express_id'
]]
:
null
;
// 支付方式
// 支付方式
$v
[
'payment_name'
]
=
PaymentService
::
OrderPaymentName
(
$v
[
'id'
],
$v
[
'payment_id'
])
;
$v
[
'payment_name'
]
=
(
!
empty
(
$payment_list
)
&&
is_array
(
$payment_list
)
&&
array_key_exists
(
$v
[
'id'
],
$payment_list
))
?
$payment_list
[
$v
[
'id'
]]
:
null
;
// 线下支付 icon 名称
// 线下支付 icon 名称
$v
[
'is_under_line_text'
]
=
(
$v
[
'is_under_line'
]
==
1
)
?
'线下支付'
:
null
;
$v
[
'is_under_line_text'
]
=
(
$v
[
'is_under_line'
]
==
1
)
?
'线下支付'
:
null
;
...
@@ -1239,6 +1257,9 @@ class OrderService
...
@@ -1239,6 +1257,9 @@ class OrderService
$items
=
Db
::
name
(
'OrderDetail'
)
->
where
([
'order_id'
=>
$order_id
])
->
select
();
$items
=
Db
::
name
(
'OrderDetail'
)
->
where
([
'order_id'
=>
$order_id
])
->
select
();
if
(
!
empty
(
$items
))
if
(
!
empty
(
$items
))
{
{
// 虚拟商品取货码
$fictitious_value_list
=
Db
::
name
(
'OrderFictitiousValue'
)
->
where
([
'order_detail_id'
=>
array_column
(
$items
,
'id'
)])
->
value
(
'value'
,
'order_detail_id'
);
foreach
(
$items
as
&
$vs
)
foreach
(
$items
as
&
$vs
)
{
{
// 商品是否无封面图片
// 商品是否无封面图片
...
@@ -1271,7 +1292,7 @@ class OrderService
...
@@ -1271,7 +1292,7 @@ class OrderService
// 虚拟销售商品 - 虚拟信息处理
// 虚拟销售商品 - 虚拟信息处理
if
(
$order_model
==
3
&&
$pay_status
==
1
&&
in_array
(
$status
,
[
3
,
4
]))
if
(
$order_model
==
3
&&
$pay_status
==
1
&&
in_array
(
$status
,
[
3
,
4
]))
{
{
$vs
[
'fictitious_goods_value'
]
=
Db
::
name
(
'OrderFictitiousValue'
)
->
where
([
'order_detail_id'
=>
$vs
[
'id'
]])
->
value
(
'value'
)
;
$vs
[
'fictitious_goods_value'
]
=
(
!
empty
(
$fictitious_value_list
)
&&
array_key_exists
(
$vs
[
'id'
],
$fictitious_value_list
))
?
$fictitious_value_list
[
$vs
[
'id'
]]
:
''
;
}
}
// 是否获取最新一条售后信息
// 是否获取最新一条售后信息
...
@@ -1293,34 +1314,37 @@ class OrderService
...
@@ -1293,34 +1314,37 @@ class OrderService
* @version 1.0.0
* @version 1.0.0
* @date 2019-11-26
* @date 2019-11-26
* @desc description
* @desc description
* @param [
int] $order_id
[订单id]
* @param [
array] $order_ids
[订单id]
*/
*/
private
static
function
Order
sExtractionData
(
$order_id
)
private
static
function
Order
ExtractionData
(
$order_ids
)
{
{
// 必须返回的内容格式
// 必须返回的内容格式
$result
=
[
$result
=
[];
'code'
=>
null
,
'images'
=>
null
,
];
// 获取取货码
// 获取取货码
$
code
=
Db
::
name
(
'OrderExtractionCode'
)
->
where
([
'order_id'
=>
$order_id
])
->
value
(
'code
'
);
$
data
=
Db
::
name
(
'OrderExtractionCode'
)
->
where
([
'order_id'
=>
array_unique
(
$order_ids
)])
->
column
(
'code'
,
'order_id
'
);
if
(
!
empty
(
$
code
))
if
(
!
empty
(
$
data
)
&&
is_array
(
$data
))
{
{
$result
[
'code'
]
=
$code
;
foreach
(
$order_ids
as
$v
)
// 生成二维码参数
$params
=
[
'content'
=>
$code
,
'path'
=>
DS
.
'download'
.
DS
.
'order'
.
DS
.
'extraction_ode'
.
DS
,
'filename'
=>
$order_id
.
'.png'
,
];
// 图片不存在则去生成二维码图片并保存至目录
$ret
=
(
new
\
base\Qrcode
())
->
Create
(
$params
);
if
(
$ret
[
'code'
]
==
0
)
{
{
$result
[
'images'
]
=
$ret
[
'data'
][
'url'
];
$images
=
null
;
if
(
array_key_exists
(
$v
,
$data
))
{
// 生成二维码参数
$params
=
[
'content'
=>
$data
[
$v
],
'path'
=>
DS
.
'download'
.
DS
.
'order'
.
DS
.
'extraction_ode'
.
DS
,
'filename'
=>
$v
.
'.png'
,
];
// 图片不存在则去生成二维码图片并保存至目录
$ret
=
(
new
\
base\Qrcode
())
->
Create
(
$params
);
$images
=
(
$ret
[
'code'
]
==
0
)
?
$ret
[
'data'
][
'url'
]
:
null
;
}
$result
[
$v
]
=
[
'code'
=>
isset
(
$data
[
$v
])
?
$data
[
$v
]
:
null
,
'images'
=>
$images
,
];
}
}
}
}
return
$result
;
return
$result
;
...
...
application/service/PaymentService.php
浏览文件 @
9c1d0d9e
...
@@ -252,21 +252,42 @@ class PaymentService
...
@@ -252,21 +252,42 @@ class PaymentService
* @version 1.0.0
* @version 1.0.0
* @date 2018-09-19
* @date 2018-09-19
* @desc description
* @desc description
* @param [int|string] $business_value [业务订单id|单号]
* @param [int|array] $business_ids [业务订单id]
* @param [int] $payment_id [支付方式id]
*/
*/
public
static
function
OrderPaymentName
(
$business_
value
=
0
,
$payment_id
=
0
)
public
static
function
OrderPaymentName
(
$business_
ids
=
0
)
{
{
$name
=
null
;
if
(
empty
(
$business_ids
))
if
(
!
empty
(
$business_value
))
{
{
$name
=
Db
::
name
(
'PayLog'
)
->
alias
(
'pl'
)
->
join
([
'__PAY_LOG_VALUE__'
=>
'plv'
],
'pl.id=plv.pay_log_id'
)
->
where
([
'business_id|business_no'
=>
$business_value
])
->
order
(
'pl.id desc'
)
->
value
(
'pl.payment_name'
);
return
null
;
if
(
empty
(
$anme
)
&&
!
empty
(
$payment_id
))
}
// 参数处理查询数据
if
(
is_array
(
$business_ids
))
{
$business_ids
=
array_filter
(
array_unique
(
$business_ids
));
}
if
(
!
empty
(
$business_ids
))
{
$res
=
Db
::
name
(
'PayLog'
)
->
alias
(
'pl'
)
->
join
([
'__PAY_LOG_VALUE__'
=>
'plv'
],
'pl.id=plv.pay_log_id'
)
->
where
([
'plv.business_id'
=>
$business_ids
])
->
order
(
'pl.id desc'
)
->
field
(
'plv.business_id,pl.payment_name'
)
->
select
();
$data
=
[];
if
(
!
empty
(
$res
)
&&
is_array
(
$res
))
{
{
$name
=
Db
::
name
(
'Payment'
)
->
where
([
'id'
=>
intval
(
$payment_id
)])
->
value
(
'name'
);
foreach
(
$res
as
$v
)
{
if
(
!
array_key_exists
(
$v
[
'business_id'
],
$data
))
{
$data
[
$v
[
'business_id'
]]
=
$v
[
'payment_name'
];
}
}
}
}
}
}
return
$name
;
// id数组则直接返回
if
(
is_array
(
$business_ids
))
{
return
empty
(
$data
)
?
[]
:
$data
;
}
return
(
!
empty
(
$data
)
&&
is_array
(
$data
)
&&
array_key_exists
(
$business_ids
,
$data
))
?
$data
[
$business_ids
]
:
null
;
}
}
/**
/**
...
...
application/service/UserService.php
浏览文件 @
9c1d0d9e
...
@@ -1941,20 +1941,43 @@ class UserService
...
@@ -1941,20 +1941,43 @@ class UserService
* @version 1.0.0
* @version 1.0.0
* @date 2019-05-05
* @date 2019-05-05
* @desc description
* @desc description
* @param [
int] $user_id
[用户id]
* @param [
array|int] $user_ids
[用户id]
* @param [array] $user [指定用户信息]
* @param [array] $user [指定用户信息]
* @param [boolean] $is_privacy [是否隐私处理展示用户名]
* @param [boolean] $is_privacy [是否隐私处理展示用户名]
*/
*/
public
static
function
GetUserViewInfo
(
$user_id
,
$user
=
[],
$is_privacy
=
false
)
public
static
function
GetUserViewInfo
(
$user_id
s
,
$user
=
[],
$is_privacy
=
false
)
{
{
// 是否指定用户信息
// 是否指定用户信息
if
(
empty
(
$user
)
&&
!
empty
(
$user_id
))
if
(
empty
(
$user
)
&&
!
empty
(
$user_id
s
))
{
{
$user
=
Db
::
name
(
'User'
)
->
field
(
'username,nickname,mobile,email,avatar'
)
->
find
(
$user_id
);
if
(
is_array
(
$user_ids
))
{
$user_ids
=
array_filter
(
array_unique
(
$user_ids
));
}
if
(
!
empty
(
$user_ids
))
{
$data
=
Db
::
name
(
'User'
)
->
field
(
'username,nickname,mobile,email,avatar'
)
->
where
([
'id'
=>
$user_ids
])
->
column
(
'*'
,
'id'
);
}
// 数据处理
if
(
!
empty
(
$data
)
&&
is_array
(
$data
))
{
foreach
(
$data
as
&
$v
)
{
$v
=
self
::
UserHandle
(
$v
);
}
}
// 用户id是否数组
if
(
is_array
(
$user_ids
))
{
$user
=
isset
(
$data
)
?
$data
:
[];
}
else
{
$user
=
(
!
empty
(
$data
)
&&
array_key_exists
(
$user_ids
,
$data
))
?
$data
[
$user_ids
]
:
[];
}
}
else
{
$user
=
self
::
UserHandle
(
$user
);
}
}
// 用户数据处理
$user
=
self
::
UserHandle
(
$user
);
return
$user
;
return
$user
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录