admin_goods_817
admin_goods_817_2
This commit is contained in:
@@ -298,44 +298,46 @@ class Goods extends HD_Controller
|
||||
$j = 0;
|
||||
for ($_row = 2; $_row <= $rowCnt; $_row++) { //读取内容
|
||||
$vin = $objWorksheet->getCell('F' . $_row)->getValue(); //vin码
|
||||
if ($vin) {
|
||||
if ($vin) {//有vin时验证
|
||||
$re_i = $this->mdItems->get(array('vin' => $vin));
|
||||
if (!$re_i) {
|
||||
$brand_id = $objWorksheet->getCell('A' . $_row)->getValue(); //品牌id
|
||||
$s_id = $objWorksheet->getCell('B' . $_row)->getValue(); //车系id
|
||||
$v_id = $objWorksheet->getCell('C' . $_row)->getValue(); //车型id
|
||||
$cor_id = $objWorksheet->getCell('D' . $_row)->getValue(); //车身颜色id
|
||||
$incor_id = $objWorksheet->getCell('E' . $_row)->getValue(); //内饰颜色id
|
||||
$stdard_num = $objWorksheet->getCell('G' . $_row)->getValue(); //合格证号
|
||||
$pro_time = $objWorksheet->getCell('H' . $_row)->getValue(); //生产时间
|
||||
$ori_price = $objWorksheet->getCell('I' . $_row)->getValue(); //平台价
|
||||
$re_b = $this->mdAutoBrand->get(array('name' => $brand_id));
|
||||
$brand_id = $re_b ? $re_b['id'] : 0;
|
||||
$re_s = $this->mdAutoSeries->get(array('brand_id' => $brand_id, 'name' => $s_id));
|
||||
$s_id = $re_s ? $re_s['id'] : 0;
|
||||
$re_a1 = $this->mdAutoAttr->get(array('s_id' => $s_id, 'type' => 1, 'title' => $v_id));
|
||||
$v_id = $re_a1 ? $re_a1['id'] : 0;
|
||||
$re_a0 = $this->mdAutoAttr->get(array('s_id' => $s_id, 'type' => 0, 'title' => $cor_id));
|
||||
$cor_id = $re_a0 ? $re_a0['id'] : 0;
|
||||
$re_a2 = $this->mdAutoAttr->get(array('s_id' => $s_id, 'type' => 2, 'title' => $incor_id));
|
||||
$incor_id = $re_a2 ? $re_a2['id'] : 0;
|
||||
$pro_time = $pro_time ? gmdate("Y/m/d H:i:s", PHPExcel_Shared_Date::ExcelToPHP($pro_time)) : '';
|
||||
$addData = array(
|
||||
'brand_id' => $brand_id,
|
||||
's_id' => $s_id,
|
||||
'v_id' => $v_id,
|
||||
'cor_id' => $cor_id,
|
||||
'incor_id' => $incor_id,
|
||||
'ori_price' => $ori_price,
|
||||
'vin' => $vin,
|
||||
'stdard_num' => $stdard_num,
|
||||
'pro_time' => $pro_time,
|
||||
'c_time' => time()
|
||||
);
|
||||
$id = $this->mdItems->add($addData);
|
||||
if ($id) {
|
||||
$j++;
|
||||
}
|
||||
} else {
|
||||
$re_i = '';
|
||||
}
|
||||
if (!$re_i) {
|
||||
$brand_id = $objWorksheet->getCell('A' . $_row)->getValue(); //品牌id
|
||||
$s_id = $objWorksheet->getCell('B' . $_row)->getValue(); //车系id
|
||||
$v_id = $objWorksheet->getCell('C' . $_row)->getValue(); //车型id
|
||||
$cor_id = $objWorksheet->getCell('D' . $_row)->getValue(); //车身颜色id
|
||||
$incor_id = $objWorksheet->getCell('E' . $_row)->getValue(); //内饰颜色id
|
||||
$stdard_num = $objWorksheet->getCell('G' . $_row)->getValue(); //合格证号
|
||||
$pro_time = $objWorksheet->getCell('H' . $_row)->getValue(); //生产时间
|
||||
$ori_price = $objWorksheet->getCell('I' . $_row)->getValue(); //平台价
|
||||
$re_b = $this->mdAutoBrand->get(array('name' => $brand_id));
|
||||
$brand_id = $re_b ? $re_b['id'] : 0;
|
||||
$re_s = $this->mdAutoSeries->get(array('brand_id' => $brand_id, 'name' => $s_id));
|
||||
$s_id = $re_s ? $re_s['id'] : 0;
|
||||
$re_a1 = $this->mdAutoAttr->get(array('s_id' => $s_id, 'type' => 1, 'title' => $v_id));
|
||||
$v_id = $re_a1 ? $re_a1['id'] : 0;
|
||||
$re_a0 = $this->mdAutoAttr->get(array('s_id' => $s_id, 'type' => 0, 'title' => $cor_id));
|
||||
$cor_id = $re_a0 ? $re_a0['id'] : 0;
|
||||
$re_a2 = $this->mdAutoAttr->get(array('s_id' => $s_id, 'type' => 2, 'title' => $incor_id));
|
||||
$incor_id = $re_a2 ? $re_a2['id'] : 0;
|
||||
$pro_time = $pro_time ? gmdate("Y/m/d H:i:s", PHPExcel_Shared_Date::ExcelToPHP($pro_time)) : '';
|
||||
$addData = array(
|
||||
'brand_id' => $brand_id,
|
||||
's_id' => $s_id,
|
||||
'v_id' => $v_id,
|
||||
'cor_id' => $cor_id,
|
||||
'incor_id' => $incor_id,
|
||||
'ori_price' => $ori_price ? $ori_price : '0.00',
|
||||
'vin' => $vin ? $vin : '',
|
||||
'stdard_num' => $stdard_num ? $stdard_num : '',
|
||||
'pro_time' => $pro_time ? $pro_time : '0000-00-00 00:00:00',
|
||||
'c_time' => time()
|
||||
);
|
||||
$id = $this->mdItems->add($addData);
|
||||
if ($id) {
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user