Skip to content

Commit

Permalink
修改
Browse files Browse the repository at this point in the history
  • Loading branch information
xx502003587 committed Jun 19, 2016
2 parents 28ae1c8 + d66a417 commit a8e04f3
Show file tree
Hide file tree
Showing 14 changed files with 185 additions and 48 deletions.
9 changes: 6 additions & 3 deletions app/Http/Controllers/Order/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function addOrder(){
$oComment = $_GET['oComment'];
$oNum = $_GET['oNum'];
$oPrice = $_GET['oPrice'];

$orderTime = date('y-m-d H:i:s', time());

$userId = $_SESSION['userId'];
Expand Down Expand Up @@ -55,7 +55,9 @@ public function addOrder(){
//模版使用次数自增
\DB::table('templates')->where('id', $oTem)->increment('count');

return $eid;
//return $eid;

return $curAlbumName[0];
}


Expand All @@ -73,9 +75,10 @@ public function getTemplates(){
session_start();
}
$curName = $_SESSION['userName'];
$resSet = \DB::table('templates')->where('author_name', $curName)->get();
$resSet = \DB::table('templates')->get();
return $resSet;
//return $curName;

}

public function displayOrder(){
Expand Down
37 changes: 37 additions & 0 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
15 changes: 11 additions & 4 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
return view('about_us');
});

Route::get('/contact_us',function(){
return view('contact_us');
});


Route::get('/cpy_info',function(){
return view('company.cpy_info');
});


//在前端获取当前用户名
Route::get('/getUserName',function(){
if(!isset($_SESSION)){
Expand All @@ -48,10 +58,6 @@
return $_SESSION['privilege'];
});

Route::get('/contact_us',function(){
return view('contact_us');
});

Route::group(['middleware'=>'auth'], function() {//中间件,拦截,用于登录验证

Route::get('/album_create_records', function () {
Expand Down Expand Up @@ -247,6 +253,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');
Expand Down
21 changes: 14 additions & 7 deletions database/migrations/2016_04_28_014558_orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function up()
$table->string('comment')->nullable();//备注
$table->timestamps();
$table->string('assess')->nullable();//评价
$table->integer('<te></te>mplate')->default(0);//模版ID
$table->integer('template')->default(0);//模版ID
});

Schema::table('orders', function (Blueprint $table) {
Expand All @@ -41,16 +41,19 @@ public function up()
'quantity' => 23,
'address' => '山西省阳泉市盂县xx镇',
'status'=> '已付款',
'comment'=>'可不可以给我弄瘦一点啊!'
'comment'=>'可不可以给我弄瘦一点啊!',
'order_date'=>'2016-03-12 23:42:23'
),
array(
'user_name' => 'zcz',
'album_name' => '我的减肥日记',
'price'=> 48,
'quantity' => 32,
'address' => '福建省厦门市思明区厦大海滨7-602',
'status'=> '已付款',
'comment'=>''
'status'=> '已送达',
'comment'=>'',
'order_date'=>'2016-03-24 14:25:43',
'delivery_date'=>'2016-03-26 18:42:42'
),
array(
'user_name' => 'yhc',
Expand All @@ -59,7 +62,8 @@ public function up()
'quantity' => 11,
'address' => '辽宁省沈阳市和平区',
'status'=> '送货中',
'comment'=>'我要帅帅哒'
'comment'=>'我要帅帅哒',
'order_date'=>'2016-04-23 13:32:21'
),
array(
'user_name' => 'jp',
Expand All @@ -68,7 +72,9 @@ public function up()
'quantity' => 25,
'address' => '山西省阳泉市盂县xx镇',
'status'=> '已送达',
'comment'=>''
'comment'=>'减肥日记哈哈哈哈哈',
'order_date'=>'2016-05-09 14:42:54',
'delivery_date'=>'2016-05-11 15:47:22',
),
array(
'user_name' => 'yhc',
Expand All @@ -77,7 +83,8 @@ public function up()
'quantity' => 12,
'address' => '辽宁省沈阳市和平区',
'status'=> '送货中',
'comment'=>'我要帅帅哒'
'comment'=>'我要帅帅哒',
'order_date'=>'2016-06-17 19:22:51'
),
)
);
Expand Down
4 changes: 2 additions & 2 deletions public/js/company/cpy_checkOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ yinjiApp.controller('checkOrderCtrl',
alert("对不起,您没有进行任何修改!");
return;
}
if (!/^[0-9]*$/.test($scope.orderDetail.price)) {
alert("对不起,单价必须为整数!");
if (isNaN($scope.orderDetail.price)) {
alert("对不起,单价必须为数字!");
return;
}

Expand Down
9 changes: 6 additions & 3 deletions public/js/company/cpy_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,26 @@ yinjiApp.controller('cpyIndexController',
$http.get("/cpy/getOrders")
.success(function (response)
{
console.log("Nihao ");
//首页这里只显示前5个订单
for (var i = 0 ; i < 5; i++){
if(response[i] != null)
$scope.deployedOrder[i] = response[i];
}
//获取首页报表数据
var date,quantity,orderDate,data=new Object();
console.log (response.length);
for (i=0; i<response.length; i++){
date = (response[i].order_date.split(" "))[0];
quantity = response[i].quantity;
console.log("date:"+date);
quantity = parseInt(response[i].quantity);
if (data[date] == null)
data[date] = quantity;
else{
data[date]+=quantity;
data[date] += quantity;
}
}
console.log(data);
console.log("data:"+data);
setMorrisChart(data);
});

Expand Down
65 changes: 43 additions & 22 deletions public/js/create_records/order.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
window.imgList = "";
window.temId = 0;

function deleteOrder(){
$.ajax({
type: 'get',
url: '/deleteOrder',

dataType : "text",
success : function(data) {
if(data != null){
console.log(data);
//alert("删除成功!");
//window.location.href = "/home";
}
},
error : function() {
alert("false");
}
});

}

function selectTemplate(objId){
for (var i = 0; i < imgList.length; i++) {
Expand Down Expand Up @@ -53,15 +35,15 @@ yinjiApp.controller('orderController',
})
.success(function(data) {
if(data != null){
console.log(data.length);
console.log(data);
imgList = data;
for(var i = 0; i < data.length; i++){
var ele = "<img src = '" + data[i].saving_path + "' id = 'img" + data[i].id + "' title = '" + data[i].description + "' onclick = 'selectTemplate(this.id)' class = 'noBorder'>";
$("div.order_text").append(ele);
var ele = "<img src = '" + data[i].saving_path + "' id = 'img" + data[i].id + "' title = '" + data[i].description + "' onclick = 'selectTemplate(this.id)' class = 'noBorder'>";
$("div.order_text").append(ele);
}
if(data.length != 0){
temId = "img" + data[0].id;
document.getElementById(temId).className = "hasBorder";
document.getElementById(temId).className = "hasBorder";
}

}
Expand All @@ -72,7 +54,12 @@ yinjiApp.controller('orderController',


$scope.addOrder = function(){
<<<<<<< HEAD
if($("#text_box2").val() == 0 || $("#text_box1").val() == 0){
=======

if($("#text_box2").val() < $("#text_box1").val()){
>>>>>>> d66a417a02acaa3755d91df5b496faa927fb490d
alert("页码错误");
}else{
if($("#text_box2").val() < $("#text_box1").val()){
Expand All @@ -87,6 +74,7 @@ yinjiApp.controller('orderController',
commentText = "无";
}

<<<<<<< HEAD
if(temId == 0){
var oTem = 0;
}else{
Expand Down Expand Up @@ -118,6 +106,39 @@ yinjiApp.controller('orderController',
}
});
}
=======
if(temId == 0){
//console.log("00000");
var oTem = 0;
}else{
var oTem = temId.substring(3,4);

}

$http({
method: 'GET',//注意,这里必须要用GET方法
url:'/addOrder',
params:{
'oName': $scope.oName,
'oPhone': $scope.oPhone,
'oAddress' : $scope.oAddress,
'oComment' : commentText,
'oNum' : pageRange,
'oPrice' : pagePrice,
'oTemplate' : oTem
}
})
.success(function(data) {
if(data != null){
console.log(data);
alert("成功!");
window.location.href = "/orderInfo";
}
else{
console.log("false");
}
});
>>>>>>> d66a417a02acaa3755d91df5b496faa927fb490d
}


Expand Down
3 changes: 2 additions & 1 deletion public/js/orderDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ function deleteOrder(objId, obj){
if(data != null){
console.log(data);
alert("删除成功!");
deleteCurRow(obj);
//deleteCurRow(obj);
window.location.reload();
}
},
error : function() {
Expand Down
25 changes: 24 additions & 1 deletion public/js/user-information.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,22 @@ function CheckIntensity(pwd){

yinjiApp.controller('userInfoCtrl',
function userInfoCtrl($scope,$http,$rootScope){

$scope.userImgSrc = "/images/create_album/profile.jpg";
//console.log($scope.userImgSrc);
$scope.msg = "";
$scope.msgIndex = 0;
$scope.identicalMsg="";
$scope.errMsgColor = "red";


//获取用户名并显示在首页上
$http.get("/getUserName")
.success(function (response)
{
$scope.username = response;
});


//查看该用户是否设置了手机
$http.get("/usr/checkIfMobile")
.success(function(response){
Expand Down Expand Up @@ -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',
Expand Down
1 change: 0 additions & 1 deletion resources/views/about_us.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@extends('layouts.content')

@section('title','公司信息')
@section('cpy_subtitle','公司信息')

@section('header')
@parent
Expand Down
Loading

0 comments on commit a8e04f3

Please sign in to comment.