| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace app\index\controller;
- use app\common\controller\Frontend;
- use app\job\InsertDataJob;
- use think\Queue;
- use think\Db;
- class Index extends Frontend
- {
- protected $noNeedLogin = '*';
- protected $noNeedRight = '*';
- protected $layout = '';
- public function index()
- {
- // $this->redirect("/ReZpnAIXhw.php"); //关键代码->重定向
- // 查询product表数据
- $products = Db::name('product')->where('product_category','模版')->select();
- //baseUrl ip服务器地址 port端口号
- $http_url = Db::name('http_url')->field('baseUrl,port')->find();
- // 拼接完整的图片URL
- if ($products && $http_url) {
- $base_url = 'http://' . $http_url['baseUrl'] . ':' . $http_url['port'];
- foreach ($products as &$product) {
- if (isset($product['txt_image_url'])) {
- $product['full_image_url'] = $base_url . $product['txt_image_url'];
- }
- }
- }
- // 将数据传递给前端视图
- $this->assign('products', $products);
- $this->assign('http_url', $http_url);
- return $this->view->fetch();
- }
- }
|