/** * 浏览权限控制 */ public function show($id) { $this->islogin(); $data = IdeasModel::find($id); if ($data->uid != $this->userid) { $create = ['ideaid' => $id, 'uid' => $this->userid, 'created_at' => date('Y-m-d H:i:s', time())]; IdeasReadModel::create($create); } //内容查看权限开关 $data->iscon = 0; if ($data->genre == 1) { //供应分镜 $orderModel = OrderModel::where('buyer', $this->userid)->where('status', '>', 11)->where('isshow', 1)->where('del', 0)->first(); } elseif ($data->genre == 2) { //需求分镜 $orderModel = OrderModel::where('seller', $this->userid)->where('status', '>', 11)->where('isshow', 1)->where('del', 0)->first(); } if (isset($orderModel) && $orderModel) { if ($orderModel->status < 12) { $data->iscon = 1; } elseif ($orderModel->status == 13) { $data->iscon = 2; } elseif ($orderModel->status == 12) { $data->iscon = 3; } $data->remarks = $orderModel->remarks; } $result = ['data' => $data, 'curr_menu' => $this->curr]; return view('home.idea.show', $result); }
public function show($id) { if (!\Session::has('user.uid')) { return redirect('/login'); } $data = StoryBoardModel::find($id); //内容查看权限开关 if ($data->genre == 1) { //供应分镜 $orderModel = OrderModel::where('genre', 3)->where('buyer', $this->userid)->where('status', '>', 11)->where('isshow', 1)->where('del', 0)->first(); } elseif ($data->genre == 2) { //需求分镜 $orderModel = OrderModel::where('genre', 4)->where('seller', $this->userid)->where('status', '>', 11)->where('isshow', 1)->where('del', 0)->first(); } $data->iscon = 0; if (isset($orderModel) && $orderModel) { if ($orderModel->status < 12) { $data->iscon = 1; } elseif ($orderModel->status == 13) { $data->iscon = 2; } elseif ($orderModel->status == 12) { $data->iscon = 3; } $data->remarks = $orderModel->remarks; } $result = ['data' => $data, 'lists' => $this->list, 'curr_menu' => $this->curr, 'uid' => $this->userid]; return view('home.storyboard.show', $result); }
public function orders() { $orders_create = OrderProductModel::all(); $orders_all = OrderModel::all(); $orders_firm = OrderFirmModel::all(); //各个订单 $orders_C = OrderProductModel::where('isshow', 1)->paginate($this->limit); $orders_A = OrderModel::where('del', 0)->where('isshow', 1)->paginate($this->limit); $orders_F = OrderFirmModel::where('del', 0)->where('isshow', 1)->paginate($this->limit); return array('create' => count($orders_create), 'all' => count($orders_all), 'firm' => count($orders_firm), 'ordersC' => $orders_C, 'ordersA' => $orders_A, 'ordersF' => $orders_F); }
/** * 设计 */ public function designs($d_type = 1) { if ($d_type == 1) { $buyerIds = array(); $buyers = OrderModel::where('del', 0)->whereIn('genre', [1, 2])->where('buyer', $this->userid)->where('isshow', 1)->get(); if (count($buyers)) { foreach ($buyers as $buyer) { $buyerIds[] = $buyer->id; } } $datas = DesignModel::where('del', 0)->whereIn('uid', $buyerIds)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate(4); } else { if ($d_type == 2) { $datas = DesignModel::where('del', 0)->where('uid', $this->userid)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate(4); } } return $datas; }
public function query($del, $isshow) { if ($del == '') { $del = [0, 1]; } if ($isshow == '') { $isshow = [0, 1]; } if (is_array($del)) { if (is_array($isshow)) { $datas = OrderModel::orderBy('id', 'desc')->paginate($this->limit); } else { $datas = OrderModel::where('isshow', $isshow)->orderBy('id', 'desc')->paginate($this->limit); } } else { if (is_array($isshow)) { $datas = OrderModel::where('del', $del)->orderBy('id', 'desc')->paginate($this->limit); } else { $datas = OrderModel::where('del', $del)->where('isshow', $isshow)->orderBy('id', 'desc')->paginate($this->limit); } } $datas->limit = $this->limit; return $datas; }
/** * 获取实时数据 来自订单表 */ public function getOrders($limit) { return OrderModel::where('isshow', 1)->orderBy('id', 'desc')->paginate($limit); }
/** * 成功订单百分比 */ public function orderInfo() { $uid = $this->userid ? $this->userid : 0; $orders = OrderModel::where('buyer', $uid)->get(); $orderSuccess = OrderModel::where('buyer', $uid)->where('status', '>', 11)->get(); $orderInfo['order'] = $orders; $orderInfo['per'] = count($orders) ? intval(count($orderSuccess) / count($orders) * 100) : 0; return $orderInfo; }
public function query() { $datas = OrderModel::where('del', 0)->where('isshow', 1)->orderBy('id', 'desc')->paginate($this->limit); $datas->limit = $this->limit; return $datas; }