Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
u011369184
ShopXO
提交
249aa227
ShopXO
项目概览
u011369184
/
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,发现更多精彩内容 >>
提交
249aa227
编写于
6月 28, 2020
作者:
D
devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
数据日志列表优化
上级
4181d3a3
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
408 addition
and
107 deletion
+408
-107
application/admin/controller/Integrallog.php
application/admin/controller/Integrallog.php
+31
-0
application/admin/controller/Order.php
application/admin/controller/Order.php
+3
-0
application/admin/controller/Paylog.php
application/admin/controller/Paylog.php
+31
-0
application/admin/controller/Refundlog.php
application/admin/controller/Refundlog.php
+31
-0
application/admin/form/Goods.php
application/admin/form/Goods.php
+9
-0
application/admin/form/Integrallog.php
application/admin/form/Integrallog.php
+15
-0
application/admin/form/Paylog.php
application/admin/form/Paylog.php
+7
-0
application/admin/form/Refundlog.php
application/admin/form/Refundlog.php
+7
-0
application/admin/view/default/goods/save_info.html
application/admin/view/default/goods/save_info.html
+10
-1
application/admin/view/default/integrallog/detail.html
application/admin/view/default/integrallog/detail.html
+2
-0
application/admin/view/default/integrallog/module/operate.html
...cation/admin/view/default/integrallog/module/operate.html
+5
-0
application/admin/view/default/paylog/detail.html
application/admin/view/default/paylog/detail.html
+2
-0
application/admin/view/default/paylog/module/operate.html
application/admin/view/default/paylog/module/operate.html
+5
-0
application/admin/view/default/public/module/form.html
application/admin/view/default/public/module/form.html
+10
-1
application/admin/view/default/refundlog/detail.html
application/admin/view/default/refundlog/detail.html
+2
-0
application/admin/view/default/refundlog/module/operate.html
application/admin/view/default/refundlog/module/operate.html
+5
-0
application/module/FormHandleModule.php
application/module/FormHandleModule.php
+15
-0
application/service/CrontabService.php
application/service/CrontabService.php
+16
-10
application/service/GoodsService.php
application/service/GoodsService.php
+4
-0
application/service/IntegralService.php
application/service/IntegralService.php
+96
-37
application/service/NavigationService.php
application/service/NavigationService.php
+13
-11
application/service/OrderAftersaleService.php
application/service/OrderAftersaleService.php
+10
-1
application/service/OrderService.php
application/service/OrderService.php
+9
-0
application/service/UserService.php
application/service/UserService.php
+6
-4
changelog.txt
changelog.txt
+18
-0
config/shopxo.php
config/shopxo.php
+3
-0
config/shopxo.sql
config/shopxo.sql
+42
-41
public/static/common/lib/ueditor/dialogs/map/map.html
public/static/common/lib/ueditor/dialogs/map/map.html
+1
-1
未找到文件。
application/admin/controller/Integrallog.php
浏览文件 @
249aa227
...
...
@@ -78,5 +78,36 @@ class IntegralLog extends Common
$this
->
assign
(
'data_list'
,
$ret
[
'data'
]);
return
$this
->
fetch
();
}
/**
* 详情
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-05T08:21:54+0800
*/
public
function
Detail
()
{
if
(
!
empty
(
$this
->
data_request
[
'id'
]))
{
// 条件
$where
=
[
[
'id'
,
'='
,
intval
(
$this
->
data_request
[
'id'
])],
];
// 获取列表
$data_params
=
[
'm'
=>
0
,
'n'
=>
1
,
'where'
=>
$where
,
'is_public'
=>
0
,
'user_type'
=>
'admin'
,
];
$ret
=
IntegralService
::
IntegralLogList
(
$data_params
);
$data
=
(
empty
(
$ret
[
'data'
])
||
empty
(
$ret
[
'data'
][
0
]))
?
[]
:
$ret
[
'data'
][
0
];
$this
->
assign
(
'data'
,
$data
);
}
return
$this
->
fetch
();
}
}
?>
\ No newline at end of file
application/admin/controller/Order.php
浏览文件 @
249aa227
...
...
@@ -80,6 +80,9 @@ class Order extends Common
];
$this
->
assign
(
'buy_payment_list'
,
PaymentService
::
BuyPaymentList
(
$pay_where
));
// 快递公司
$this
->
assign
(
'express_list'
,
ExpressService
::
ExpressList
());
// 基础参数赋值
$this
->
assign
(
'params'
,
$this
->
data_request
);
$this
->
assign
(
'page_html'
,
$page
->
GetPageHtml
());
...
...
application/admin/controller/Paylog.php
浏览文件 @
249aa227
...
...
@@ -78,5 +78,36 @@ class PayLog extends Common
$this
->
assign
(
'data_list'
,
$ret
[
'data'
]);
return
$this
->
fetch
();
}
/**
* 详情
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-05T08:21:54+0800
*/
public
function
Detail
()
{
if
(
!
empty
(
$this
->
data_request
[
'id'
]))
{
// 条件
$where
=
[
[
'id'
,
'='
,
intval
(
$this
->
data_request
[
'id'
])],
];
// 获取列表
$data_params
=
[
'm'
=>
0
,
'n'
=>
1
,
'where'
=>
$where
,
'is_public'
=>
0
,
'user_type'
=>
'admin'
,
];
$ret
=
PayLogService
::
PayLogList
(
$data_params
);
$data
=
(
empty
(
$ret
[
'data'
])
||
empty
(
$ret
[
'data'
][
0
]))
?
[]
:
$ret
[
'data'
][
0
];
$this
->
assign
(
'data'
,
$data
);
}
return
$this
->
fetch
();
}
}
?>
\ No newline at end of file
application/admin/controller/Refundlog.php
浏览文件 @
249aa227
...
...
@@ -78,5 +78,36 @@ class RefundLog extends Common
$this
->
assign
(
'data_list'
,
$ret
[
'data'
]);
return
$this
->
fetch
();
}
/**
* 详情
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-05T08:21:54+0800
*/
public
function
Detail
()
{
if
(
!
empty
(
$this
->
data_request
[
'id'
]))
{
// 条件
$where
=
[
[
'id'
,
'='
,
intval
(
$this
->
data_request
[
'id'
])],
];
// 获取列表
$data_params
=
[
'm'
=>
0
,
'n'
=>
1
,
'where'
=>
$where
,
'is_public'
=>
0
,
'user_type'
=>
'admin'
,
];
$ret
=
RefundLogService
::
RefundLogList
(
$data_params
);
$data
=
(
empty
(
$ret
[
'data'
])
||
empty
(
$ret
[
'data'
][
0
]))
?
[]
:
$ret
[
'data'
][
0
];
$this
->
assign
(
'data'
,
$data
);
}
return
$this
->
fetch
();
}
}
?>
\ No newline at end of file
application/admin/form/Goods.php
浏览文件 @
249aa227
...
...
@@ -211,6 +211,15 @@ class Goods
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'购买赠送积分比例'
,
'view_type'
=>
'field'
,
'view_key'
=>
'give_integral'
,
'view_join_last'
=>
'%'
,
'search_config'
=>
[
'form_type'
=>
'section'
,
],
],
[
'label'
=>
'单次最低起购数量'
,
'view_type'
=>
'field'
,
...
...
application/admin/form/Integrallog.php
浏览文件 @
249aa227
...
...
@@ -73,6 +73,14 @@ class Integrallog
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'操作积分'
,
'view_type'
=>
'field'
,
'view_key'
=>
'operation_integral'
,
'search_config'
=>
[
'form_type'
=>
'section'
,
],
],
[
'label'
=>
'原始积分'
,
'view_type'
=>
'field'
,
...
...
@@ -117,6 +125,13 @@ class Integrallog
'form_name'
=>
'add_time'
,
],
],
[
'label'
=>
'操作'
,
'view_type'
=>
'operate'
,
'view_key'
=>
'integrallog/module/operate'
,
'align'
=>
'center'
,
'fixed'
=>
'right'
,
],
],
];
}
...
...
application/admin/form/Paylog.php
浏览文件 @
249aa227
...
...
@@ -151,6 +151,13 @@ class Paylog
'form_name'
=>
'add_time'
,
],
],
[
'label'
=>
'操作'
,
'view_type'
=>
'operate'
,
'view_key'
=>
'paylog/module/operate'
,
'align'
=>
'center'
,
'fixed'
=>
'right'
,
],
],
];
}
...
...
application/admin/form/Refundlog.php
浏览文件 @
249aa227
...
...
@@ -166,6 +166,13 @@ class Refundlog
'form_name'
=>
'add_time'
,
],
],
[
'label'
=>
'操作'
,
'view_type'
=>
'operate'
,
'view_key'
=>
'refundlog/module/operate'
,
'align'
=>
'center'
,
'fixed'
=>
'right'
,
],
],
];
}
...
...
application/admin/view/default/goods/save_info.html
浏览文件 @
249aa227
...
...
@@ -130,8 +130,17 @@
<input
type=
"text"
name=
"inventory_unit"
placeholder=
"库存单位"
minlength=
"1"
maxlength=
"6"
data-validation-message=
"库存单位格式 1~6 个字符"
class=
"am-radius"
{{
if
!
empty
($
data
)}}
value=
"{{$data.inventory_unit}}"
{{/
if
}}
required
/>
</div>
<div
class=
"am-form-group"
>
<label>
购买赠送积分比例
<span
class=
"am-form-group-label-tips"
>
按照商品金额比例乘以数量的比例进行发放
</span></label>
<div
class=
"am-input-group am-input-group-sm"
>
<input
type=
"number"
name=
"give_integral"
placeholder=
"购买赠送积分"
min=
"0"
max=
"100"
data-validation-message=
"购买赠送积分比例 0~100 的数字"
class=
"am-form-field am-radius"
{{
if
!
empty
($
data
['
give_integral
'])}}
value=
"{{$data.give_integral}}"
{{/
if
}}
/>
<span
class=
"am-input-group-btn"
>
<button
type=
"button"
class=
"am-btn am-btn-default am-radius"
>
%
</button>
</span>
</div>
</div>
<div
class=
"am-form-group"
>
<label>
最低起购数量
<span
class=
"am-form-group-label-tips"
>
默认数值 1
</span></label>
<input
type=
"number"
name=
"buy_min_number"
placeholder=
"最低起购数量"
min=
"1"
max=
"100000000"
data-validation-message=
"最低起购数量 1~100000000"
class=
"am-radius"
value=
"{{if empty($data)}}1{{else /}}{{$data.buy_min_number}}{{/if}}"
required
/>
<input
type=
"number"
name=
"buy_min_number"
placeholder=
"最低起购数量"
min=
"1"
max=
"100000000"
data-validation-message=
"最低起购数量 1~100000000"
class=
"am-radius"
value=
"{{if empty($data)
or empty($data['buy_min_number'])
}}1{{else /}}{{$data.buy_min_number}}{{/if}}"
required
/>
</div>
<div
class=
"am-form-group"
>
<label>
单次最大购买数量
<span
class=
"am-form-group-label-tips"
>
单次最大数值 100000000, 小于等于0或空则不限
</span></label>
...
...
application/admin/view/default/integrallog/detail.html
0 → 100644
浏览文件 @
249aa227
<!-- 继承公共的 form -->
{{extend name="public/module/detail" /}}
\ No newline at end of file
application/admin/view/default/integrallog/module/operate.html
0 → 100644
浏览文件 @
249aa227
<!-- 操作栏 -->
<button
type=
"button"
class=
"am-btn am-btn-default am-btn-xs am-radius am-btn-block submit-popup"
data-url=
"{{:MyUrl('admin/integrallog/detail', ['id'=>$module_data['id']])}}"
>
<i
class=
"am-icon-eye"
></i>
<span>
详情
</span>
</button>
\ No newline at end of file
application/admin/view/default/paylog/detail.html
0 → 100644
浏览文件 @
249aa227
<!-- 继承公共的 form -->
{{extend name="public/module/detail" /}}
\ No newline at end of file
application/admin/view/default/paylog/module/operate.html
0 → 100644
浏览文件 @
249aa227
<!-- 操作栏 -->
<button
type=
"button"
class=
"am-btn am-btn-default am-btn-xs am-radius am-btn-block submit-popup"
data-url=
"{{:MyUrl('admin/paylog/detail', ['id'=>$module_data['id']])}}"
>
<i
class=
"am-icon-eye"
></i>
<span>
详情
</span>
</button>
\ No newline at end of file
application/admin/view/default/public/module/form.html
浏览文件 @
249aa227
...
...
@@ -222,7 +222,7 @@
<tbody>
{{if !empty($data_list) and !empty($form_table['base']['key_field'])}}
<!-- 处理数据数量小于默认数量 -->
{{for start="0" end="
(count($data_list)
<
$
page_size
?
count
($
data_list
)
:
$
page_size
)"}}
{{for start="0" end="
count($data_list
)"}}
<!-- 1. tr 主键id名称 -->
<!-- 2. 是否黄色选中class -->
<tr
...
...
@@ -257,6 +257,11 @@
<!-- 数据匹配 -->
{{switch $t.view_type}}
{{case field}}
<!-- 前后固定拼接的值 前面 -->
{{if isset($t['view_join_first'])}}
<span>
{{$t.view_join_first}}
</span>
{{/if}}
<!-- 如果字段为数组则处理多个字段拼接数据 -->
{{if is_array($t['view_key'])}}
{{foreach $t['view_key'] as $fk=>$fv}}
...
...
@@ -281,6 +286,10 @@
{{/if}}
{{/if}}
{{/if}}
<!-- 前后固定拼接的值 后面 -->
{{if isset($t['view_join_last'])}}
<span>
{{$t.view_join_last}}
</span>
{{/if}}
{{/case}}
{{case module}}
<!-- 从模块加载自定义模块数据 -->
...
...
application/admin/view/default/refundlog/detail.html
0 → 100644
浏览文件 @
249aa227
<!-- 继承公共的 form -->
{{extend name="public/module/detail" /}}
\ No newline at end of file
application/admin/view/default/refundlog/module/operate.html
0 → 100644
浏览文件 @
249aa227
<!-- 操作栏 -->
<button
type=
"button"
class=
"am-btn am-btn-default am-btn-xs am-radius am-btn-block submit-popup"
data-url=
"{{:MyUrl('admin/refundlog/detail', ['id'=>$module_data['id']])}}"
>
<i
class=
"am-icon-eye"
></i>
<span>
详情
</span>
</button>
\ No newline at end of file
application/module/FormHandleModule.php
浏览文件 @
249aa227
...
...
@@ -11,6 +11,7 @@
namespace
app\module
;
use
think\Controller
;
use
think\facade\Hook
;
/**
* 动态表格处理
...
...
@@ -80,6 +81,20 @@ class FormHandleModule
return
DataReturn
(
'表格唯一字段配置有误['
.
$module
.
']base->[key_field]'
,
-
1
);
}
// 钩子
$hv
=
explode
(
'\\'
,
$module
);
if
(
isset
(
$hv
[
2
])
&&
isset
(
$hv
[
4
])
&&
in_array
(
$hv
[
2
],
config
(
'shopxo.module_form_hook_group'
)))
{
// 动态钩子名称 plugins_module_form_group_controller_action
$hook_name
=
'plugins_module_form_'
.
strtolower
(
$hv
[
2
])
.
'_'
.
strtolower
(
$hv
[
4
])
.
'_'
.
strtolower
(
$action
);
Hook
::
listen
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'params'
=>
$this
->
out_params
,
'data'
=>
&
$this
->
form_data
,
]);
}
// 基础条件
$this
->
BaseWhereHandle
();
...
...
application/service/CrontabService.php
浏览文件 @
249aa227
...
...
@@ -14,6 +14,7 @@ use think\Db;
use
app\service\OrderService
;
use
app\service\BuyService
;
use
app\service\MessageService
;
use
app\service\IntegralService
;
/**
* 定时任务服务层
...
...
@@ -120,20 +121,25 @@ class CrontabService
Db
::
startTrans
();
if
(
Db
::
name
(
'Order'
)
->
where
([
'id'
=>
$v
[
'id'
],
'status'
=>
3
])
->
update
(
$upd_data
))
{
// 订单商品
销量增加
$ret
=
OrderService
::
GoodsSalesCountInc
([
'order_id'
=>
$v
[
'id'
]]);
// 订单商品
积分赠送
$ret
=
IntegralService
::
OrderGoodsIntegralGiving
([
'order_id'
=>
$v
[
'id'
]]);
if
(
$ret
[
'code'
]
==
0
)
{
// 用户消息
MessageService
::
MessageAdd
(
$v
[
'user_id'
],
'订单收货'
,
'订单自动收货成功'
,
1
,
$v
[
'id'
]);
// 订单商品销量增加
$ret
=
OrderService
::
GoodsSalesCountInc
([
'order_id'
=>
$v
[
'id'
]]);
if
(
$ret
[
'code'
]
==
0
)
{
// 用户消息
MessageService
::
MessageAdd
(
$v
[
'user_id'
],
'订单收货'
,
'订单自动收货成功'
,
1
,
$v
[
'id'
]);
// 订单状态日志
OrderService
::
OrderHistoryAdd
(
$v
[
'id'
],
$upd_data
[
'status'
],
$v
[
'status'
],
'自动收货'
,
0
,
'系统'
);
// 订单状态日志
OrderService
::
OrderHistoryAdd
(
$v
[
'id'
],
$upd_data
[
'status'
],
$v
[
'status'
],
'自动收货'
,
0
,
'系统'
);
// 提交事务
Db
::
commit
();
$sucs
++
;
continue
;
// 提交事务
Db
::
commit
();
$sucs
++
;
continue
;
}
}
}
// 事务回滚
...
...
application/service/GoodsService.php
浏览文件 @
249aa227
...
...
@@ -1084,6 +1084,9 @@ class GoodsService
$content_web
=
empty
(
$params
[
'content_web'
])
?
''
:
ResourcesService
::
ContentStaticReplace
(
htmlspecialchars_decode
(
$params
[
'content_web'
]),
'add'
);
$fictitious_goods_value
=
empty
(
$params
[
'fictitious_goods_value'
])
?
''
:
ResourcesService
::
ContentStaticReplace
(
htmlspecialchars_decode
(
$params
[
'fictitious_goods_value'
]),
'add'
);
// 赠送积分
$give_integral
=
max
(
0
,
(
isset
(
$params
[
'give_integral'
])
&&
$params
[
'give_integral'
]
<=
100
)
?
intval
(
$params
[
'give_integral'
])
:
0
);
// 基础数据
$data
=
[
'title'
=>
$params
[
'title'
],
...
...
@@ -1092,6 +1095,7 @@ class GoodsService
'model'
=>
$params
[
'model'
],
'place_origin'
=>
isset
(
$params
[
'place_origin'
])
?
intval
(
$params
[
'place_origin'
])
:
0
,
'inventory_unit'
=>
$params
[
'inventory_unit'
],
'give_integral'
=>
$give_integral
,
'buy_min_number'
=>
max
(
1
,
isset
(
$params
[
'buy_min_number'
])
?
intval
(
$params
[
'buy_min_number'
])
:
1
),
'buy_max_number'
=>
isset
(
$params
[
'buy_max_number'
])
?
intval
(
$params
[
'buy_max_number'
])
:
0
,
'is_deduction_inventory'
=>
isset
(
$params
[
'is_deduction_inventory'
])
?
intval
(
$params
[
'is_deduction_inventory'
])
:
0
,
...
...
application/service/IntegralService.php
浏览文件 @
249aa227
...
...
@@ -31,40 +31,29 @@ class IntegralService
* @datetime 2018-05-18T16:51:12+0800
* @param [int] $user_id [用户id]
* @param [int] $original_integral [原始积分]
* @param [int] $
new_integral [最新
积分]
* @param [int] $
operation_integral[操作
积分]
* @param [string] $msg [操作原因]
* @param [int] $type [操作类型(0减少, 1增加)]
* @param [int] $operation_id [操作人员id]
* @return [boolean] [成功true, 失败false]
*/
public
static
function
UserIntegralLogAdd
(
$user_id
,
$original_integral
,
$
new
_integral
,
$msg
=
''
,
$type
=
0
,
$operation_id
=
0
)
public
static
function
UserIntegralLogAdd
(
$user_id
,
$original_integral
,
$
operation
_integral
,
$msg
=
''
,
$type
=
0
,
$operation_id
=
0
)
{
$data
=
array
(
'user_id'
=>
intval
(
$user_id
),
'original_integral'
=>
intval
(
$original_integral
),
'
new_integral'
=>
intval
(
$new
_integral
),
'msg'
=>
$msg
,
'type'
=>
intval
(
$type
),
'operation_id'
=>
intval
(
$operation_id
),
'add_time'
=>
time
(),
'user_id'
=>
intval
(
$user_id
),
'original_integral'
=>
intval
(
$original_integral
),
'
operation_integral'
=>
intval
(
$operation
_integral
),
'msg'
=>
$msg
,
'type'
=>
intval
(
$type
),
'operation_id'
=>
intval
(
$operation_id
),
'add_time'
=>
time
(),
);
$data
[
'new_integral'
]
=
(
$data
[
'type'
]
==
1
)
?
$data
[
'original_integral'
]
+
$data
[
'operation_integral'
]
:
$data
[
'original_integral'
]
-
$data
[
'operation_integral'
];
if
(
Db
::
name
(
'UserIntegralLog'
)
->
insertGetId
(
$data
)
>
0
)
{
$type_msg
=
lang
(
'common_integral_log_type_list'
)[
$type
][
'name'
];
$integral
=
(
$data
[
'type'
]
==
0
)
?
$data
[
'original_integral'
]
-
$data
[
'new_integral'
]
:
$data
[
'new_integral'
]
-
$data
[
'original_integral'
];
$detail
=
$msg
.
'积分'
.
$type_msg
.
$integral
;
$detail
=
$msg
.
'积分'
.
$type_msg
.
$operation_integral
;
MessageService
::
MessageAdd
(
$user_id
,
'积分变动'
,
$detail
);
// 用户登录数据更新防止数据存储session不同步展示
if
(
in_array
(
APPLICATION_CLIENT_TYPE
,
[
'pc'
,
'h5'
]))
{
$user
=
UserService
::
LoginUserInfo
();
if
(
isset
(
$user
[
'id'
])
&&
$user
[
'id'
]
==
$user_id
)
{
UserService
::
UserLoginRecord
(
$user_id
);
}
}
return
true
;
}
return
false
;
...
...
@@ -176,7 +165,7 @@ class IntegralService
}
/**
* 订单商品积分赠送
(已丢弃)
* 订单商品积分赠送
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
...
...
@@ -208,39 +197,109 @@ class IntegralService
}
if
(
!
in_array
(
$order
[
'status'
],
[
4
]))
{
return
DataReturn
(
'当前订单状态不允许操作
['
.
$params
[
'order_id'
]
.
'-'
.
$order
[
'status'
]
.
']
'
,
0
);
return
DataReturn
(
'当前订单状态不允许操作
,未完成
'
,
0
);
}
// 获取用户信息
$user
=
Db
::
name
(
'User'
)
->
field
(
'id'
)
->
find
(
intval
(
$order
[
'user_id'
])
);
$user
=
Db
::
name
(
'User'
)
->
field
(
'id'
)
->
find
(
$order
[
'user_id'
]
);
if
(
empty
(
$user
))
{
return
DataReturn
(
'用户不存在或已删除,中止操作'
,
0
);
}
// 获取订单商品
$
goods_all
=
Db
::
name
(
'OrderDetail'
)
->
where
([
'order_id'
=>
$params
[
'order_id'
]])
->
column
(
'goods_id'
);
if
(
!
empty
(
$
goods_al
l
))
$
order_detail
=
Db
::
name
(
'OrderDetail'
)
->
where
([
'order_id'
=>
$params
[
'order_id'
]])
->
field
(
'goods_id,total_price'
)
->
select
(
);
if
(
!
empty
(
$
order_detai
l
))
{
foreach
(
$goods_all
as
$goods_id
)
// 获取赠送积分的商品
$goods_give
=
Db
::
name
(
'Goods'
)
->
where
([
'id'
=>
array_column
(
$order_detail
,
'goods_id'
)])
->
column
(
'give_integral'
,
'id'
);
// 循环发放
foreach
(
$order_detail
as
$dv
)
{
$give_integral
=
Db
::
name
(
'Goods'
)
->
where
([
'id'
=>
$goods_id
])
->
value
(
'give_integral'
);
if
(
!
empty
(
$give_integral
))
if
(
array_key_exists
(
$dv
[
'goods_id'
],
$goods_give
))
{
// 用户积分添加
$user_integral
=
Db
::
name
(
'User'
)
->
where
([
'id'
=>
$user
[
'id'
]])
->
value
(
'integral'
);
if
(
!
Db
::
name
(
'User'
)
->
where
([
'id'
=>
$user
[
'id'
]])
->
setInc
(
'integral'
,
$give_integral
))
$give_rate
=
$goods_give
[
$dv
[
'goods_id'
]];
if
(
$give_rate
>
0
&&
$give_rate
<=
100
)
{
return
DataReturn
(
'用户积分赠送失败['
.
$params
[
'order_id'
]
.
'-'
.
$goods_id
.
']'
,
-
10
);
}
// 实际赠送积分
$give_integral
=
intval
((
$give_rate
/
100
)
*
$dv
[
'total_price'
]);
if
(
$give_integral
>=
1
)
{
// 用户积分添加
$user_integral
=
Db
::
name
(
'User'
)
->
where
([
'id'
=>
$user
[
'id'
]])
->
value
(
'integral'
);
if
(
!
Db
::
name
(
'User'
)
->
where
([
'id'
=>
$user
[
'id'
]])
->
setInc
(
'integral'
,
$give_integral
))
{
return
DataReturn
(
'用户积分赠送失败['
.
$params
[
'order_id'
]
.
'-'
.
$goods_id
.
']'
,
-
10
);
}
// 积分日志
self
::
UserIntegralLogAdd
(
$user
[
'id'
],
$user_integral
,
$user_integral
+
$give_integral
,
'订单商品完成赠送'
,
1
);
// 积分日志
self
::
UserIntegralLogAdd
(
$user
[
'id'
],
$user_integral
,
$give_integral
,
'订单商品完成赠送'
,
1
);
}
}
}
}
return
DataReturn
(
'操作成功'
,
0
);
}
return
DataReturn
(
'没有需要操作的数据'
,
0
);
}
/**
* 订单商品积分释放
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-28
* @desc description
* @param [array] $params [输入参数]
*/
public
static
function
OrderGoodsIntegralRollback
(
$params
=
[])
{
// 请求参数
$p
=
[
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'order_detail_id'
,
'error_msg'
=>
'订单详情id有误'
,
]
];
$ret
=
ParamsChecked
(
$params
,
$p
);
if
(
$ret
!==
true
)
{
return
DataReturn
(
$ret
,
-
1
);
}
// 订单详情
$order_detail
=
Db
::
name
(
'OrderDetail'
)
->
field
(
'id,user_id,order_id,goods_id,total_price,refund_price'
)
->
find
(
intval
(
$params
[
'order_detail_id'
]));
if
(
empty
(
$order_detail
))
{
return
DataReturn
(
'订单详情不存在或已删除,中止操作'
,
0
);
}
// 获取用户信息
$user
=
Db
::
name
(
'User'
)
->
field
(
'id,integral'
)
->
find
(
$order_detail
[
'user_id'
]);
if
(
empty
(
$user
))
{
return
DataReturn
(
'用户不存在或已删除,中止操作'
,
0
);
}
// 获取商品相关信息
$give_rate
=
Db
::
name
(
'Goods'
)
->
where
([
'id'
=>
$order_detail
[
'goods_id'
]])
->
value
(
'give_integral'
);
if
(
$give_rate
>
0
&&
$give_rate
<=
100
)
{
$give_integral
=
intval
((
$give_rate
/
100
)
*
$order_detail
[
'refund_price'
]);
if
(
$give_integral
>=
1
)
{
// 用户积分添加
if
(
!
Db
::
name
(
'User'
)
->
where
([
'id'
=>
$user
[
'id'
]])
->
setDec
(
'integral'
,
$give_integral
))
{
return
DataReturn
(
'用户积分释放失败['
.
$order_detail
[
'order_id'
]
.
'-'
.
$order_detail
[
'goods_id'
]
.
']'
,
-
10
);
}
// 积分日志
self
::
UserIntegralLogAdd
(
$user
[
'id'
],
$user
[
'integral'
],
$give_integral
,
'订单商品发生售后收回'
,
0
);
}
}
}
}
?>
\ No newline at end of file
application/service/NavigationService.php
浏览文件 @
249aa227
...
...
@@ -210,32 +210,34 @@ class NavigationService
$field
=
'*'
;
$data
=
self
::
NavigationHandle
(
self
::
NavDataDealWith
(
Db
::
name
(
'Navigation'
)
->
field
(
$field
)
->
where
(
$where1
)
->
order
(
'sort'
)
->
select
()));
$result
=
[];
if
(
!
empty
(
$data
))
{
// 子级数据
$items
=
[];
// 子级数据组合
$where2
=
$where
;
$where2
[]
=
[
'pid'
,
'in'
,
array_column
(
$data
,
'id'
)];
$items_data
=
self
::
NavigationHandle
(
self
::
NavDataDealWith
(
Db
::
name
(
'Navigation'
)
->
field
(
$field
)
->
where
(
$where2
)
->
order
(
'sort'
)
->
select
()));
$items_data
=
self
::
NavigationHandle
(
self
::
NavDataDealWith
(
Db
::
name
(
'Navigation'
)
->
field
(
$field
)
->
where
(
$where2
)
->
order
(
'sort'
)
->
select
()));
$items_group
=
[];
if
(
!
empty
(
$items_data
))
{
foreach
(
$items_data
as
$
it
)
foreach
(
$items_data
as
$
tv
)
{
$items
[
$it
[
'pid'
]][]
=
$it
;
$items
_group
[
$tv
[
'pid'
]][]
=
$tv
;
}
}
// 数据
处理
foreach
(
$data
as
$
k
=>
$
v
)
// 数据
集合
foreach
(
$data
as
$
d
v
)
{
// 数据类型
if
(
isset
(
$items
[
$v
[
'id'
]]
))
$result
[]
=
$dv
;
if
(
!
empty
(
$items_group
)
&&
array_key_exists
(
$dv
[
'id'
],
$items_group
))
{
array_splice
(
$data
,
$k
+
1
,
0
,
$items
[
$
v
[
'id'
]]);
$result
=
array_merge
(
$result
,
$items_group
[
$d
v
[
'id'
]]);
}
}
}
return
DataReturn
(
'处理成功'
,
0
,
$data
);
return
DataReturn
(
'处理成功'
,
0
,
$result
);
}
/**
...
...
application/service/OrderAftersaleService.php
浏览文件 @
249aa227
...
...
@@ -17,6 +17,7 @@ use app\service\ResourcesService;
use
app\service\RefundLogService
;
use
app\service\OrderService
;
use
app\service\MessageService
;
use
app\service\IntegralService
;
use
app\plugins\wallet\service\WalletService
;
/**
...
...
@@ -966,10 +967,18 @@ class OrderAftersaleService
if
(
$ret
[
'code'
]
!=
0
)
{
Db
::
rollback
();
return
DataReturn
(
$ret
[
'msg'
],
-
10
)
;
return
$ret
;
}
}
// 积分释放
$ret
=
IntegralService
::
OrderGoodsIntegralRollback
([
'order_detail_id'
=>
$aftersale
[
'order_detail_id'
]]);
if
(
$ret
[
'code'
]
!=
0
)
{
Db
::
rollback
();
return
$ret
;
}
// 消息通知
$detail
=
'订单退款成功,金额'
.
PriceBeautify
(
$aftersale
[
'price'
])
.
'元'
;
MessageService
::
MessageAdd
(
$order
[
'data'
][
'user_id'
],
'订单退款'
,
$detail
,
1
,
$order
[
'data'
][
'id'
]);
...
...
application/service/OrderService.php
浏览文件 @
249aa227
...
...
@@ -1447,6 +1447,15 @@ class OrderService
];
if
(
Db
::
name
(
'Order'
)
->
where
(
$where
)
->
update
(
$upd_data
))
{
// 订单商品积分赠送
$ret
=
IntegralService
::
OrderGoodsIntegralGiving
([
'order_id'
=>
$order
[
'id'
]]);
if
(
$ret
[
'code'
]
!=
0
)
{
// 事务回滚
Db
::
rollback
();
return
DataReturn
(
$ret
[
'msg'
],
-
10
);
}
// 订单商品销量增加
$ret
=
self
::
GoodsSalesCountInc
([
'order_id'
=>
$order
[
'id'
]]);
if
(
$ret
[
'code'
]
!=
0
)
...
...
application/service/UserService.php
浏览文件 @
249aa227
...
...
@@ -329,13 +329,15 @@ class UserService
if
((
$data
[
'integral'
]
>
0
&&
empty
(
$user
))
||
(
isset
(
$user
[
'integral'
])
&&
$user
[
'integral'
]
!=
$data
[
'integral'
]))
{
$integral_type
=
1
;
$integral
=
0
;
if
(
isset
(
$user
[
'integral'
]))
$old_integral
=
0
;
$opt_integral
=
0
;
if
(
!
empty
(
$params
[
'id'
]))
{
$old_integral
=
$user
[
'integral'
];
$integral_type
=
(
$user
[
'integral'
]
>
$data
[
'integral'
])
?
0
:
1
;
$
integral
=
$user
[
'integral'
];
$
opt_integral
=
(
$integral_type
==
1
)
?
$data
[
'integral'
]
-
$user
[
'integral'
]
:
$user
[
'integral'
]
-
$data
[
'integral'
];
}
IntegralService
::
UserIntegralLogAdd
(
$user_id
,
$
integral
,
$data
[
'integral'
]
,
'管理员操作'
,
$integral_type
,
$params
[
'admin'
][
'id'
]);
IntegralService
::
UserIntegralLogAdd
(
$user_id
,
$
old_integral
,
$opt_integral
,
'管理员操作'
,
$integral_type
,
$params
[
'admin'
][
'id'
]);
}
return
DataReturn
(
'操作成功'
,
0
);
}
...
...
changelog.txt
浏览文件 @
249aa227
+=========================================================+
ShopXO 1.9.0 Release --- http://shopxo.net
+=========================================================+
全局
1. 所有条件、列表、新增、编辑、删除 新增钩子(公共 form 表单封装)
2. 积分支持按照订单商品总额比例发放,发生售后收回积分
3. 微信小程序好物推荐和直播组件支持配置组件版本号
web端
小程序端
插件
+=========================================================+
ShopXO 1.8.1 Release 20200420 http://shopxo.net
+=========================================================+
...
...
config/shopxo.php
浏览文件 @
249aa227
...
...
@@ -93,5 +93,8 @@ return [
// 验证码最大验证次数,防止暴力破解
'security_prevent_violence_max'
=>
6
,
// 动态表格可加入钩子组
'module_form_hook_group'
=>
[
'admin'
,
'index'
,
'api'
],
];
?>
\ No newline at end of file
config/shopxo.sql
浏览文件 @
249aa227
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
public/static/common/lib/ueditor/dialogs/map/map.html
浏览文件 @
249aa227
...
...
@@ -4,7 +4,7 @@
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title></title>
<script
type=
"text/javascript"
src=
"../internal.js"
></script>
<script
type=
"text/javascript"
src=
"https://api.map.baidu.com/api?v=2.0&ak=
{{common_baidu_map_ak}}
"
></script>
<script
type=
"text/javascript"
src=
"https://api.map.baidu.com/api?v=2.0&ak=
XSdiGjfg3wOHiKjpYEMG6CYA
"
></script>
<style
type=
"text/css"
>
.content
{
width
:
530px
;
height
:
350px
;
margin
:
10px
auto
;}
.content
table
{
width
:
100%
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录