$goodsCost = $priceInfo['goodsCost']; //现行单价 //获取采购人名称 $usermodel = UserModel::getInstance(); $whereStr = "where a.global_user_id=" . $priceInfo['purchaseId']; $cgUser = $usermodel->getGlobalUserLists('global_user_name', $whereStr, '', ''); //$cgUser[0]['global_user_name']; $purchase = $cgUser['0']['global_user_name']; $weight = $priceInfo['goodsWeight']; //产品重量 $pName = $priceInfo['pName']; //仓位号 $nums = $priceInfo['nums']; //实际库存 //产品分类 $goodsCategory = $priceInfo['goodsCategory'] ? getGoodsCategory($priceInfo['goodsCategory']) : '无'; $type = $priceInfo['type'] == 1 ? '可以配货' : '不能配货'; $checkCost = $priceInfo['checkCost']; $tdarr = array($spu, $sku, $goodsName, $goodsCost, $purchase, $weight, $pName, $nums, $goodsCategory, $type, $checkCost); $excel->addRow($tdarr); /*$objPHPExcel->setActiveSheetIndex(0)->getCell('A'.$row)->setValueExplicit($spu, PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->setActiveSheetIndex(0)->getCell('B'.$row)->setValueExplicit($sku, PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->setActiveSheetIndex(0)->getCell('C'.$row)->setValueExplicit(@trim($goodsName), PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->setActiveSheetIndex(0)->getCell('D'.$row)->setValueExplicit($goodsCost, PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->setActiveSheetIndex(0)->getCell('E'.$row)->setValueExplicit($purchase, PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->setActiveSheetIndex(0)->getCell('F'.$row)->setValueExplicit($weight, PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->setActiveSheetIndex(0)->getCell('G'.$row)->setValueExplicit($pName, PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->setActiveSheetIndex(0)->getCell('H'.$row)->setValueExplicit($nums, PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->setActiveSheetIndex(0)->getCell('I'.$row)->setValueExplicit( $goodsCategory, PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->setActiveSheetIndex(0)->getCell('J'.$row)->setValueExplicit($type, PHPExcel_Cell_DataType::TYPE_STRING); $objPHPExcel->setActiveSheetIndex(0)->getCell('K'.$row)->setValueExplicit($checkCost, PHPExcel_Cell_DataType::TYPE_STRING);
public function edit() { //实例化数据库对象 $goods = M('goods'); //查询所有顶级分类 $goodsclasses = getGoodsCategory(); //查询当前商品 $info = $goods->where('gid=' . I('gid'))->find(); var_dump($info); //翻译商品数据库信息 // var_dump($info['intro']); //商品颜色提示信息 $colortit = json_decode($info['colortit'], true); //商品主图处理地址转为数组 $s_img = json_decode($info['s_img'], true); //商品size转为数组 $size = json_decode($info['size'], true); //检索主图--用于给页面传递标记变量$zhupicLength foreach ($s_img as $k => $v) { $zhupic[] = $v[0]; } //分配变量 $this->assign('classes', $goodsclasses); $this->assign('info', $info); $this->assign('zhupicLength', count($zhupic)); //当前商品信息 $this->assign('gid', I('gid')); $this->assign('size', $size); $this->assign('s_img', $s_img); $this->assign('zhupic', $zhupic); $this->assign('colortit', $colortit); $this->assign('intro', $info['intro']); $this->assign('length', count($s_img)); //解析模版 $this->display(); }