Ejemplo n.º 1
0
 public function query()
 {
     $uid = $this->userid ? $this->userid : 0;
     $datas = ProductModel::where('del', 0)->where('uid', $uid)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     $datas->limit = $this->limit;
     return $datas;
 }
Ejemplo n.º 2
0
 /**
  * 在线创作查询
  */
 public function products($type)
 {
     //genre==1:个人供应;genre==2:企业供应
     if ($type) {
         $datas = ProductModel::where('del', 0)->where('genre', $type)->where('isshow', 1)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     } else {
         $datas = ProductModel::where('del', 0)->where('isshow', 1)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     }
     return $datas;
 }
Ejemplo n.º 3
0
 public function update(Request $request, $id)
 {
     $data = $this->getData($request);
     $data['updated_at'] = time();
     ProductModel::where('id', $id)->update($data);
     //更新搜索表
     $productModel = ProductModel::where('id', $id)->first();
     \App\Models\Home\SearchModel::change($productModel, 1, 'update');
     return redirect(DOMAIN . 'admin/product');
 }
Ejemplo n.º 4
0
 /**
  * 以下是要展示的数据
  */
 public function query($cate)
 {
     if ($cate) {
         $datas = ProductModel::where('cate', $cate)->where('isshow', 2)->where('isauth', 3)->where('uid', 0)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     } else {
         $datas = ProductModel::where('isshow', 2)->where('isauth', 3)->where('uid', 0)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     }
     $datas->limit = $this->limit;
     return $datas;
 }
Ejemplo n.º 5
0
 /**
  * 在线创作的作品
  */
 public function products($p_type = 1)
 {
     if ($p_type == 1) {
         $buyerIds = array();
         $buyers = OrderProductModel::where('del', 0)->where('buyer', $this->userid)->where('isshow', 1)->get();
         if (count($buyers)) {
             foreach ($buyers as $buyer) {
                 $buyerIds[] = $buyer->id;
             }
         }
         $datas = ProductModel::where('del', 0)->whereIn('uid', $buyerIds)->where('isshow', 1)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate(10);
     } else {
         if ($p_type == 2) {
             $datas = ProductModel::where('del', 0)->where('uid', $this->userid)->where('isshow', 1)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate(10);
         }
     }
     return $datas;
 }
Ejemplo n.º 6
0
 /**
  * 获取在线创作
  */
 public function getProducts($limit)
 {
     return ProductModel::where('isshow', 1)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($limit);
 }
Ejemplo n.º 7
0
 /**
  * 查询方法
  */
 public function query()
 {
     $datas = ProductModel::where('isshow', 2)->orderBy('id', 'desc')->paginate($this->limit);
     $datas->limit = $this->limit;
     return $datas;
 }
Ejemplo n.º 8
0
 public function query($genre, $cate)
 {
     if ($genre == 1) {
         if ($cate) {
             $datas = ProductModel::where('cate', $cate)->where('video_id', '>', 0)->orderBy('id', 'desc')->paginate($this->limit);
         } else {
             $datas = ProductModel::where('video_id', '>', 0)->orderBy('id', 'desc')->paginate($this->limit);
         }
     } elseif (in_array($genre, [2, 3])) {
         if ($cate) {
             $datas = ProductVideoModel::where('cate', $cate)->where('genre', $genre - 1)->orderBy('id', 'desc')->paginate($this->limit);
         } else {
             $datas = ProductVideoModel::where('genre', $genre - 1)->orderBy('id', 'desc')->paginate($this->limit);
         }
     }
     $datas->limit = $this->limit;
     return $datas;
 }
Ejemplo n.º 9
0
 /**
  * 获取产品记录
  */
 public function getProduct($id)
 {
     $productModel = ProductModel::find($id);
     $data = ['name' => $productModel->name, 'serial' => $productModel->serial, 'cate' => $productModel->cate, 'gif' => $productModel->gif, 'intro' => $productModel->intro, 'uid' => $this->userid, 'pid' => $id, 'created_at' => time()];
     ProductModel::create($data);
     $productModelNew = ProductModel::where($data)->first();
     return $productModelNew->id;
 }