* @title 首页 */ namespace app\api\controller; use app\common\model\GoodsIndex; use app\common\model\Goods; use app\common\model\GoodsBrand; use app\common\model\GoodsItem; use app\common\model\GoodsCategory; use app\common\model\MallImage; use app\common\model\ShopConfig; use app\common\model\PhaseConfig; use tools\Crypt; use think\Request; class IndexController extends Controller { protected $authExcept = [ 'home','pattern_goods' ]; public function home(Request $request,Goods $gmodel) { // echo Crypt::encrypt(1).'|'; // echo $this->getToken(1); $param = $request->param(); //首页轮播 $carousel = get_ad('carousel',6); $goods_list=$gmodel ->alias('g') ->field("mi.thumb_image as img,g.name,g.price,g.id as goods_id") ->join('mall_image mi', 'mi.union_id= g.id and is_cover=1 and mi.type=1', 'LEFT') ->where(array('is_hot'=>1,'status'=>1))->select(); foreach ($goods_list as $k1 => $v1) { $goods_list[$k1]['img'] =$this->img_url.$v1['img']; $goods_list[$k1]['goods_id'] = Crypt::encrypt($v1['goods_id']); } $data = [ 'carousel' =>$carousel,//首页轮播 'goods_list' => $goods_list,//模式板块 ]; return success($data); } }