rabin 2 years ago
parent
commit
7dc2c8c15d

+ 1 - 0
app/cash/database/factory.php

@@ -200,6 +200,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'order' => array('id' => 'desc'),
             'page' => array(10, 'list'),
             'col' => '*',
         ),

+ 10 - 0
app/cash/database/order.php

@@ -403,6 +403,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'one',
+            'order' => array('id' => 'desc'),
             'col' => 'sum(num) as total',
         ),
 
@@ -423,6 +424,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'one',
+            'order' => array('id' => 'desc'),
             'col' => 'sum(cash) as total',
         ),
 
@@ -443,6 +445,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'one',
+            'order' => array('id' => 'desc'),
             'col' => 'sum(p_cash) as total',
         ),
 
@@ -462,6 +465,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'order' => array('id' => 'desc'),
             'page' => array(10, 'list'),
             'col' => '*',
         ),
@@ -482,6 +486,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'order' => array('id' => 'desc'),
             'page' => array(10, 'list'),
             'col' => '*',
         ),
@@ -502,6 +507,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'order' => array('id' => 'desc'),
             'col' => '*',
         ),
 
@@ -521,6 +527,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'order' => array('id' => 'desc'),
             'col' => '*',
         ),
 
@@ -539,6 +546,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'order' => array('id' => 'desc'),
             'col' => '*',
         ),
         
@@ -559,6 +567,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'order' => array('id' => 'desc'),
             'col' => '*',
         ),
         'getCardAll' => array
@@ -575,6 +584,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'one',
+            'order' => array('id' => 'desc'),
             'col' => 'sum(cash) as cash',
         ),
     ),

+ 1 - 0
app/cash/database/shop.php

@@ -204,6 +204,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'order' => array('id' => 'desc'),
             'page' => array(10, 'list'),
             'col' => '*',
         ),

+ 1 - 0
app/cash/database/shop_sell.php

@@ -204,6 +204,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'order' => array('id' => 'desc'),
             'page' => array(10, 'list'),
             'col' => '*',
         ),

+ 1 - 0
app/cash/database/store.php

@@ -200,6 +200,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'all',
+            'order' => array('id' => 'desc'),
             'page' => array(10, 'list'),
             'col' => '*',
         ),

+ 40 - 0
app/goods/lib/Info.php

@@ -568,6 +568,29 @@ class Info
             if (!$info['attr']) {
                 $info['price_type'] = 1;
             }
+        } else {
+            if ($other) {
+                foreach ($other[1] as $k1 => $v1) {
+                    $v[$v1] = isset($other[0][-1][$v1]) ? $other[0][-1][$v1] : 0;
+                    if ($v1 == 'price_id' && $v[$v1] > 0) {
+                        $price_template = Dever::load('price/lib/data')->get($info['id'], -1, $v[$v1]);
+                        if ($price_template) {
+                            if (Dever::config('base')->buy && Dever::config('base')->buy == 1) {
+                                if ($price_template['price_num'] > 0) {
+                                    $info['min'] = $price_template['price_num'];
+                                }
+                                if ($price_template['price_buy'] && $price_template['price_buy'] > 0) {
+                                    $info['f_price'] = $price_template['price_buy'];
+                                }
+                            } else {
+                                if ($price_template['price_sell'] && $price_template['price_sell'] > 0) {
+                                    $info['price'] = $price_template['price_sell'];
+                                }
+                            }
+                        }
+                    }
+                }
+            }
         }
        
         if (isset($info['cdate']) && $info['cdate']) {
@@ -743,6 +766,23 @@ class Info
                     if ($other) {
                         foreach ($other[1] as $k1 => $v1) {
                             $v[$v1] = isset($other[0][$v['id']][$v1]) ? $other[0][$v['id']][$v1] : 0;
+                            if ($v1 == 'price_id' && $v[$v1] > 0) {
+                                $price_template = Dever::load('price/lib/data')->get($v['info_id'], $v['id'], $v[$v1]);
+                                if ($price_template) {
+                                    if (Dever::config('base')->buy && Dever::config('base')->buy == 1) {
+                                        if ($price_template['price_num'] > 0) {
+                                            $v['min'] = $price_template['price_num'];
+                                        }
+                                        if ($price_template['price_buy'] && $price_template['price_buy'] > 0) {
+                                            $v['price'] = $price_template['price_buy'];
+                                        }
+                                    } else {
+                                        if ($price_template['price_sell'] && $price_template['price_sell'] > 0) {
+                                            $v['price'] = $price_template['price_sell'];
+                                        }
+                                    }
+                                }
+                            }
                         }
                     }
                     if ($v['type'] == 1) {

+ 3 - 2
app/shop/lib/Info.php

@@ -327,9 +327,10 @@ class Info
                 return false;
             }
         }
-        $other_array = array('total', 'min');
+        $other_array = array('total', 'min', 'price_id');
         if (Dever::config('base')->buy && Dever::config('base')->buy == 1) {
-            $other_array = array('total');
+            # 购买不需要读取goods_sku的min
+            $other_array = array('total', 'price_id');
         }
         
         $data = Dever::load('goods/lib/info')->getInfo($info, $attr, array($other, $other_array));