订单逻辑优化
parent
7a3e9868be
commit
f5476fe6e6
|
|
@ -629,12 +629,16 @@ class BuyService
|
||||||
// price 金额
|
// price 金额
|
||||||
// type 类型(0减少, 1增加)
|
// type 类型(0减少, 1增加)
|
||||||
// tips 提示信息
|
// tips 提示信息
|
||||||
|
// business 业务类型(内容格式不限)
|
||||||
|
// ext 扩展数据(内容格式不限)
|
||||||
$extension_data = [
|
$extension_data = [
|
||||||
// [
|
// [
|
||||||
// 'name' => '感恩节9折',
|
// 'name' => '感恩节9折',
|
||||||
// 'price' => 23,
|
// 'price' => 23,
|
||||||
// 'type' => 0,
|
// 'type' => 0,
|
||||||
// 'tips' => '-¥23元'
|
// 'tips' => '-¥23元',
|
||||||
|
// 'business' => null,
|
||||||
|
// 'ext' => null,
|
||||||
// ],
|
// ],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -829,6 +833,20 @@ class BuyService
|
||||||
$order['confirm_time'] = time();
|
$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();
|
Db::startTrans();
|
||||||
|
|
||||||
|
|
@ -886,9 +904,22 @@ class BuyService
|
||||||
// 删除购物车
|
// 删除购物车
|
||||||
self::BuyCartDelete($params);
|
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 = [
|
$result = [
|
||||||
'order' => Db::name('Order')->find($order_id),
|
'order' => $order,
|
||||||
'jump_url' => MyUrl('index/order/index'),
|
'jump_url' => MyUrl('index/order/index'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -595,7 +595,7 @@ class PaymentService
|
||||||
// 权限
|
// 权限
|
||||||
if(!is_writable($file))
|
if(!is_writable($file))
|
||||||
{
|
{
|
||||||
return DataReturn('没操作权限', -3);
|
return DataReturn('没操作权限['.$file.']', -3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
|
|
|
||||||
|
|
@ -61,5 +61,13 @@ return array (
|
||||||
array (
|
array (
|
||||||
0 => 'app\\plugins\\coupon\\Hook',
|
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',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
|
@ -47,12 +47,12 @@ table.data-list .base-operate { border-top: 1px dashed #eee; }
|
||||||
|
|
||||||
|
|
||||||
/* 进行中 */
|
/* 进行中 */
|
||||||
table.data-ongoing { border: 1px solid #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 #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 #daf3ff; }
|
||||||
table.data-ongoing td { border-bottom:1px solid #fff1f5; }
|
table.data-ongoing td { border-bottom:1px solid #daf3ff; }
|
||||||
table.data-ongoing .content-hd td { background: #fff1f5; border-bottom-color:#fff1f5; }
|
table.data-ongoing .content-hd td { background: #eaf8ff; border-bottom-color:#daf3ff; }
|
||||||
table.data-ongoing:hover { box-shadow:0 1px 1px #ffd6e2; background:#fffbfc; }
|
table.data-ongoing:hover { box-shadow:0 1px 1px #aed8ff; background:#f7fdff; }
|
||||||
table.data-ongoing .base-operate { border-top: 1px dashed #fff1f5; }
|
table.data-ongoing .base-operate { border-top: 1px dashed #daf3ff; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue