From 02c80e3dd1bf161489d38c019e88203662e86e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E7=81=BF=E6=A1=A2?= Date: Sun, 19 Jun 2016 20:21:25 +0800 Subject: [PATCH 1/6] xiugai --- .../Controllers/Order/OrderController.php | 5 ++- app/Http/Controllers/UserController.php | 37 +++++++++++++++++++ app/Http/routes.php | 1 + .../migrations/2016_04_28_014558_orders.php | 2 +- public/js/user-information.js | 25 ++++++++++++- resources/views/user-information.blade.php | 6 +-- 6 files changed, 69 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Order/OrderController.php b/app/Http/Controllers/Order/OrderController.php index bd6cefc..7d76688 100644 --- a/app/Http/Controllers/Order/OrderController.php +++ b/app/Http/Controllers/Order/OrderController.php @@ -73,8 +73,9 @@ public function getTemplates(){ session_start(); } $curName = $_SESSION['userName']; - $resSet = \DB::table('templates')->where('author_name', $curName)->get(); - return $resSet; + ///$resSet = \DB::table('templates')->where('author_name', $curName)->get(); + //return $resSet; + return $curName; } public function displayOrder(){ diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 7a8f85b..9e16aae 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -67,6 +67,43 @@ public function checkPwd(){ } + public function editInfo(){ + if(!isset($_SESSION)){ + session_start(); + } + $name=$_SESSION['username']; + $email=$_GET['email']; + + + $user = User::where('name',$name)->update(array('email'=>$email)); + $result = false; + if ($user != null) + $result = true; + if ($result) + return 1; + else + return 0; + } + + public function editPhone(){ + if(!isset($_SESSION)){ + session_start(); + } + + $name=$_GET['username']; + $phone=$_GET['email']; + + + $user = User::where('name',$name)->update(array('phone_number'=>$phone)); + $result = false; + if ($user != null) + $result = true; + if ($result) + return 1; + else + return 0; + } + public function editPwd(){ if(!isset($_SESSION)){ session_start(); diff --git a/app/Http/routes.php b/app/Http/routes.php index b671b0b..2c1a70c 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -247,6 +247,7 @@ Route::get('/usr/editUsername','UserController@editUsername'); Route::get('/usr/checkPwd','UserController@checkPwd'); Route::get('/usr/editPwd','UserController@editPwd'); +Route::get('/usr/editInfo','UserController@editInfo'); Route::get('/usr/checkIfMobile','UserController@checkIfMobile'); Route::get('/usr/getCpyUsers','UserController@getCpyUsers'); Route::get('/usr/getCommonUsers','UserController@getCommonUsers'); diff --git a/database/migrations/2016_04_28_014558_orders.php b/database/migrations/2016_04_28_014558_orders.php index d9b2acf..2cbef84 100644 --- a/database/migrations/2016_04_28_014558_orders.php +++ b/database/migrations/2016_04_28_014558_orders.php @@ -25,7 +25,7 @@ public function up() $table->string('comment')->nullable();//备注 $table->timestamps(); $table->string('assess')->nullable();//评价 - $table->integer('mplate')->default(0);//模版ID + $table->integer('template')->default(0);//模版ID }); Schema::table('orders', function (Blueprint $table) { diff --git a/public/js/user-information.js b/public/js/user-information.js index 2cf3a15..40570f8 100644 --- a/public/js/user-information.js +++ b/public/js/user-information.js @@ -67,7 +67,6 @@ function CheckIntensity(pwd){ yinjiApp.controller('userInfoCtrl', function userInfoCtrl($scope,$http,$rootScope){ - $scope.userImgSrc = "/images/create_album/profile.jpg"; //console.log($scope.userImgSrc); $scope.msg = ""; @@ -75,6 +74,7 @@ yinjiApp.controller('userInfoCtrl', $scope.identicalMsg=""; $scope.errMsgColor = "red"; + //获取用户名并显示在首页上 $http.get("/getUserName") .success(function (response) @@ -82,6 +82,7 @@ yinjiApp.controller('userInfoCtrl', $scope.username = response; }); + //查看该用户是否设置了手机 $http.get("/usr/checkIfMobile") .success(function(response){ @@ -117,6 +118,28 @@ yinjiApp.controller('userInfoCtrl', }); }; + //更改用户信息(邮箱) + $scope.editInfo = function(){ + console.log($scope.emailName); + var email = $scope.emailName+"@"+$scope.emailSuffix+".com"; + $http({ + method:'GET', + url:"/usr/editInfo", + params:{ + 'username':$scope.username, + 'email':email + } + }) + .success(function (response) + { + if (response == 1){ + alert("修改成功!"); + }else if (response == 0){ + alert("oops...修改失败..."); + } + }); + }; + $scope.editUsername = function(){ $http({ method:'GET', diff --git a/resources/views/user-information.blade.php b/resources/views/user-information.blade.php index 527fc39..56e4a76 100644 --- a/resources/views/user-information.blade.php +++ b/resources/views/user-information.blade.php @@ -39,12 +39,12 @@

邮箱:

- + @ - + .com
- + From 473b026bba46f9b92f7e59ca2db9f03777332113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E7=81=BF=E6=A1=A2?= Date: Sun, 19 Jun 2016 21:14:28 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/migrations/2016_04_28_014558_orders.php | 2 +- resources/views/company/cpy_checkOrder.blade.php | 1 - resources/views/layouts/cpy_sidebar.blade.php | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/database/migrations/2016_04_28_014558_orders.php b/database/migrations/2016_04_28_014558_orders.php index 2cbef84..767e35f 100644 --- a/database/migrations/2016_04_28_014558_orders.php +++ b/database/migrations/2016_04_28_014558_orders.php @@ -68,7 +68,7 @@ public function up() 'quantity' => 25, 'address' => '山西省阳泉市盂县xx镇', 'status'=> '已送达', - 'comment'=>'' + 'comment'=>'减肥日记哈哈哈哈哈' ), array( 'user_name' => 'yhc', diff --git a/resources/views/company/cpy_checkOrder.blade.php b/resources/views/company/cpy_checkOrder.blade.php index ee85024..d493330 100644 --- a/resources/views/company/cpy_checkOrder.blade.php +++ b/resources/views/company/cpy_checkOrder.blade.php @@ -121,7 +121,6 @@
备注信息: - *此项必填
diff --git a/resources/views/layouts/cpy_sidebar.blade.php b/resources/views/layouts/cpy_sidebar.blade.php index 7c81444..4cf08ec 100644 --- a/resources/views/layouts/cpy_sidebar.blade.php +++ b/resources/views/layouts/cpy_sidebar.blade.php @@ -175,7 +175,7 @@ 公司管理