From 00c44c0e101f4bfa7a50e7771e09500772659e92 Mon Sep 17 00:00:00 2001 From: devil_gong Date: Mon, 26 Nov 2018 17:00:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alipay/pages/user/user.js | 2 +- .../Service/OrderService.class.php | 35 +++++++++++-------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/alipay/pages/user/user.js b/alipay/pages/user/user.js index aaa03d26a..b4c5198ff 100755 --- a/alipay/pages/user/user.js +++ b/alipay/pages/user/user.js @@ -117,7 +117,7 @@ Page({ user_order_status_list: temp_user_order_status_list, customer_service_tel: data.customer_service_tel || null, common_user_center_notice: data.common_user_center_notice || null, - avatar: (data.avatar != null) ? data.avatar : app.data.default_user_head_src, + avatar: (data.avatar != null) ? data.avatar : ((this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar), nickname: (data.nickname != null) ? data.nickname : this.data.nickname, message_total: ((data.common_message_total || 0) == 0) ? 0 : data.common_message_total, head_nav_list: temp_head_nav_list, diff --git a/service/Application/Service/OrderService.class.php b/service/Application/Service/OrderService.class.php index a70dc873c..e657731b6 100755 --- a/service/Application/Service/OrderService.class.php +++ b/service/Application/Service/OrderService.class.php @@ -1223,6 +1223,18 @@ class OrderService */ public static function OrderStatusStepTotal($params = []) { + // 状态数据封装 + $result = []; + $order_status_list = L('common_order_user_status'); + foreach(L('common_order_user_status') as $v) + { + $result[] = [ + 'name' => $v['name'], + 'status' => $v['id'], + 'count' => 0, + ]; + } + // 用户类型 $user_type = isset($params['user_type']) ? $params['user_type'] : ''; @@ -1238,27 +1250,20 @@ class OrderService break; } - // 新增用户条件 - if($user_type == 'user' && !empty($params['user'])) + // 用户条件 + if($user_type == 'user') { - $where['user_id'] = $params['user']['id']; + if(!empty($params['user'])) + { + $where['user_id'] = $params['user']['id']; + } else { + return $result; + } } $field = 'COUNT(DISTINCT id) AS count, status'; $data = M('Order')->where($where)->field($field)->group('status')->select(); - // 状态数据封装 - $result = []; - $order_status_list = L('common_order_user_status'); - foreach(L('common_order_user_status') as $v) - { - $result[] = [ - 'name' => $v['name'], - 'status' => $v['id'], - 'count' => 0, - ]; - } - // 数据处理 if(!empty($data)) { -- GitLab