From f63e13896d167dca31a053a9f2a08fe9fc93e8d8 Mon Sep 17 00:00:00 2001 From: devil_gong Date: Tue, 3 Dec 2019 17:16:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/view/default/order/index.html | 2 +- application/service/BuyService.php | 34 ++++++++++++++---- extend/payment/Weixin.php | 8 ++--- public/static/admin/default/css/order.css | 5 --- public/static/common/css/common.css | 8 +++-- public/static/index/default/css/common.css | 35 +++++++++++++++++-- 6 files changed, 71 insertions(+), 21 deletions(-) diff --git a/application/admin/view/default/order/index.html b/application/admin/view/default/order/index.html index d77b7a158..caa4fc27c 100755 --- a/application/admin/view/default/order/index.html +++ b/application/admin/view/default/order/index.html @@ -461,7 +461,7 @@ {{/if}} {{if $v['status'] eq 2}} {{if $v['order_model'] eq 2}} - + {{else /}} {{/if}} diff --git a/application/service/BuyService.php b/application/service/BuyService.php index 4a226dbcd..0c99c95c3 100755 --- a/application/service/BuyService.php +++ b/application/service/BuyService.php @@ -871,6 +871,7 @@ class BuyService } // 销售型,自提点 地址处理 + $address = []; if(in_array($common_site_type, [0, 2])) { if(empty($buy['data']['base']['address'])) @@ -909,6 +910,7 @@ class BuyService 'hook_name' => $hook_name, 'is_backend' => true, 'order' => &$order, + 'goods' => &$buy['data']['goods'], 'params' => $params, ])); @@ -934,7 +936,7 @@ class BuyService return $ret; } - // 自提模式 - 虚拟信息添加 + // 订单模式 - 虚拟信息添加 if($common_site_type == 3) { $ret = self::OrderFictitiousValueInsert($order_id, $detail_ret['data'], $params['user']['id'], $v['goods_id']); @@ -989,15 +991,30 @@ class BuyService } } + // 订单添加成功钩子 + $hook_name = 'plugins_service_buy_order_insert_end'; + $ret = HookReturnHandle(Hook::listen($hook_name, [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'order_id' => $order_id, + 'order' => $order, + 'goods' => $buy['data']['goods'], + 'address' => $address, + 'params' => $params, + ])); + if(isset($ret['code']) && $ret['code'] != 0) + { + // 事务回滚 + Db::rollback(); + return $ret; + } + // 订单提交成功 Db::commit(); // 删除购物车 self::BuyCartDelete($params); - // 获取数据库订单信息 - $order = Db::name('Order')->find($order_id); - // 订单添加成功钩子, 不校验返回值 $hook_name = 'plugins_service_buy_order_insert_success'; Hook::listen($hook_name, [ @@ -1005,9 +1022,14 @@ class BuyService 'is_backend' => true, 'order_id' => $order_id, 'order' => $order, + 'goods' => $buy['data']['goods'], + 'address' => $address, 'params' => $params, ]); + // 获取数据库订单信息 + $order = Db::name('Order')->find($order_id); + // 返回信息 $result = [ 'order' => $order, @@ -1070,7 +1092,7 @@ class BuyService // 订单详情添加前钩子 $hook_name = 'plugins_service_buy_order_detail_insert_begin'; - $ret = HHookReturnHandle(ook::listen($hook_name, [ + $ret = HookReturnHandle(Hook::listen($hook_name, [ 'hook_name' => $hook_name, 'is_backend' => true, 'user_id' => $user_id, @@ -1212,7 +1234,7 @@ class BuyService ]; // 订单地址添加前钩子 - $hook_name = 'plugins_service_buy_order_receive_address_insert_begin'; + $hook_name = 'plugins_service_buy_order_address_insert_begin'; $ret = HookReturnHandle(Hook::listen($hook_name, [ 'hook_name' => $hook_name, 'is_backend' => true, diff --git a/extend/payment/Weixin.php b/extend/payment/Weixin.php index 17cde719a..7bb6b9839 100755 --- a/extend/payment/Weixin.php +++ b/extend/payment/Weixin.php @@ -530,7 +530,7 @@ class Weixin // 请求接口处理 $result = $this->XmlToArray($this->HttpRequest('https://api.mch.weixin.qq.com/secapi/pay/refund', $this->ArrayToXml($data), true)); - if(!empty($result['return_code']) && $result['return_code'] == 'SUCCESS' && !empty($result['return_msg']) && $result['return_msg'] == 'OK') + if(isset($result['result_code']) && $result['result_code'] == 'SUCCESS' && isset($result['return_code']) && $result['return_code'] == 'SUCCESS') { // 统一返回格式 $data = [ @@ -542,10 +542,10 @@ class Weixin ]; return DataReturn('退款成功', 0, $data); } - $msg = is_string($result) ? $result : (empty($result['return_msg']) ? '退款接口异常' : $result['return_msg']); - if(!empty($result['err_code_des'])) + $msg = is_string($result) ? $result : (empty($result['err_code_des']) ? '退款接口异常' : $result['err_code_des']); + if(!empty($result['return_msg'])) { - $msg .= '-'.$result['err_code_des']; + $msg .= '-'.$result['return_msg']; } return DataReturn($msg, -1); } diff --git a/public/static/admin/default/css/order.css b/public/static/admin/default/css/order.css index 7b5250644..02bd681e5 100755 --- a/public/static/admin/default/css/order.css +++ b/public/static/admin/default/css/order.css @@ -14,11 +14,6 @@ .am-table .goods-item:not(:last-child), .am-table .order-no { border-bottom: 1px solid #eee; } .am-table .order-no { font-weight: 700; color: #333;} -/** - * 弹窗 - */ -form.am-form .am-form-group { padding-right: 5px; } - /** * 业务弹窗 diff --git a/public/static/common/css/common.css b/public/static/common/css/common.css index b4c8a4c45..0b702124f 100755 --- a/public/static/common/css/common.css +++ b/public/static/common/css/common.css @@ -83,9 +83,6 @@ iframe { width: 100%; height: 100%; border: 0; } border-bottom: 1px dashed #ccc; padding: 10px 20% 10px 5px; } - .am-popup .am-form-group, .business-form-block { - padding: 10px 5px !important; - } form.am-form .am-form-group-refreshing, .plug-file-upload-view, .content-app-items { border-bottom: 0px; } @@ -93,6 +90,11 @@ iframe { width: 100%; height: 100%; border: 0; } background: none; } + /* 弹窗 */ + .am-popup .am-form-group, .am-modal form.am-form .am-form-group, .business-form-block { + padding: 10px 5px !important; + } + /* 地址联动 */ .region-linkage select { width: 33%; display: -webkit-inline-box; } diff --git a/public/static/index/default/css/common.css b/public/static/index/default/css/common.css index 5692b8145..f306325be 100755 --- a/public/static/index/default/css/common.css +++ b/public/static/index/default/css/common.css @@ -610,9 +610,40 @@ ul.am-dropdown-content > .am-active > a:focus, } .am-pagination > .am-active > a, .am-pagination > .am-active > a:hover { background-color: #d13b49; border-color: #d13b49; } -.am-popup-bd { padding: 5px; background: none; } +.am-popup-bd { + padding: 5px; + background: none; } -.am-badge { padding: 0.25em 0.5em;} +.am-badge { + padding: 0.25em 0.5em; +} + +/** + * tabs + */ +.am-tabs-d2 { + margin: 0; +} +.am-tabs-d2 .am-tabs-nav a { + text-decoration: none; +} +.am-tabs-d2 .am-tabs-nav > .am-active { + border-bottom: 2px solid #ed5563; + background-color: #fff1f5; +} +.am-tabs-d2 .am-tabs-nav > .am-active a { + color: #d2364c; +} +.am-tabs-d2 .am-tabs-nav > .am-active:after { + border-bottom-color: #ed5563; +} +.am-tabs-d2 .am-tabs-bd { + border: none; + z-index: 0; +} +.am-tabs-d2 .am-tabs-bd .am-tab-panel { + padding: 0; +} /**