Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
61db8092
ShopXO
项目概览
jcy2004x
/
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
61db8092
编写于
8月 18, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
细节优化+订单自动脚本
上级
1b42b536
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
281 addition
and
27 deletion
+281
-27
application/admin/view/default/order/index.html
application/admin/view/default/order/index.html
+3
-0
application/admin/view/default/site/extends.html
application/admin/view/default/site/extends.html
+18
-0
application/api/controller/Crontab.php
application/api/controller/Crontab.php
+50
-0
application/service/CrontabService.php
application/service/CrontabService.php
+156
-0
application/tags.php
application/tags.php
+35
-2
config/shopxo.sql
config/shopxo.sql
+17
-17
extend/payment/BaiduMini.php
extend/payment/BaiduMini.php
+2
-8
未找到文件。
application/admin/view/default/order/index.html
浏览文件 @
61db8092
...
...
@@ -359,6 +359,9 @@
<dt>
取消时间
</dt>
<dd>
{{if empty($v['cancel_time'])}}
<span
class=
"cr-ddd"
>
未填写
</span>
{{else /}}{{$v.cancel_time}}{{/if}}
</dd>
<dt>
关闭时间
</dt>
<dd>
{{if empty($v['close_time'])}}
<span
class=
"cr-ddd"
>
未填写
</span>
{{else /}}{{$v.close_time}}{{/if}}
</dd>
<dt>
创建时间
</dt>
<dd>
{{$v.add_time}}
</dd>
...
...
application/admin/view/default/site/extends.html
浏览文件 @
61db8092
...
...
@@ -17,6 +17,24 @@
{{/foreach}}
</select>
</div>
<div
class=
"am-form-group"
>
<label>
{{$data.common_order_close_limit_time.name}}
<span
class=
"am-form-group-label-tips"
>
{{$data.common_order_close_limit_time.describe}}
</span></label>
<input
type=
"number"
name=
"{{$data.common_order_close_limit_time.only_tag}}"
placeholder=
"{{$data.common_order_close_limit_time.name}}"
data-validation-message=
"{{$data.common_order_close_limit_time.error_tips}}"
class=
"am-radius"
{{
if
!
empty
($
data
)}}
value=
"{{$data.common_order_close_limit_time.value}}"
{{/
if
}}
required
/>
<div
class=
"am-alert am-alert-warning"
data-am-alert
>
<p
class=
"am-text-warning"
>
建议将该地址添加到linux定时任务定时请求即可(结果 sucs:0, fail:0 冒号后面则是处理的数据条数,sucs成功,fali失败)
</p>
<a
href=
"{{:MyUrl('api/crontab/orderclose')}}"
target=
"_blank"
>
{{:MyUrl('api/crontab/orderclose')}}
</a>
</div>
</div>
<div
class=
"am-form-group"
>
<label>
{{$data.common_order_success_limit_time.name}}
<span
class=
"am-form-group-label-tips"
>
{{$data.common_order_success_limit_time.describe}}
</span></label>
<input
type=
"number"
name=
"{{$data.common_order_success_limit_time.only_tag}}"
placeholder=
"{{$data.common_order_success_limit_time.name}}"
data-validation-message=
"{{$data.common_order_success_limit_time.error_tips}}"
class=
"am-radius"
{{
if
!
empty
($
data
)}}
value=
"{{$data.common_order_success_limit_time.value}}"
{{/
if
}}
required
/>
<div
class=
"am-alert am-alert-warning"
data-am-alert
>
<p
class=
"am-text-warning"
>
建议将该地址添加到linux定时任务定时请求即可(结果 sucs:0, fail:0 冒号后面则是处理的数据条数,sucs成功,fali失败)
</p>
<a
href=
"{{:MyUrl('api/crontab/ordersuccess')}}"
target=
"_blank"
>
{{:MyUrl('api/crontab/ordersuccess')}}
</a>
</div>
</div>
<div
class=
"am-form-group am-form-group-refreshing"
>
<input
type=
"hidden"
name=
"nav_type"
value=
"{{$nav_type}}"
/>
...
...
application/api/controller/Crontab.php
0 → 100644
浏览文件 @
61db8092
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\api\controller
;
use
app\service\CrontabService
;
/**
* 定时任务
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2019-08-18T17:19:33+0800
*/
class
Crontab
extends
Common
{
/**
* 订单关闭
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-18T17:19:33+0800
*/
public
function
OrderClose
()
{
$ret
=
CrontabService
::
OrderClose
();
return
'sucs:'
.
$ret
[
'data'
][
'sucs'
]
.
', fail:'
.
$ret
[
'data'
][
'fail'
];
}
/**
* 订单收货
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-18T17:19:33+0800
*/
public
function
OrderSuccess
()
{
$ret
=
CrontabService
::
OrderSuccess
();
return
'sucs:'
.
$ret
[
'data'
][
'sucs'
]
.
', fail:'
.
$ret
[
'data'
][
'fail'
];
}
}
?>
\ No newline at end of file
application/service/CrontabService.php
0 → 100644
浏览文件 @
61db8092
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\service
;
use
think\Db
;
use
app\service\OrderService
;
use
app\service\BuyService
;
use
app\service\MessageService
;
/**
* 定时任务服务层
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2019-08-18T17:19:33+0800
*/
class
CrontabService
{
/**
* 订单自动关闭
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-18T17:22:29+0800
* @desc 从订单创建时间开始计算周期
* @param [array] $params [输入参数]
*/
public
static
function
OrderClose
(
$params
=
[])
{
// 获取可关闭订单
$time
=
time
()
-
intval
(
MyC
(
'common_order_close_limit_time'
,
30
,
true
));
$where
=
[
[
'add_time'
,
'<'
,
$time
],
[
'status'
,
'='
,
1
],
];
$order
=
Db
::
name
(
'Order'
)
->
where
(
$where
)
->
field
(
'id,status,user_id'
)
->
select
();
// 状态
$sucs
=
0
;
$fail
=
0
;
if
(
!
empty
(
$order
))
{
// 订单更新数据
$upd_data
=
[
'status'
=>
6
,
'close_time'
=>
time
(),
'upd_time'
=>
time
(),
];
foreach
(
$order
as
$v
)
{
// 开启事务
Db
::
startTrans
();
unset
(
$where
[
2
]);
$where
[]
=
[
'id'
,
'='
,
$v
[
'id'
]];
if
(
Db
::
name
(
'Order'
)
->
where
(
$where
)
->
update
(
$upd_data
))
{
// 库存回滚
$ret
=
BuyService
::
OrderInventoryRollback
([
'order_id'
=>
$v
[
'id'
],
'order_data'
=>
$upd_data
]);
if
(
$ret
[
'code'
]
==
0
)
{
// 用户消息
MessageService
::
MessageAdd
(
$v
[
'user_id'
],
'订单关闭'
,
'订单超时关闭'
,
1
,
$v
[
'id'
]);
// 订单状态日志
OrderService
::
OrderHistoryAdd
(
$v
[
'id'
],
$upd_data
[
'status'
],
$v
[
'status'
],
'超时关闭'
,
0
,
'系统'
);
// 提交事务
Db
::
commit
();
$sucs
++
;
continue
;
}
}
// 事务回滚
Db
::
rollback
();
$fail
++
;
}
}
return
DataReturn
(
'操作成功'
,
0
,
[
'sucs'
=>
$sucs
,
'fail'
=>
$fail
]);
}
/**
* 订单自动收货
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-08-18T17:24:05+0800
* @desc 从发货时间开始计算周期
* @param [array] $params [输入参数]
*/
public
static
function
OrderSuccess
(
$params
=
[])
{
// 获取可收货订单
$time
=
time
()
-
intval
(
MyC
(
'common_order_success_limit_time'
,
21600
,
true
));
$where
=
[
[
'delivery_time'
,
'<'
,
$time
],
[
'status'
,
'='
,
3
],
];
$order
=
Db
::
name
(
'Order'
)
->
where
(
$where
)
->
field
(
'id,status,user_id'
)
->
select
();
// 状态
$sucs
=
0
;
$fail
=
0
;
if
(
!
empty
(
$order
))
{
// 更新订单状态
$upd_data
=
[
'status'
=>
4
,
'collect_time'
=>
time
(),
'upd_time'
=>
time
(),
];
foreach
(
$order
as
$v
)
{
// 开启事务
Db
::
startTrans
();
unset
(
$where
[
2
]);
$where
[]
=
[
'id'
,
'='
,
$v
[
'id'
]];
if
(
Db
::
name
(
'Order'
)
->
where
(
$where
)
->
update
(
$upd_data
))
{
// 订单商品积分赠送
$ret
=
IntegralService
::
OrderGoodsIntegralGiving
([
'order_id'
=>
$v
[
'id'
]]);
if
(
$ret
[
'code'
]
==
0
)
{
// 订单商品销量增加
$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
,
'系统'
);
// 提交事务
Db
::
commit
();
$sucs
++
;
continue
;
}
}
}
// 事务回滚
Db
::
rollback
();
$fail
++
;
}
}
return
DataReturn
(
'操作成功'
,
0
,
[
'sucs'
=>
$sucs
,
'fail'
=>
$fail
]);
}
}
?>
\ No newline at end of file
application/tags.php
浏览文件 @
61db8092
...
...
@@ -35,14 +35,17 @@ return array (
'plugins_service_users_center_left_menu_handle'
=>
array
(
0
=>
'app\\plugins\\distribution\\Hook'
,
1
=>
'app\\plugins\\coupon\\Hook'
,
),
'plugins_service_header_navigation_top_right_handle'
=>
array
(
0
=>
'app\\plugins\\distribution\\Hook'
,
1
=>
'app\\plugins\\coupon\\Hook'
,
),
'plugins_service_order_status_change_history_success_handle'
=>
array
(
0
=>
'app\\plugins\\distribution\\Hook'
,
1
=>
'app\\plugins\\coupon\\Hook'
,
),
'plugins_service_order_aftersale_audit_handle_end'
=>
array
(
...
...
@@ -50,11 +53,41 @@ return array (
),
'plugins_css'
=>
array
(
0
=>
'app\\plugins\\share\\Hook'
,
0
=>
'app\\plugins\\coupon\\Hook'
,
1
=>
'app\\plugins\\share\\Hook'
,
),
'plugins_js'
=>
array
(
0
=>
'app\\plugins\\share\\Hook'
,
0
=>
'app\\plugins\\coupon\\Hook'
,
1
=>
'app\\plugins\\share\\Hook'
,
),
'plugins_service_navigation_header_handle'
=>
array
(
0
=>
'app\\plugins\\coupon\\Hook'
,
),
'plugins_view_goods_detail_panel_bottom'
=>
array
(
0
=>
'app\\plugins\\coupon\\Hook'
,
),
'plugins_view_buy_goods_bottom'
=>
array
(
0
=>
'app\\plugins\\coupon\\Hook'
,
),
'plugins_service_buy_handle'
=>
array
(
0
=>
'app\\plugins\\coupon\\Hook'
,
),
'plugins_view_buy_form_inside'
=>
array
(
0
=>
'app\\plugins\\coupon\\Hook'
,
),
'plugins_service_buy_order_insert_success'
=>
array
(
0
=>
'app\\plugins\\coupon\\Hook'
,
),
'plugins_service_user_register_end'
=>
array
(
0
=>
'app\\plugins\\coupon\\Hook'
,
),
'plugins_view_common_bottom'
=>
array
(
...
...
config/shopxo.sql
浏览文件 @
61db8092
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
extend/payment/BaiduMini.php
浏览文件 @
61db8092
...
...
@@ -111,14 +111,8 @@ class BaiduMini
'message'
=>
'请填写平台公钥'
,
],
[
'element'
=>
'input'
,
'type'
=>
'text'
,
'default'
=>
__MY_URL__
.
'payment_order_'
.
strtolower
(
str_replace
([
'payment'
,
'\\'
],
''
,
get_class
(
$this
)))
.
'_notify.php'
,
'name'
=>
'notify_url'
,
'placeholder'
=>
'异步通知地址'
,
'title'
=>
'异步通知地址'
,
'desc'
=>
'将该地址配置到百度小程序支付后台异步通知'
,
'is_required'
=>
0
,
'element'
=>
'message'
,
'message'
=>
'异步通知地址,将该地址配置到百度小程序支付后台异步通知<br />'
.
__MY_URL__
.
'payment_order_'
.
strtolower
(
str_replace
([
'payment'
,
'\\'
],
''
,
get_class
(
$this
)))
.
'_notify.php'
,
],
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录