/** * 显示评价信息 * GET /rate * * @return Response */ public function getList() { // $rates = array(); if (Input::has('shopID')) { $shopID = base64_decode(Input::get('shopID')); if (0 == strcmp($shopID, ALL_SHOPS_FALG)) { $headerShop = (object) array("wy_shop_id" => base64_encode(ALL_SHOPS_FALG), "wy_shop_name" => ALL_SHOPS); return View::make('admin.manage.rate.rate', compact('headerShop', 'rates'))->withAll(Lang::get('messages.10015')); } else { $headerShop = AuthController::checkShop($shopID); if (empty($headerShop)) { return View::make('admin.manage.rate.rate', compact('headerShop', 'rates'))->withError(Lang::get('errormessages.-10045')); } else { $shop = Shop::where('wy_shop_id', $shopID)->first(array('wy_comprehensive_evaluation', 'wy_service_score', 'wy_goods_score')); $rates = Rate::where('wy_shop_id', $shopID)->orderBy('wy_time', 'desc')->paginate(PERPAGE_COUNT_10, array('wy_comment_id', 'wy_main_order_id', 'wy_user_phone', 'wy_time', 'wy_content')); foreach ($rates as $index => $rate) { $rate->wy_comment_id = base64_encode($rate->wy_comment_id); $mainOrder = MainOrder::where('wy_main_order_id', $rate->wy_main_order_id)->first(array('wy_order_number')); if (!empty($mainOrder)) { $rate->wy_order_number = $mainOrder->wy_order_number; } else { $rate->wy_order_number = Lang::get('errormessages.-10058'); } $rate->wy_main_order_id = base64_encode($rate->wy_main_order_id); } return View::make('admin.manage.rate.rate', compact('headerShop', 'shop', 'rates')); } } } else { return View::make('admin.manage.rate.rate', compact('rates'))->withError(Lang::get('errormessages.-10045')); } }
public function getListInfo() { $shopID = base64_decode(Input::get('shopID')); $mainOrderID = base64_decode(Input::get('mainOrderID')); $disableChange = DEFAULT_0; $headerShop = AuthController::checkShop($shopID); if (!empty($headerShop)) { $mainOrder = MainOrder::where('wy_main_order_id', $mainOrderID)->where('wy_shop_id', $shopID)->first(array('wy_main_order_id', 'wy_shop_id', 'wy_order_number', 'wy_recv_name', 'wy_recv_addr', 'wy_recv_phone', 'wy_consumption_money', 'wy_actual_money', 'wy_order_state', 'wy_order_state_flow', 'wy_generate_time', 'wy_confirm_time', 'wy_send_time', 'wy_arrive_time', 'wy_reminder_flag', 'wy_reminder_count', 'wy_reminder_time', 'wy_refuse_time', 'wy_cancel_time', 'wy_user_note')); if (!empty($mainOrder)) { $orderStatus = Dictionary::where('wy_dic_id', DIC_ORDER_STATUS)->where('wy_dic_item_id', $mainOrder->wy_order_state)->first(array('wy_dic_value')); $mainOrder->wy_order_state_name = $orderStatus->wy_dic_value; $reminderFlag = Dictionary::where('wy_dic_id', DIC_REMINDER_FLAG)->where('wy_dic_item_id', $mainOrder->wy_reminder_flag)->first(array('wy_dic_value')); $mainOrder->wy_reminder_flag_name = $reminderFlag->wy_dic_value; $subOrders = MainOrder::find($mainOrder->wy_main_order_id)->subOrders()->get(array('wy_goods_id', 'wy_goods_name', 'wy_goods_unit_price', 'wy_goods_amount', 'wy_goods_total_price')); $mainOrder->subOrders = $subOrders; $mainOrder->wy_shop_name = $headerShop->wy_shop_name; $mainOrder->wy_shop_id = base64_encode($mainOrder->wy_shop_id); $mainOrder->wy_main_order_id = base64_encode($mainOrder->wy_main_order_id); //订单流的处理 $orderStatFlows = str_split($mainOrder->wy_order_state_flow); return View::make('admin.template.order.orderdetail', compact('headerShop', 'disableChange', 'mainOrder', 'orderStatFlows')); } else { return View::make('admin.template.order.orderdetail', compact('headerShop', 'disableChange'))->withError(Lang::get('errormessages.-10068')); } } else { return View::make('admin.template.order.orderdetail', compact('disableChange'))->withError(Lang::get('errormessages.-10068')); } }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { if (Input::has('shopID')) { $shopID = base64_decode(Input::get('shopID')); if (0 == strcmp($shopID, ALL_SHOPS_FALG)) { $headerShop = (object) array("wy_shop_id" => base64_encode(ALL_SHOPS_FALG), "wy_shop_name" => ALL_SHOPS); //获取公告信息 $announces = array(); $this->getAnnounces($announces); $totalTurnover = 0; $totalOrderCount = 0; $newOrderCount = 0; $this->getAllTradeInfo($totalTurnover, $totalOrderCount, $newOrderCount); return View::make('admin.index', compact('headerShop', 'totalTurnover', 'totalOrderCount', 'newOrderCount', 'announces')); } else { //获取公告信息 $announces = array(); $this->getAnnounces($announces); $headerShop = AuthController::checkShop($shopID); $totalTurnover = 0; $totalOrderCount = 0; $newOrderCount = 0; //显示当前店铺信息 //缺少对headerShop为空的判断,这是程序出现问题了,应该统一跳回到原来的界面 //应该统一到一个界面,提示错误,倒计时跳转到上一个正确的界面即可 if (!empty($headerShop)) { $this->getSingleTradeInfo($shopID, $totalTurnover, $totalOrderCount, $newOrderCount); return View::make('admin.index', compact('headerShop', 'totalTurnover', 'totalOrderCount', 'newOrderCount', 'announces')); } else { return View::make('admin.index', compact('totalTurnover', 'totalOrderCount', 'newOrderCount', 'announces')); } } } else { $shops = AuthController::getShops(); if (empty($shops->toArray())) { return View::make('admin.intro.useflow'); } else { $isPassed = false; foreach ($shops as $index => $shop) { if (SHOP_AUDIT_STATUS_4 == $shop->wy_audit_state) { $headerShop = $shop; $headerShop->wy_shop_id = base64_encode($headerShop->wy_shop_id); $isPassed = true; break; } } if ($isPassed) { //获取公告信息 $announces = array(); $this->getAnnounces($announces); //返回整体数据 $totalTurnover = 0; $totalOrderCount = 0; $newOrderCount = 0; $this->getAllTradeInfo($totalTurnover, $totalOrderCount, $newOrderCount); return View::make('admin.index', compact('headerShop', 'totalTurnover', 'totalOrderCount', 'newOrderCount', 'announces')); } else { return View::make('admin.template.tip')->withMessage(Lang::get('messages.10014')); } } } }
/** * 修改商品信息 * * @return Response */ public function postChangeStatus() { // return Input::all(); $shopID = base64_decode(Input::get('shop_id')); $headerShop = AuthController::checkShop($shopID); $goodsID = base64_decode(Input::get('goods_id')); $goodsStatus = Input::get('goods_status'); $goods = Goods::where('wy_goods_id', $goodsID)->where('wy_shop_id', $shopID)->where('wy_goods_state', '!=', $goodsStatus)->first(array('wy_goods_id', 'wy_goods_state', 'wy_onsale_time', 'wy_unsale_time')); $retCode = SUCCESS; $retMsg = ""; if (empty($goods)) { $retCode = -10050; $retMsg = Lang::get('errormessages.-10050'); $context = array("errorCode" => $retCode, "userID" => Auth::id(), "shopID" => $shopID, "goodsID" => $goodsID); Log::error($retMsg, $context); } else { $goods->wy_goods_state = $goodsStatus; if (GOODS_STATUS_1 == $goodsStatus) { $goods->wy_onsale_time = Carbon::now(); } elseif (GOODS_STATUS_2 == $goodsStatus) { $goods->wy_unsale_time = Carbon::now(); } $result = $goods->save(); if ($result) { $retMsg = Lang::get('messages.10012'); } else { $retCode = -15018; $retMsg = Lang::get('errormessages.-15018'); $context = array("errorCode" => $retCode, "userID" => Auth::id(), "shopID" => $shopID, "goodsID" => $goodsID, "goodsStatus" => $goodsStatus); Log::error($retMsg, $context); } } $sendMsgArray = array("ret_code" => $retCode, "msg" => $retMsg); return Response::json($sendMsgArray); }
public function getBizReportList() { $mainOrders = array(); $conditions = ""; $params = array(); $dates = array(); $shopID = base64_decode(Input::get('shop_id')); if (Request::ajax()) { if (0 == strcmp($shopID, ALL_SHOPS_FALG)) { $userID = Auth::id(); $shops = Shop::where('wy_shopkeeper', $userID)->where('wy_audit_state', SHOP_AUDIT_STATUS_4)->get(array('wy_shop_id')); $shopIDs = array(); foreach ($shops as $index => $shop) { array_push($shopIDs, $shop->wy_shop_id); } if (!empty($shopIDs)) { $this->getStatisticsConditions($conditions, $params, $dates, false); if (!empty($conditions) && !empty($params)) { $mainOrders = MainOrder::whereIn('wy_shop_id', $shopIDs)->whereRaw($conditions, $params)->orderBy('wy_generate_time')->paginate(PERPAGE_COUNT_10, array('wy_main_order_id', 'wy_shop_id', 'wy_order_number', 'wy_recv_name', 'wy_generate_time', 'wy_actual_money', 'wy_order_state', 'wy_reminder_flag')); foreach ($mainOrders as $index => $mainOrder) { $orderStatus = Dictionary::where('wy_dic_id', DIC_ORDER_STATUS)->where('wy_dic_item_id', $mainOrder->wy_order_state)->first(array('wy_dic_value')); $mainOrder->wy_order_state_name = $orderStatus->wy_dic_value; $reminderFlag = Dictionary::where('wy_dic_id', DIC_REMINDER_FLAG)->where('wy_dic_item_id', $mainOrder->wy_reminder_flag)->first(array('wy_dic_value')); $mainOrder->wy_reminder_flag_name = $reminderFlag->wy_dic_value; $shop = Shop::where('wy_shop_id', $mainOrder->wy_shop_id)->first(array('wy_shop_name')); if (!empty($shop)) { $mainOrder->wy_shop_name = $shop->wy_shop_name; } else { $mainOrder->wy_shop_name = $headerShop->wy_shop_name; } $mainOrder->wy_shop_id = base64_encode($mainOrder->wy_shop_id); $mainOrder->wy_main_order_id = base64_encode($mainOrder->wy_main_order_id); } } } else { $mainOrders = Paginator::make(array(), DEFAULT_0, PERPAGE_COUNT_10); } } else { $headerShop = AuthController::checkShop($shopID); if (!empty($headerShop)) { $this->getStatisticsConditions($conditions, $params, $dates, false); if (!empty($conditions) && !empty($params)) { $mainOrders = MainOrder::where('wy_shop_id', $shopID)->whereRaw($conditions, $params)->orderBy('wy_generate_time')->paginate(PERPAGE_COUNT_10, array('wy_main_order_id', 'wy_shop_id', 'wy_order_number', 'wy_recv_name', 'wy_generate_time', 'wy_actual_money', 'wy_order_state', 'wy_reminder_flag')); foreach ($mainOrders as $index => $mainOrder) { $orderStatus = Dictionary::where('wy_dic_id', DIC_ORDER_STATUS)->where('wy_dic_item_id', $mainOrder->wy_order_state)->first(array('wy_dic_value')); $mainOrder->wy_order_state_name = $orderStatus->wy_dic_value; $reminderFlag = Dictionary::where('wy_dic_id', DIC_REMINDER_FLAG)->where('wy_dic_item_id', $mainOrder->wy_reminder_flag)->first(array('wy_dic_value')); $mainOrder->wy_reminder_flag_name = $reminderFlag->wy_dic_value; $mainOrder->wy_shop_name = $headerShop->wy_shop_name; $mainOrder->wy_shop_id = base64_encode($mainOrder->wy_shop_id); $mainOrder->wy_main_order_id = base64_encode($mainOrder->wy_main_order_id); } } } else { $mainOrders = Paginator::make(array(), DEFAULT_0, PERPAGE_COUNT_10); } } } return View::make('admin.report.trade.bizreportlist', compact('mainOrders')); }
/** * 取消活动 */ public function postCancel() { $shopID = base64_decode(Input::get('shop_id')); $headerShop = AuthController::checkShop($shopID); $retCode = SUCCESS; $retMsg = ""; $activityID = Input::get('activity_id'); $shopActivitity = ShopActivity::where('wy_shop_id', $shopID)->where('wy_activity_id', $activityID)->first(); if (empty($shopActivitity)) { $retCode = -10024; $retMsg = Lang::get('errormessages.-10024'); $context = array("errorCode" => $retCode, "userID" => Auth::id(), "shopID" => $shopID, "activityID" => $activityID); Log::error($retMsg, $context); } else { $result = ShopActivity::where('wy_shop_id', $shopID)->where('wy_activity_id', $activityID)->update(array('wy_enable' => ACTIVITY_ENABLE_0)); if ($result) { $retMsg = Lang::get('messages.10019'); } else { $retCode = -15006; $retMsg = Lang::get('errormessages.-15006'); $context = array("errorCode" => $retCode, "userID" => Auth::id(), "shopID" => $shopID, "activityID" => $activityID); Log::error($retMsg, $context); } } $sendMsgArray = array("ret_code" => $retCode, "msg" => $retMsg); return Response::json($sendMsgArray); }
/** * 检测URL中shopID的参数 * * @param [int] $[shopID] [店铺的ID] * @param [bool] $[isGoBack] [是否返回] * * @return 成功 [Array] [店铺信息] 失败 返回错误页面或者刷新当前页面 */ public static function checkUserURL($isGoBack = false) { $shop = array(); if (Input::has('shopID')) { $shopID = base64_decode(Input::get('shopID')); if (0 == strcmp($shopID, ALL_SHOPS_FALG)) { $shop = (object) array("wy_shop_id" => base64_encode(ALL_SHOPS_FALG), "wy_shop_name" => ALL_SHOPS); } else { $shop = AuthController::checkShop($shopID, $isGoBack); } } return $shop; }
/** * 打印订单 * * @return Response */ public function getPrint($shop_id, $main_order_id) { $shopID = base64_decode($shop_id); $headerShop = AuthController::checkShop($shopID); $mainOrderID = base64_decode($main_order_id); if (empty($headerShop)) { App::abort(404); } else { $shop = Shop::where('wy_shop_id', $shopID)->first(); $shop->wy_shop_id = base64_encode($shop->wy_shop_id); $mainOrder = MainOrder::where('wy_shop_id', $shopID)->where('wy_main_order_id', $mainOrderID)->first(); $subOrders = MainOrder::find($mainOrder->wy_main_order_id)->subOrders()->get(array('wy_goods_id', 'wy_goods_name', 'wy_goods_unit_price', 'wy_goods_amount', 'wy_goods_total_price')); $goodsTotalAmout = MainOrder::find($mainOrder->wy_main_order_id)->subOrders()->sum('wy_goods_amount'); $mainOrder->goodsTotalAmout = $goodsTotalAmout; $mainOrder->subOrders = $subOrders; $mainOrder->wy_shop_id = base64_encode($mainOrder->wy_shop_id); $mainOrder->wy_main_order_id = base64_encode($mainOrder->wy_main_order_id); return View::make('admin.print.print', compact('mainOrder', 'shop')); } }