提交 f5476fe6 编写于 作者: D devil_gong

订单逻辑优化

上级 7a3e9868
......@@ -629,12 +629,16 @@ class BuyService
// price 金额
// type 类型(0减少, 1增加)
// tips 提示信息
// business 业务类型(内容格式不限)
// ext 扩展数据(内容格式不限)
$extension_data = [
// [
// 'name' => '感恩节9折',
// 'price' => 23,
// 'type' => 0,
// 'tips' => '-¥23元'
// 'name' => '感恩节9折',
// 'price' => 23,
// 'type' => 0,
// 'tips' => '-¥23元',
// 'business' => null,
// 'ext' => null,
// ],
];
......@@ -829,6 +833,20 @@ class BuyService
$order['confirm_time'] = time();
}
// 订单添加前钩子
$hook_name = 'plugins_service_buy_order_insert_begin';
$ret = Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'order' => &$order,
'params' => $params,
]);
if(isset($ret['code']) && $ret['code'] != 0)
{
return $ret;
}
// 开始事务
Db::startTrans();
......@@ -886,9 +904,22 @@ class BuyService
// 删除购物车
self::BuyCartDelete($params);
// 获取数据库订单信息
$order = Db::name('Order')->find($order_id);
// 订单添加成功钩子, 不校验返回值
$hook_name = 'plugins_service_buy_order_insert_success';
Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'order_id' => $order_id,
'order' => $order,
'params' => $params,
]);
// 返回信息
$result = [
'order' => Db::name('Order')->find($order_id),
'order' => $order,
'jump_url' => MyUrl('index/order/index'),
];
......
......@@ -595,7 +595,7 @@ class PaymentService
// 权限
if(!is_writable($file))
{
return DataReturn('没操作权限', -3);
return DataReturn('没操作权限['.$file.']', -3);
}
// 删除
......
......@@ -61,5 +61,13 @@ return array (
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',
),
);
?>
\ No newline at end of file
......@@ -47,12 +47,12 @@ table.data-list .base-operate { border-top: 1px dashed #eee; }
/* 进行中 */
table.data-ongoing { border: 1px solid #fff1f5; }
table.data-ongoing td.row-number, table.data-ongoing td.row-total-price, table.data-ongoing td.row-status, table.data-ongoing td.row-operate { border-right: 1px solid #fff1f5; }
table.data-ongoing td { border-bottom:1px solid #fff1f5; }
table.data-ongoing .content-hd td { background: #fff1f5; border-bottom-color:#fff1f5; }
table.data-ongoing:hover { box-shadow:0 1px 1px #ffd6e2; background:#fffbfc; }
table.data-ongoing .base-operate { border-top: 1px dashed #fff1f5; }
table.data-ongoing { border: 1px solid #daf3ff; }
table.data-ongoing td.row-number, table.data-ongoing td.row-total-price, table.data-ongoing td.row-status, table.data-ongoing td.row-operate { border-right: 1px solid #daf3ff; }
table.data-ongoing td { border-bottom:1px solid #daf3ff; }
table.data-ongoing .content-hd td { background: #eaf8ff; border-bottom-color:#daf3ff; }
table.data-ongoing:hover { box-shadow:0 1px 1px #aed8ff; background:#f7fdff; }
table.data-ongoing .base-operate { border-top: 1px dashed #daf3ff; }
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册