/** * 渲染 * * @access public * @param mixed $viewFile * @param bool $return * @return mixed */ public function renderInternal($viewFile, $return = false) { $data = $this->properties; if (is_array($data)) { extract($data, EXTR_PREFIX_SAME, 'data'); } $tplfile = $this->getViewFile($viewFile); if (file_exists($tplfile)) { $runfile = Tiny::app()->getRuntimePath() . DIRECTORY_SEPARATOR . 'widgets/' . $viewFile . '.php'; if (!file_exists($runfile) || filemtime($runfile) < filemtime($tplfile)) { $file = new File($runfile, 'w+'); $template = $file->getContents($tplfile); $t = new Tag(); $tem = $t->resolve($template); $file->write($tem); } header("Content-type: text/html; charset=" . $this->encoding); if ($return) { ob_start(); ob_implicit_flush(false); require $runfile; return ob_get_clean(); } else { require $runfile; } } else { if ($this->id != Tiny::app()->getId()) { trigger_error("{$this->id}Widget->{$this->getAction()}() not exists", E_USER_ERROR); } else { Tiny::msg('', '无法找到请求的页面', 404); } } }
public function bundbuy() { $id = Filter::int(Req::args("id")); $bund = $this->model->table("bundling")->where("id={$id} and status = 1")->find(); if ($bund) { // EC 变更 2015-06-17 14:58 关税大于50元,提示信息表示 START //$goods = $this->model->table("goods")->where("id in ($bund[goods_id])")->findAll(); $goods = $this->model->table("goods as go")->join("left join tiny_tax_type as ttt on go.tax_type_id = ttt.tax_type_id")->where("id in ({$bund['goods_id']})")->findAll(); // EC 变更 2015-06-17 14:58 关税大于50元,提示信息表示 END $gids = array(); $goods_price = 0.0; // EC 变更 2015-06-17 14:58 关税大于50元,提示信息表示 START $taxAmount = 0.0; $shipId = null; // EC 变更 2015-06-17 14:58 关税大于50元,提示信息表示 END foreach ($goods as $go) { $gids[] = $go['id']; $goods_price += $go['sell_price']; // EC 变更 2015-06-17 14:58 关税大于50元,提示信息表示 START if (!isset($go["tax_type_percent"])) { $go["tax_type_percent"] = 0; } $taxAmount = $taxAmount + $go['sell_price'] * $go["tax_type_percent"]; if (!isset($shipId)) { $shipId = $go['ship_id']; } // EC 变更 2015-06-17 14:58 关税大于50元,提示信息表示 END } $gids = implode(',', $gids); $skumap = array(); $products = $this->model->table("products")->fields("sell_price,market_price,store_nums,specs_key,pro_no,id,goods_id")->where("goods_id in ({$gids})")->findAll(); if ($products) { foreach ($products as $product) { if ($product['specs_key']) { $skumap[$product['specs_key'] . $product['goods_id']] = $product; } else { $skumap[$product['goods_id']] = $product; } } } // EC 变更 2015-06-17 14:58 关税大于50元,提示信息表示 START $taxAmount = $this->checkProductTax_p2($shipId, $taxAmount); // EC 变更 2015-06-17 14:58 关税大于50元,提示信息表示 END $seo_title = $bund['title']; if ($seo_title != '') { $this->assign('seo_title', $seo_title); } $this->assign("bund", $bund); $this->assign("goods_price", $goods_price); $this->assign("skumap", $skumap); $this->assign("goods", $goods); $this->assign("id", $id); // EC 变更 2015-06-17 14:58 关税大于50元,提示信息表示 START $this->assign("taxAmount", $taxAmount); // EC 变更 2015-06-17 14:58 关税大于50元,提示信息表示 END $this->redirect(); } else { Tiny::msg($this, '', 404); } }