wugg 1 year ago
parent
commit
10c05efbff

+ 2 - 0
app/admin/controller/OrderOutChild.php

@@ -605,6 +605,8 @@ class OrderOutChild extends Base
                         'post_code' => $order_out[$child[$value['outChildCode']]['outCode']]['post_code'],
                         'post_fee' => $order_out[$child[$value['outChildCode']]['outCode']]['post_fee'],
                     	'updatetime' => $date,
+                    	'send_uid' => $this->uid,
+                    	'send_uname' => $this->uname,
                     	'sendtime' => $date
                     	 ]);
 				if($our_up==false) throw new \Exception("发货单更新失败");

+ 11 - 3
app/admin/controller/ReorderChild.php

@@ -711,11 +711,19 @@ class ReorderChild extends Base
             //维护bn
             if ($info['order_out_status'] == 1) {
                 //待发货,说明此时有库存,有bn号
-                Db::name('child_bn')
+                $bcn =  Db::name('child_bn')->where(['orderCode' => $info['orderCode'], 'outCode' =>
+                $info['outCode'], 'childCode' => $info['outChildCode']])->findOrEmpty();
+                if(!empty($bcn)){
+                	 Db::name('child_bn')
                     ->data(['updatetime' => $date])
-                    ->where(['orderCode' => $info['orderCode'], 'outCode' => $info['outCode'], 'childCode' => $info['outChildCode']])
-                    ->inc('num', $info['return_num'])
+                    ->where($bcn)
+                    ->dec('num', $info['return_num'])
                     ->update();
+                	 Db::name("good_stock_info")->where(["bnCode"=>$bcn['bnCode']])
+                	 ->dec("used_num",$info['return_num'])
+                	 ->inc("balance_num",$info['return_num'])->update();
+                }
+               
                 Db::name('good_stock')
                     ->data(['updatetime' => $date])
                     ->where(['is_del' => 0, 'spuCode' => $info['spuCode'], 'wsm_code' => $info['return_wsm_code']])

+ 10 - 4
app/admin/controller/SaleReport.php

@@ -1529,11 +1529,12 @@ class SaleReport extends Base
     //【五、退货明细表】
     public function thData()
     {
-        $param = $this->request->only(['token', 'start_date' => '', 'end_date' => '', 'page' => 1, 'size' => 15], 'post', 'trim');
+        $param = $this->request->only(['token', 'start_date' => '',"companyNo"=>"", 'end_date' => '', 'page' => 1, 'size'
+        => 15],  'post', 'trim');
 
         $where = [['thd.is_del', '=', 0]];
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['thd.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
-
+		if($param['companyNo'] != '') $where[] = ["s.supplierNo","=",$param['companyNo']];
         $count = Db::name('th_data')
             ->alias('thd')
             ->leftJoin('sale s', 's.orderCode=thd.orderCode')
@@ -1630,11 +1631,16 @@ class SaleReport extends Base
     //【五、退货明细表】
     public function thDataExport()
     {
-        $param = $this->request->only(['token', 'start_date' => '', 'end_date' => ''], 'post', 'trim');
+        $param = $this->request->only(['token', 'start_date' => '','companyNo'=>"", 'end_date' => ''], 'post', 'trim');
 
         $where = [['thd.is_del', '=', 0]];
         if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['thd.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
-
+	    if ($param['companyNo'] != '')
+		    $where[]=[
+			    's.supplierNo' ,
+			    '=' ,
+			    $param['companyNo']
+		    ];
         $data = Db::name('th_data')
             ->alias('thd')
             ->field('thd.id,thd.th_type,thd.addtime 退货时间,thd.thCode 退货单号,"" 发货申请单编码,"" 退货单状态,s.apply_name 创建人,s.apply_id 部门,thd.orderCode 确认单编号,s.addtime 下单日期,s.customerName 客户名称,s.good_name 产品名称,s.sale_price 单价,s.wsend_num 未发货数量,thd.th_num 退货数量,thd.th_fee 退货销售货款,"" 发货单联系人,"" 发货单联系人电话,"" 发货单地址,"" 退货原因')

+ 1 - 1
app/command/NowReportHandle.php

@@ -27,7 +27,7 @@ class NowReportHandle extends Command
     //处理报表预约记录,生成报表文件
     protected function execute(Input $input, Output $output)
     {
-        ini_set("memory_limit", "516M");
+        ini_set('memory_limit', '-1');
         $info = Cache::store('redis')->handler()->rpop($this->key);
         try {
             if ($info) {

+ 59 - 14
app/command/SplitSale.php

@@ -3,7 +3,7 @@
 namespace app\command;
 
 use app\admin\common\User;
-use think\console\Command;
+use app\admin\model\Platform;use app\model\ComonOrder;use think\console\Command;
 use think\console\Input;
 use think\console\Output;
 use think\Exception;
@@ -19,6 +19,7 @@ class SplitSale extends Command
     private $cgd_key = 0;//新增到wsm_cgd_caixiao的数组下标,从0开始
     private $order_source = 8;//支付渠道
 	private  $Tcode = '';
+	private  $comOrder;
     protected function configure()
     {
         $this->setName('split_sale')->setDescription('销售订单拆分');
@@ -37,9 +38,9 @@ class SplitSale extends Command
             	Cache::store('redis')->dec($key);
 	            return true;
             }
-
+			$this->comOrder=new ComonOrder();
             Db::startTrans();
-
+			
             try {
 
                 $data = Db::name('sale')
@@ -53,8 +54,28 @@ class SplitSale extends Command
                         ['a.pay_id', '<>', 0]
                     ])->cursor();
                 $userCommon = User::getIns();
-
+                $commonOrder=[];//处理采购销售同一数据
                 foreach ($data as $sale) {
+                	//处理采购销售同一数据
+                	$tempOrder=[
+                		"cxCode"=>$sale["orderCode"],
+                		"orderCode"=>"",
+                		"cgdNo"=>"",
+                		"order_type"=>$sale['order_type'],
+                		"order_source"=>$sale['order_source'],
+                		"platform_type"=>Platform::where("id",$sale['platform_id'])->value("use_type",0),
+                		"goodNo"=>$sale['good_code'],
+                		"goodName"=>$sale['good_name'],
+                		"apply_id"=>$sale['apply_id'],
+                		"apply_name"=>$sale['apply_name'],
+                		"customerName"=>"",
+                		"customerNo"=>"",
+                		"supplierNo"=>'',
+                		"supplierName"=>'',
+                		"companyName"=>$sale['supplierName'],
+                		"companyNo"=>$sale['supplierNo'],
+                		"addtime"=>$sale['addtime'],
+                		];
 					if( strtotime($sale['addtime']) >= strtotime('2023-07-01 00:00:00'))$this->Tcode ='F';
 					else $this->Tcode ='';
                     //补充商品信息
@@ -101,15 +122,17 @@ class SplitSale extends Command
                         ->leftJoin('purchease c', 'c.bk_code=b.bkcode')
                         ->where('a.orderCode', $sale['orderCode'])
                         ->findOrEmpty();
-
+					
                     //采购总金额和销售总金额
                     $cgd_total = $sale_total = $sale['total_price'];
 		            //客户
                     $customer = ['No' => $sale['customer_code'], 'name' => $sale['customerName']];
+                   
                     foreach ($pay_rates as $keys=>$pay_rate) {
                         //生成新的采购单号和销售单号
-                        $cgdNo = makeNo($this->Tcode.'CG');
                        
+                        $cgdNo = makeNo($this->Tcode.'CG');
+                        $tempOrder['cgdNo'] =  $cgdNo ;
                         $cgdNo = substr($cgdNo, 0, -2) . str_pad($this->i, 2, '0', STR_PAD_LEFT);
                         $orderCode = makeNo($this->Tcode.'QR');
                         $orderCode = substr($orderCode, 0, -2) . str_pad($this->i, 2, '0', STR_PAD_LEFT);
@@ -120,13 +143,16 @@ class SplitSale extends Command
 						$supplier = ['No' => $pay_rate['companyNo'], 'name' => $pay_rate['companyName'],"pay_name"=>$pay_rate['pay_name']];
 						$sale['origin_price'] = $sale['good_num'] > 0 ? bcdiv($cgd_total, $sale['good_num'], 5) : 0;
                         $this->_handle_sale_caixiao($sale, $orderCode, $cgdNo, $sale_total, $customer, $supplier);
-						$this->_handle_cgd_caixiao($cgd, $sale, $pay_rate, $cgdNo, $orderCode, $cgd_total);
+                        $tempOrder['customerName'] = $pay_rate['companyName'];
+                        $tempOrder['customerNo'] = $pay_rate['companyNo'];
+						$this->_handle_cgd_caixiao($cgd, $sale, $pay_rate, $cgdNo, $orderCode, $cgd_total,$tempOrder);
 						//下一个渠道公司/原业务公司的 客户信息
 						$customer= ['No' => $pay_rate['companyNo'], 'name' => $pay_rate['companyName']];
 	                    $sale_total =$cgd_total; //下一个渠道公司/原业务公司的 销售价未此次的采购单价
 	                    //判断是否是最后一个渠道遍历。最后一次需要额外生成一个销售单给原业务公司;
 						if($keys == count($pay_rates)-1){
 							$orderCode = makeNo($this->Tcode.'QR');
+							$tempOrder['orderCode'] =  $orderCode ;
 							$orderCode = substr($orderCode, 0, -2) . str_pad($this->i, 2, '0', STR_PAD_LEFT);
 							$supplier = ['No' => $sale['supplierNo'], 'name' => $sale['supplierName'],"pay_name"=>$pay_rate['pay_name']];
 							if(!isset($cgd['cgdNo']) && $sale['is_stock']==1 ){
@@ -134,14 +160,18 @@ class SplitSale extends Command
 							}else{
 								$sale['origin_price'] = $cgd['good_price'];
 							}
-							$this->_handle_sale_caixiao($sale, $orderCode, $cgd['cgdNo'] ?? '', $sale_total, $customer, $supplier);
+							$this->_handle_sale_caixiao($sale, $orderCode, $cgd['cgdNo'] ?? '', $sale_total,$customer, $supplier,$tempOrder);
 						}
                         //把自己覆盖到上一个记录的供应商记录中
+                      
                         if (isset($this->cgd_insert[$this->cgd_key - 1])) {
                             $temp = $userCommon->handle('hqInfo', ['code' =>$supplier['No']]);
                             $supplier = $temp['data'] ?? [];
                             $this->cgd_insert[$this->cgd_key - 1]['supplierNo'] =$supplier['relation_code'];
                             $this->cgd_insert[$this->cgd_key - 1]['supplier_name'] = $supplier['relation_name'];
+                             //处理采购销售同一数据 业务公司的供应商编号数据
+                            $tempOrder['supplierName'] =$supplier['relation_name'];
+                            $tempOrder['supplierNo'] = $supplier['relation_code'];
                             $temps = $userCommon->handle('sInfo', ['code' =>$supplier['relation_code']]);
                             $suppliers = $temps['data'] ?? [];
                             $this->cgd_insert[$this->cgd_key - 1]['supplier_persion'] = $suppliers['person'] ?? '';
@@ -157,13 +187,14 @@ class SplitSale extends Command
                     if($this->cgd_insert) Db::name('cgd_caixiao')->insertAll($this->cgd_insert);
                     $this->cgd_insert = [];
                     $this->cgd_key = 0;
+                    $commonOrder[]= $tempOrder;
                 }
 
 //                if ($cgd_insert_tmp_data) Db::name('cgd_caixiao')->insertAll($cgd_insert_tmp_data);
                 if ($this->sale_insert) Db::name('sale_caixiao')->insertAll($this->sale_insert);
 
                 Db::commit();
-
+				$this->OrderSave($commonOrder);
 //                $output->writeln('处理完成');
 
             } catch (\Exception $e) {
@@ -180,7 +211,8 @@ class SplitSale extends Command
     }
 
     //构建销售单
-    private function _handle_sale_caixiao(array $sale = [], string $orderCode = '', string $cgdNo = '', float $sale_total = 0.00, array $customer = [], array $supplier = [])
+    private function _handle_sale_caixiao(array $sale = [], string $orderCode = '', string $cgdNo = '', float
+    $sale_total = 0.00, array $customer = [], array $supplier = [],array &$tempOrder=[])
     {
         $sale_price = $sale['good_num'] > 0 ? bcdiv($sale_total, $sale['good_num'], 5) : 0;
         $tmp_sale = [
@@ -212,15 +244,17 @@ class SplitSale extends Command
         ];
 
         $tmp = Db::name('sale_caixiao')
-            ->field('id')
-            ->where(['oldCode' => $sale['orderCode'], 'supplierNo' =>$supplier['No'] ?? ''])
+            ->field('id,orderCode')
+            ->where(['oldCode' => $sale['orderCode'], 'supplierNo' =>$supplier['No'] ?? '', 'customer_code' =>$customer['No'] ?? ''])
             ->findOrEmpty();
 
         if (!empty($tmp)) {
             Db::name('sale_caixiao')
                 ->where('id', $tmp['id'])
                 ->update($tmp_sale);
+            if(isset($tempOrder['orderCode']))$tempOrder['orderCode']= $tmp['orderCode'];
         } else {
+        	if(isset($tempOrder['orderCode']))$tempOrder['orderCode']= $orderCode;
             $this->sale_insert[] = array_merge($tmp_sale, [
                 'orderCode' => $orderCode,
                 'apply_id' => $sale['apply_id'] ?? 0,
@@ -271,7 +305,8 @@ class SplitSale extends Command
     }
 
     //构建采购单
-    private function _handle_cgd_caixiao(array $cgd = [], array $sale = [], array $pay_rate = [], string $cgdNo = '', string $orderCode = '', float $cgd_total = 0.00)
+    private function _handle_cgd_caixiao(array $cgd = [], array $sale = [], array $pay_rate = [], string $cgdNo = '',
+     string $orderCode = '', float $cgd_total = 0.00,array &$tempOrder=[])
     {
 
         $good_price = $sale['good_num'] > 0 ? bcdiv($cgd_total, $sale['good_num'], 5) : 0;
@@ -306,7 +341,7 @@ class SplitSale extends Command
         ];
 
         $tmp = Db::name('cgd_caixiao')
-            ->field('id')
+            ->field('id,cgdNo')
             ->where(['oldCode' => $sale['orderCode'], 'companyNo' => $pay_rate['companyNo']])
             ->findOrEmpty();
 
@@ -314,7 +349,9 @@ class SplitSale extends Command
             Db::name('cgd_caixiao')
                 ->where('id', $tmp['id'])
                 ->update($tmp_cgd);
+            if(isset($tempOrder['cgdNo']))$tempOrder['cgdNo']= $tmp['cgdNo'];
         } else {
+             if(isset($tempOrder['cgdNo']))$tempOrder['cgdNo']=$cgdNo;
             $this->cgd_insert[$this->cgd_key] = array_merge($tmp_cgd, [
                 'cgdNo' => $cgdNo,
                 'bkcode' => $cgd['bkcode'] ?? '',
@@ -375,5 +412,13 @@ class SplitSale extends Command
         else return $this->_get_cat_list($str['pid'], $data);
 
     }
+    //处理采购销售同一数据 录入结算 统一数据表中
+    protected function OrderSave($order){
+        if(empty($order)) return ;
+        foreach ($order as &$item){
+        	$item['id'] = $this->comOrder->where("cxCode",$item['cxCode'])->value("id",null);
+        }
+        $this->comOrder->saveAll($order);
+    }
 
 }

+ 252 - 0
app/command/makeGood.php

@@ -0,0 +1,252 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\command;
+
+use app\admin\model\Unit;use PhpOffice\PhpSpreadsheet\Cell\Coordinate;use PhpOffice\PhpSpreadsheet\IOFactory;use think\console\Command;
+use think\console\Input;
+use think\console\input\Argument;
+use think\console\input\Option;
+use think\console\Output;use think\facade\Db;
+
+class makeGood extends Command
+{
+	protected $db;
+    protected function configure()
+    {
+        // 指令配置
+        $this->setName('makegood')
+            ->setDescription('the makegood command');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        // 指令输出
+        $output->writeln('makegood');
+        $file ="./public/exece.xlsx";
+        $spreadsheet =IOFactory::load($file);
+        // 选择第一个工作表
+        ini_set("memory_limit","-1");
+        $this->db=Db::connect("mysql_sys");
+//        $this->getNake();return;
+		$worksheet = $spreadsheet->getActiveSheet();
+		$height = $worksheet->getHighestRow();
+
+		// 获取最高的列号
+		$highestColumn = $worksheet->getHighestColumn();
+		$number = Coordinate::columnIndexFromString($highestColumn);
+        $header=[
+        '',
+        'spuCode',
+        'good_name',
+        'cat_id',
+        'brand_id',
+        'good_unit',
+        'good_type',
+        'companyNo',
+        'moq',
+        'customized',
+        'tax',
+        'supplierNo',
+        'is_auth',
+        'is_stock',
+        'after_sales',
+        'craft_desc',
+        'good_remark',
+        'good_size',
+        'weight',
+        'packing_way',
+        'packing_size',
+        'packing_spec',
+        'packing_list',
+        'packing_weight',
+        'good_bar',
+        'supply_area',
+        'delivery_place',
+        'origin_place',
+        'delivery_day',
+        'lead_time',
+        'sample_day',
+        'sample_fee',
+        'cert_fee',
+        'packing_fee',
+        'cost_fee',
+        'mark_fee',
+        'demo_fee',
+        'open_fee',
+        'noble_metal',
+        'noble_weight',
+        'is_gold_price',
+        'cgd_gold_price',
+        'market_price',
+        'nake_price',
+        'is_step',
+        'supplier_origin_price',
+        'cgd_supplier_code',
+        'cgd_apply_id',
+        'cgd_apply_name',
+        'is_exclusive',
+        'is_diff',
+        'config',
+        'other_config',
+        'stock_moq',
+        'is_support_barter',
+        'is_combind',
+        'plat_code'];
+        $data=[];
+        for ($i=2;$i<=$height;$i++){
+        	$temp=[];
+            for ($j=1;$j<=$number;$j++){
+            	if(isset($header[$j])){
+            	 $temp[$header[$j]] = $worksheet->getCellByColumnAndRow($j,$i)->getValue()??'';
+            	}else{
+            		break;
+            	}
+            }
+            $temp['spuCode'] = substr(makeNo('SKU'),0,-4).str_pad(strval($i),4,"0",STR_PAD_LEFT);
+            $temp['companyName'] = $this->getCompanyName($temp['companyNo']);
+            $temp['supplierName'] = $this->getCompanyName($temp['supplierNo']);
+            $temp['cgd_supplier_name'] = $this->getCompanyName($temp['cgd_supplier_code']);
+            $temp['delivery_place']=  $this->getAddress($temp['delivery_place']);
+            $temp['origin_place']=  $this->getAddress($temp['origin_place']);
+            $temp['good_unit']=  $this->getUnit($temp['good_unit']);
+            $data[]=$temp;
+            if($i%1000==0){
+            	 Db::name('good_temp')->insertAll($data);
+            	 $data=[];
+            }
+        }
+        if(!empty($data)) Db::name('good_temp')->insertAll($data);
+        $this->getOnline();
+        $this->getNake();
+    }
+    
+    public function getCompanyName($code){
+        return $this->db->name("headquarters")->where("code",$code)->value("name",'');
+    }
+    public function getUnit($unit_name){
+      $unit=Unit::where("unit",$unit_name)->findOrEmpty();
+      if($unit->isEmpty()){
+      	$info =Unit::create(["unit"=>$unit_name]);
+      	return $info->id;
+      }
+      return $unit->id;
+    }
+    
+    public function getAddress($addr){
+        $p_c_a =get_address($addr);
+        $addeRss=[];
+                $province = Db::name('province')
+                    ->field('province_code,name')
+                    ->where('name', $p_c_a['province'])
+                    ->findOrEmpty();
+			$addeRss[]=$province['province_code'];
+                $city = Db::name('city')
+                    ->field('city_code,name')
+                    ->where(['name' => $p_c_a['city']?:$p_c_a['province'], 'province_code' => $province['province_code'] ?: ''])
+                    ->findOrEmpty();
+                $addeRss[]=$city['city_code']?? $province['province_code'];
+                $area = Db::name('area')
+                    ->field('area_code,name')
+                    ->where(['name' => $p_c_a['district'], 'city_code' => $city['city_code'] ?:''])
+                    ->findOrEmpty();
+               
+              $addeRss[]= $area['area_code']?? '';
+             
+              return implode(",",$addeRss);
+    }
+    
+    public function getOnline(){
+    	$file ='./public/add.xlsx';
+        $spreadsheet =IOFactory::load($file);
+        $worksheet = $spreadsheet->getActiveSheet();
+		$height = $worksheet->getHighestRow();
+
+		// 获取最高的列号
+		$highestColumn = $worksheet->getHighestColumn();
+		$number = Coordinate::columnIndexFromString($highestColumn);
+		$data=[];
+		$header=["",'spuCode','skuCode','platform_code','is_compliance','compliance_remark','plat_code','is_fixed'];
+        for ($i=2;$i<=$height;$i++){
+        	$temp=[];
+            for ($j=1;$j<=$number;$j++){
+            	if(isset($header[$j])){
+            	 $temp[$header[$j]] = $worksheet->getCellByColumnAndRow($j,$i)->getValue()??'';
+            	}else{
+            		break;
+            	}
+            }
+            $temp['spuCode'] = Db::name("good_temp")->where(["plat_code"=>$temp['plat_code']])->value("spuCode",'');
+            $temp['skuCode'] = substr(makeNo('SN'),0,-4).str_pad(strval($i),4,'0',STR_PAD_LEFT);
+            $data[]=$temp;
+             if($i%1000==0){
+            	 Db::name('good_platform_temp')->insertAll($data);
+            	 $data=[];
+            }
+        }
+       if(!empty($data)) Db::name('good_platform_temp')->insertAll($data);
+        $this->getLadder();
+    }
+    
+    
+    public function getLadder(){
+    	        $file ='./public/ladder.xlsx';
+    	        $spreadsheet =IOFactory::load($file);
+    	        $worksheet = $spreadsheet->getActiveSheet();
+    			$height = $worksheet->getHighestRow();
+    	
+    			// 获取最高的列号
+    			$highestColumn = $worksheet->getHighestColumn();
+    			$number = Coordinate::columnIndexFromString($highestColumn);
+    			$data=[];
+    			$header=['','skuCode','min_num','sale_price','origin_price','market_price','market_platform','origin_rate','cost_fee','plat_code'];
+    	        for ($i=2;$i<=$height;$i++){
+    	        	$temp=[];
+    	            for ($j=1;$j<=$number;$j++){
+    	            	if(isset($header[$j])){
+    	            	 $temp[$header[$j]] = $worksheet->getCellByColumnAndRow($j,$i)->getValue()??'';
+    	            	}else{
+    	            		break;
+    	            	}
+    	            }
+    	            $temp['skuCode'] = Db::name('good_platform_temp')->where(['plat_code'=>$temp['plat_code']])->value('skuCode','');
+    	            $data[]=$temp;
+    	            if($i%1000==0){
+		                 Db::name('good_ladder_temp')->insertAll($data);
+		                 $data=[];
+                    }
+        }
+       if(!empty($data))Db::name('good_ladder_temp')->insertAll($data);
+    }
+    
+   public function getNake(){
+    	        $file ='./public/nake.xlsx';
+    	        $spreadsheet =IOFactory::load($file);
+    	        $worksheet = $spreadsheet->getActiveSheet();
+    			$height = $worksheet->getHighestRow();
+    	
+    			// 获取最高的列号
+    			$highestColumn = $worksheet->getHighestColumn();
+    			$number = Coordinate::columnIndexFromString($highestColumn);
+    			$data=[];
+    			$header=['','spuCode','min_num','nake_fee','cost_fee','delivery_fee','cert_fee','mark_fee','package_fee','other_fee','nake_total','plat_code'];
+    	        for ($i=2;$i<=$height;$i++){
+    	        	$temp=[];
+    	            for ($j=1;$j<=$number;$j++){
+    	            	if(isset($header[$j])){
+    	            	 $temp[$header[$j]] = $worksheet->getCellByColumnAndRow($j,$i)->getValue()??'';
+    	            	}else{
+    	            		break;
+    	            	}
+    	            }
+    	            $temp['spuCode'] = Db::name('good_temp')->where(['plat_code'=>$temp['plat_code']])->value('spuCode','');
+    	            $data[]=$temp;
+    	            if($i%1000==0){
+		                 Db::name('good_nake_temp')->insertAll($data);
+		                 $data=[];
+                    }
+        }
+       if(!empty($data))Db::name('good_nake_temp')->insertAll($data);
+    	  
+    }
+}

+ 17 - 0
app/model/ComonOrder.php

@@ -0,0 +1,17 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class ComonOrder extends Model
+{
+	protected $connection='mysql_cxinv';
+   protected $createTime="addtime";
+   protected $updateTime="updatetime";
+   
+}