From f5476fe6e684b7c8ed464f6cb556a6397deecd08 Mon Sep 17 00:00:00 2001 From: devil_gong Date: Wed, 14 Aug 2019 19:29:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/BuyService.php | 41 ++++++++++++++++++++--- application/service/PaymentService.php | 2 +- application/tags.php | 8 +++++ public/static/index/default/css/order.css | 12 +++---- 4 files changed, 51 insertions(+), 12 deletions(-) diff --git a/application/service/BuyService.php b/application/service/BuyService.php index dfb737231..ea00b5321 100755 --- a/application/service/BuyService.php +++ b/application/service/BuyService.php @@ -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'), ]; diff --git a/application/service/PaymentService.php b/application/service/PaymentService.php index fac493834..8f908dd4a 100755 --- a/application/service/PaymentService.php +++ b/application/service/PaymentService.php @@ -595,7 +595,7 @@ class PaymentService // 权限 if(!is_writable($file)) { - return DataReturn('没操作权限', -3); + return DataReturn('没操作权限['.$file.']', -3); } // 删除 diff --git a/application/tags.php b/application/tags.php index 5efab3726..ca41d73d4 100755 --- a/application/tags.php +++ b/application/tags.php @@ -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 diff --git a/public/static/index/default/css/order.css b/public/static/index/default/css/order.css index 81dab9660..d3d056ec8 100755 --- a/public/static/index/default/css/order.css +++ b/public/static/index/default/css/order.css @@ -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; } /**