input('typeid', null) != null) { $postdata['typeid'] = $request->input('typeid'); } if ($request->input('orderby', null) != null) { $postdata['orderby'] = $request->input('orderby'); } if ($request->input('tuijian', null) != null) { $postdata['tuijian'] = $request->input('tuijian'); } $pagesize = 15; $offset = 0; if (isset($_REQUEST['page'])) { $offset = ($_REQUEST['page'] - 1) * $pagesize; } //商品列表 $postdata['limit'] = $pagesize; $postdata['offset'] = $offset; $url = env('APP_API_URL') . "/goods_list"; $res = curl_request($url, $postdata, 'GET'); $data['list'] = $res['data']['list']; $data['totalpage'] = ceil($res['data']['count'] / $pagesize); if (isset($_REQUEST['page_ajax']) && $_REQUEST['page_ajax'] == 1) { $html = ''; if ($res['data']['list']) { foreach ($res['data']['list'] as $k => $v) { $html .= '
  • ' . $v['title'] . ''; $html .= '

    ' . $v['title'] . '

    '; $html .= '

    库存(' . $v['goods_number'] . ') ' . $v['description'] . '

    '; $html .= '
    ¥' . ceil($v['price']) . '
    '; $html .= '
    ¥' . $v['market_price'] . ' 包邮
    ' . $v['sale'] . ' 件已付款
  • '; /* if($v['is_promote_goods']>0) { $html .= 'Hot'; } $html .= $v['title'].'

    '.$v['price'].''.$v['sale'].'人付款
    '; $html .= ''; */ } } exit(json_encode($html)); } //商品分类列表 $postdata = array( 'pid' => 0, 'limit' => 15, 'offset' => 0 ); $url = env('APP_API_URL') . "/goodstype_list"; $res = curl_request($url, $postdata, 'GET'); $data['goodstype_list'] = $res['data']['list']; return view('home.goods.index', $data); } // 商品详情页 public function detail($id) { if (empty($id) || !preg_match('/[0-9]+/', $id)) { return redirect()->route('page404'); } $where['id'] = $id; $where['status'] = 0; $data['post'] = logic('Goods')->getOne($where); if (!$data['post']) { return redirect()->route('page404'); } $data['tj_list'] = DB::table('goods')->where(['tuijian' => 1, 'status' => 0])->orderBy('id', 'desc')->get(); return view('home.goods.detail', $data); } //商品列表页 public function brand_list(Request $request) { $data['brand_list'] = object_to_array(DB::table('goods_brand')->where(['status' => 0])->take(30)->orderBy('listorder', 'asc')->get()); return view('home.index.brandList', $data); } }