From 3be3fc8fe976b4003b2423230aed09c69b2ade70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E7=81=BF=E6=A1=A2?= Date: Mon, 20 Jun 2016 09:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=8F=B8=E6=96=B0=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8F=90=E9=86=92=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/CpyController.php | 2 +- .../Controllers/Order/OrderController.php | 32 +++++++++++++------ public/js/layouts/cpy_sidebar/cpy_sidebar.js | 6 +++- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/CpyController.php b/app/Http/Controllers/CpyController.php index 0480b55..316e368 100644 --- a/app/Http/Controllers/CpyController.php +++ b/app/Http/Controllers/CpyController.php @@ -72,7 +72,7 @@ public function getBadEva(){ * @return 所有订单 */ public function getOrders(){ - return Order::all(); + return Order::where([])->orderBy('id')->get(); } /** diff --git a/app/Http/Controllers/Order/OrderController.php b/app/Http/Controllers/Order/OrderController.php index e515b32..bfe8e48 100644 --- a/app/Http/Controllers/Order/OrderController.php +++ b/app/Http/Controllers/Order/OrderController.php @@ -5,6 +5,7 @@ use Illuminate\Http\Request; use App\Order; +use App\Evaluation; use App\Http\Requests; use App\Http\Controllers\Controller; @@ -98,18 +99,29 @@ public function assessOrder(){ //\DB::table('orders')->where('id', $orderId)->update(['assess' => $detail]); - $eid = \DB::table('evaluation') - ->insertGetId( - array( - 'order_id' => $orderId, - 'parent_eva_id' => "-1", - 'user_name' => $curName, - 'reply_user_name' => "", - 'content' => $detail - ) - ); + $newEvaluation = new Evaluation; + $newEvaluation->order_id=$orderId; + $newEvaluation->parent_eva_id="-1"; + $newEvaluation->user_name=$curName; + $newEvaluation->reply_user_name=""; + $newEvaluation->content=$detail; + $eid = $newEvaluation->save(); +// $eid = \DB::table('evaluation') +// ->insertGetId( +// array( +// 'order_id' => $orderId, +// 'parent_eva_id' => "-1", +// 'user_name' => $curName, +// 'reply_user_name' => "", +// 'content' => $detail +// ) +// ); //return $detail. "#".$orderId."#".$curName; + if ($eid) + return 1; + else + return null; return $eid; } } diff --git a/public/js/layouts/cpy_sidebar/cpy_sidebar.js b/public/js/layouts/cpy_sidebar/cpy_sidebar.js index 5ef74cf..3fce6f8 100644 --- a/public/js/layouts/cpy_sidebar/cpy_sidebar.js +++ b/public/js/layouts/cpy_sidebar/cpy_sidebar.js @@ -63,8 +63,11 @@ yinjiApp.controller('cpyNavController', $http.get("/cpy/getEvaluations") .success(function (response) { + console.log(response); + console.log(response.length); + console.log(response[response.length-1]); if (response != null && response.length > 0){ - var fullDateInfo = response[response.length-1].created_at.split(" "); + var fullDateInfo = response[0].created_at.split(" "); var date = fullDateInfo[0].split("-"); date[0]=parseInt(date[0]); date[1]=parseInt(date[1]); @@ -88,6 +91,7 @@ yinjiApp.controller('cpyNavController', $http.get("/cpy/getOrders") .success(function (response) { + console.log(response); if (response != null && response.length > 0) { var fullDateInfo = response[response.length - 1].order_date.split(" "); var date = fullDateInfo[0].split("-");