rabin 1 year ago
parent
commit
c8fc42afa1
3 changed files with 34 additions and 1 deletions
  1. 16 0
      src/dai/seller/api/Manage.php
  2. 17 0
      src/yuan/goods/api/Manage.php
  3. 1 1
      src/yuan/goods/lib/Manage.php

+ 16 - 0
src/dai/seller/api/Manage.php

@@ -129,12 +129,28 @@ class Manage extends Auth
             $option = array();
             foreach ($sku as $k => $v) {
                 if ($v['key'] != -1) {
+                    /*
                     $spec = Dever::db('info_spec_value', 'goods')->find(array('id' => array('in', $v['key'])), array('col' => 'id,group_concat(value) as name', 'group' => 'info_id'));
                     if ($spec) {
                         $spec['id'] = $v['id'];
                         $result['sku_id']['value'] = $v['id'];
                         $option[] = $spec;
+                    }*/
+
+                    $spec = Dever::db('info_spec_value', 'goods')->select(array('id' => array('in', $v['key'])));
+
+                    if ($spec) {
+                        $spec_value = $spec[0];
+                        $spec_name = array();
+                        foreach ($spec as $k3 => $v3) {
+                            $spec_name[] = $v3['value'];
+                        }
+                        $spec_value['name'] = implode(',', $spec_name);
+                        $spec_value['id'] = $v['id'];
+                        $result['sku_id']['value'] = $v['id'];
+                        $option[] = $spec_value;
                     }
+
                 } else {
                     $result['sku_id']['value'] = $v['id'];
                     $option[0] = array

+ 17 - 0
src/yuan/goods/api/Manage.php

@@ -67,6 +67,7 @@ class Manage extends Auth
             }
             foreach ($sku as $k => $v) {
                 if ($v['key'] != -1) {
+                    /*
                     $spec = Dever::db('info_spec_value', 'goods')->find(array('id' => array('in', $v['key'])), array('col' => 'id,group_concat(value) as name', 'group' => 'info_id'));
                     if ($spec) {
                         $spec['id'] = $v['id'];
@@ -74,6 +75,22 @@ class Manage extends Auth
                             $result['sku_id']['value'] = $v['id'];
                         }
                         $option[] = $spec;
+                    }*/
+
+                    $spec = Dever::db('info_spec_value', 'goods')->select(array('id' => array('in', $v['key'])));
+
+                    if ($spec) {
+                        $spec_value = $spec[0];
+                        $spec_name = array();
+                        foreach ($spec as $k3 => $v3) {
+                            $spec_name[] = $v3['value'];
+                        }
+                        $spec_value['name'] = implode(',', $spec_name);
+                        $spec_value['id'] = $v['id'];
+                        if (!$set) {
+                            $result['sku_id']['value'] = $v['id'];
+                        }
+                        $option[] = $spec_value;
                     }
                 } else {
                     $result['sku_id']['value'] = $v['id'];

+ 1 - 1
src/yuan/goods/lib/Manage.php

@@ -86,7 +86,7 @@ class Manage extends Auth
                                     $spec_name[] = $v3['value'];
                                 }
                                 $spec_value['name'] = implode(',', $spec_name);
-                                $spec['id'] = $v2['id'];
+                                $spec_value['id'] = $v2['id'];
                                 $option[] = $spec_value;
                             }
                             /*