dever 3 роки тому
батько
коміт
3420e5dace
1 змінених файлів з 7 додано та 4 видалено
  1. 7 4
      app/mshop/lib/Buy.php

+ 7 - 4
app/mshop/lib/Buy.php

@@ -986,9 +986,13 @@ class Buy
                 # 门店结算单
                 $cash_order = Dever::db('cash/order')->select(array('type' => $info['type'], 'type_id' => $info['type_id'], 'source_order_id' => $info['id']));
 
+                $col = 'cash';
+
             } elseif ($type == 2) {
                 # 工厂结算单
                 $cash_order = Dever::db('cash/order')->select(array('source_type' => $info['source_type'], 'source_id' => $info['source_id'], 'source_order_id' => $info['id']));
+
+                $col = 'p_cash';
             }
         }
         
@@ -1006,7 +1010,7 @@ class Buy
                 $cdate = date('Y-m-d H:i', $v['cdate']);
                 $fdate = $v['fdate'] ? date('Y-m-d H:i', $v['fdate']) : '';
                 $operdate = $v['operdate'] ? date('Y-m-d H:i', $v['operdate']) : '';
-                $cash = $v['cash'];
+                $cash = $v[$col];
 
                 $url = Dever::url('project/database/list?project=shop&table=buy_order_goods&order_id='.$v['source_order_id'].'&page_type=1', 'manage');
                 $v['source_order_num'] = '<a href="'.$url.'" style="color:blue">'.$v['source_order_num'].'</a>';
@@ -1325,9 +1329,8 @@ class Buy
         $where['type_id'] = $type_id;
         $where['source_type'] = $source_type;
         $where['source_id'] = $source_id;
-        $where['r'] = $goods_id;
+        $where['r'] = $goods_id . '_' . microtime() . '_' . mt_rand(1, 10000);
         $info = Dever::db('shop/buy_order')->find($where);
-
         if (!$info) {
             $this->order_num++;
             $data = $where;
@@ -1363,7 +1366,7 @@ class Buy
                 Dever::db('shop/buy_order_goods')->insert($goods);
             }
 
-            //$state = $this->updateSell($source_type, $source_id, $goods_id, $sku_id, $num);
+            $state = $this->updateSell($source_type, $source_id, $goods_id, $sku_id, $num);
 
             return $id;
         }