Gorden 2 месяцев назад
Родитель
Сommit
5a73b1f8b3
1 измененных файлов с 17 добавлено и 14 удалено
  1. 17 14
      app/admin/controller/order/WholeController.php

+ 17 - 14
app/admin/controller/order/WholeController.php

@@ -4395,10 +4395,13 @@ class WholeController extends Curd
                 $payDetail0 = $payDetails[0];
                 $payTimes = $payDetail0['pay_paytimes'];
             }
-            if ($item['member']['member_mobile'] == '0000') {
+            if (!empty($item['member']) && $item['member']['member_mobile'] == '0000') {
                 $memberName = '散客';
             } else {
-                $memberName = (!empty($item['cert']) ? $item['cert']['member_cert_name'] : substr($item['member']['member_mobile'], -4) . '用户') . '-' . $item['member']['member_mobile'];
+                $memberName = !empty($item['cert']) ? $item['cert']['member_cert_name'] : (!empty($item['member']) ? (substr($item['member']['member_mobile'], -4) . '用户' . '-') : '');
+                if (!empty($item['member'])) {
+                    $memberName .= $item['member']['member_mobile'];
+                }
             }
             $data[$key] = [
                 'goods_classify' => !empty($goodsClassify) && isset(self::$goodsClassify[$goodsClassify]) ? self::$goodsClassify[$goodsClassify] : '其他订单',
@@ -4639,32 +4642,32 @@ class WholeController extends Curd
             }
         ])->where('join_appointment_order_id', $orderId)
             ->where('appointment_status', 'DONE')
-            ->select('join_appointment_member_id', 'join_appointment_goods_id','appointment_done_datetime','appointment_done_json');
+            ->select('join_appointment_member_id', 'join_appointment_goods_id', 'appointment_done_datetime', 'appointment_done_json');
         $total = $appointments->count();
         $rows = $appointments->forPage($page, $pageSize)
             ->orderBy('appointment_done_datetime', 'DESC')
             ->get();
-        foreach ($rows as &$item){
+        foreach ($rows as &$item) {
             $memberMobile = '';
-            if (!empty($item['member']) && !empty($item['member']['member_mobile'])){
+            if (!empty($item['member']) && !empty($item['member']['member_mobile'])) {
                 $memberMobile = $item['member']['member_mobile'];
             }
             $memberNickname = '';
-            if (!empty($item['member_info']) && !empty($item['member_info']['member_info_nickname'])){
+            if (!empty($item['member_info']) && !empty($item['member_info']['member_info_nickname'])) {
                 $memberNickname = $item['member_info']['member_info_nickname'];
             }
             $memberName = '';
-            if (!empty($item['cert']) && !empty($item['cert']['member_cert_name'])){
+            if (!empty($item['cert']) && !empty($item['cert']['member_cert_name'])) {
                 $memberName = $item['cert']['member_cert_name'];
             }
-            unset($item['member'],$item['member_info'],$item['cert']);
-            $item['member_name'] = MemberService::getMemberName($memberMobile,$memberName,$memberNickname);
-            if (!empty($item['appointment_done_json'])){
-                $doneJson = json_decode($item['appointment_done_json'],true);
-                if (isset($doneJson['charge']) && !empty($doneJson['charge']['charge_user_id'])){
-                    $item['username'] = SysUser::where('user_id',$doneJson['charge']['charge_user_id'])->value('user_name');
+            unset($item['member'], $item['member_info'], $item['cert']);
+            $item['member_name'] = MemberService::getMemberName($memberMobile, $memberName, $memberNickname);
+            if (!empty($item['appointment_done_json'])) {
+                $doneJson = json_decode($item['appointment_done_json'], true);
+                if (isset($doneJson['charge']) && !empty($doneJson['charge']['charge_user_id'])) {
+                    $item['username'] = SysUser::where('user_id', $doneJson['charge']['charge_user_id'])->value('user_name');
                 }
-                if (isset($doneJson['charge']) && !empty($doneJson['charge']['charge_premises'])){
+                if (isset($doneJson['charge']) && !empty($doneJson['charge']['charge_premises'])) {
                     $item['premise'] = $doneJson['charge']['charge_premises'];
                 }
                 $item['nbr'] = 1;