Example #1
0
 public function show()
 {
     $data['categories'] = Category::where('pid', 0)->get();
     $data['activity_classification'] = ActivityClassification::all();
     $data['free_post'] = FreePost::all();
     return view('admin.goods.index', $data);
 }
Example #2
0
 /**
  *
  * @SWG\Api(
  *   path="/activity_page",
  *   description="约惠主页(有更新20160308)",
  *   @SWG\Operation(
  *     method="GET", summary="获得约惠主页内容", notes="获得约惠主页内容",
  *     type="ActivityPage",
  *     @SWG\ResponseMessage(code=0, message="成功"),
  *     @SWG\Parameter(
  *         name="user_id",
  *         description="用户id",
  *         paramType="query",
  *         required=false,
  *         allowMultiple=false,
  *         type="integer",
  *         defaultValue=-1
  *     )
  *   )
  * )
  */
 public function index(Request $request)
 {
     $user_id = $request->input('user_id', -1);
     $response = new BaseResponse();
     $ret = (object) null;
     $banners = Banner::where('banner_position', 1)->get();
     $ret->banners = $banners;
     //分类
     $activityClassification = ActivityClassification::all();
     $ret->activityClassification = $activityClassification;
     //包邮
     $freePost = FreePost::all();
     $ret->freePost = $freePost;
     //爆品
     $conversionGoods = ConversionGoods::all();
     //$conversionGoods=$conversionGoods->toArray();
     foreach ($conversionGoods as &$v) {
         $v->has_collection = 0;
         if ($user_id != -1) {
             $collection = Collection::where('user_id', $user_id)->where('type', 0)->where('item_id', $v->goods_id)->first();
             if ($collection != null) {
                 $v->has_collection = 1;
             }
         }
     }
     $ret->conversionGoods = $conversionGoods;
     $response->Data = $ret;
     return $response->toJson();
 }