rabin 3 years ago
parent
commit
7a11014172
1 changed files with 30 additions and 4 deletions
  1. 30 4
      app/card/src/Api.php

+ 30 - 4
app/card/src/Api.php

@@ -290,6 +290,7 @@ class Api extends Core
                 $cur_city = $county['city_id'];
             }
         }
+        $config_type = Dever::db('shop/info')->config['config_type'];
 
         $card = Dever::db('card/code')->getData(array('dh_uid' => $this->uid));
 
@@ -318,8 +319,11 @@ class Api extends Core
                 if ($goods || $v['info']['category']) {
                     $check = true;
                 }
+                $v['minfo'] = '';
+                $v['cinfo'] = '';
 
                 if ($check) {
+                    $v['cinfo'] = '限部分要求商品可用';
                     $price = 0;
                     $v['info']['category'] = explode(',', $v['info']['category']);
                     if ($goods) {
@@ -358,7 +362,17 @@ class Api extends Core
                     $v['type'] = $type = Dever::db('card/type')->find($v['info']['type_id']);
 
                     $type['shop_type'] = explode(',', $type['shop_type']);
+
+                    $v['minfo'] = array();
+                    foreach ($type['shop_type'] as $tv) {
+                        if (isset($config_type[$tv])) {
+                            $v['minfo'][] = $config_type[$tv];
+                        }
+                    }
+                    $v['minfo'] = implode(',', $v['info']) . '可用';
+                    
                     if (in_array($shop_type, $type['shop_type'])) {
+                        
                         if ($type['city_type'] == 1) {
                             $this->data['card'][] = $v;
                         } else {
@@ -369,11 +383,17 @@ class Api extends Core
                                     $city = $card_order['city'];
                                 }
                             }
-                            if ($city && $city == $cur_city) {
-                                $this->data['card'][] = $v;
+                            if ($city) {
+                                $v['minfo'] = '仅限' . $city['name'] . '可用';
+                                if ($city == $cur_city) {
+                                    $this->data['card'][] = $v;
+                                } else {
+                                    $this->data['no_card'][] = $v;
+                                }
                             } else {
                                 $this->data['no_card'][] = $v;
                             }
+                            
                             /*
                             $type['city'] = explode(',', $type['city']);
                             if (in_array($city, $type['city'])) {
@@ -381,8 +401,14 @@ class Api extends Core
                             }
                             */
                         }
-                    } elseif ($v['shop_id'] && $v['shop_id'] == $this->shop_id) {
-                        $this->data['card'][] = $v;
+                    } elseif ($v['shop_id']) {
+                        $shop = Dever::db('shop/info')->find($v['shop_id']);
+                        $v['minfo'] = '限' . $shop['name'] . '可用';
+                        if ($v['shop_id'] == $this->shop_id) {
+                            $this->data['card'][] = $v;
+                        } else {
+                            $this->data['no_card'][] = $v;
+                        }
                     } else {
                         $this->data['no_card'][] = $v;
                     }