diff --git a/app/Http/Controllers/Admin/ArticleController.php b/app/Http/Controllers/Admin/ArticleController.php index bef5df3..2c260c7 100644 --- a/app/Http/Controllers/Admin/ArticleController.php +++ b/app/Http/Controllers/Admin/ArticleController.php @@ -81,16 +81,6 @@ class ArticleController extends CommonController public function add() { - $validate = new ArticleRequest(); - $validator = Validator::make($_REQUEST, $validate->getSceneRules('add'), $validate->getSceneRulesMessages()); - - if ($validator->fails()) - { - //$validator->errors()->first(); - //$validator->errors()->all(); - error_jump('参数错误'); - } - $data = ''; if(!empty($_REQUEST["catid"])){$data['catid'] = $_REQUEST["catid"];}else{$data['catid'] = 0;} @@ -99,6 +89,17 @@ class ArticleController extends CommonController public function doadd() { + //数据验证 + /* $validate = new ArticleRequest(); + $validator = Validator::make($_REQUEST, $validate->getSceneRules('add'), $validate->getSceneRulesMessages()); + + if ($validator->fails()) + { + //$validator->errors()->first(); + //$validator->errors()->all(); + error_jump('参数错误'); + } */ + $litpic="";if(!empty($_POST["litpic"])){$litpic = $_POST["litpic"];}else{$_POST['litpic']="";} //缩略图 if(empty($_POST["description"])){if(!empty($_POST["body"])){$_POST['description']=cut_str($_POST["body"]);}} //description $content="";if(!empty($_POST["body"])){$content = $_POST["body"];} diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 3bf7479..49a8145 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Admin\CommonController; use DB; use App\Http\Model\User; +use App\Common\Helper; class UserController extends CommonController { @@ -52,6 +53,44 @@ class UserController extends CommonController return view('admin.user.money', $data); } + //人工充值 + public function manualRecharge() + { + if(Helper::isPostRequest()) + { + if(!is_numeric($_POST["money"]) || $_POST["money"]==0){error_jump('金额格式不正确');} + + unset($_POST["_token"]); + + if($_POST["money"]>0) + { + DB::table('user')->where(['id'=>$_POST["id"]])->increment('money', $_POST["money"]); + $user_money['type'] = 0; + } + else + { + DB::table('user')->where(['id'=>$_POST["id"]])->decrement('money', abs($_POST["money"])); + $user_money['type'] = 1; + } + + $user_money['user_id'] = $_POST["id"]; + $user_money['add_time'] = time(); + $user_money['money'] = abs($_POST["money"]); + $user_money['des'] = '后台充值'; + $user_money['user_money'] = DB::table('user')->where(array('id'=>$_POST["id"]))->value('money'); + + //添加用户余额记录 + DB::table('user_money')->insert($user_money); + + success_jump('操作成功', route('admin_user')); + } + + $data['user'] = object_to_array(DB::table('user')->select('user_name', 'mobile', 'money', 'id')->where('id', $_REQUEST["user_id"])->first(), 1); + if(!$data['user']){error_jump('参数错误');} + + return view('admin.user.manualRecharge', $data); + } + public function add() { return view('admin.user.add'); @@ -72,6 +111,21 @@ class UserController extends CommonController public function edit() { + if(Helper::isPostRequest()) + { + if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;} + + unset($_POST["_token"]); + if(DB::table('user')->where('id', $id)->update($_POST)) + { + success_jump('修改成功!', route('admin_user')); + } + else + { + error_jump('修改失败!'); + } + } + if(!empty($_GET["id"])){$id = $_GET["id"];}else{$id="";} if(preg_match('/[0-9]*/',$id)){}else{exit;} @@ -81,21 +135,6 @@ class UserController extends CommonController return view('admin.user.edit', $data); } - public function doedit() - { - if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;} - - unset($_POST["_token"]); - if(DB::table('user')->where('id', $id)->update($_POST)) - { - success_jump('修改成功!', route('admin_user')); - } - else - { - error_jump('修改失败!'); - } - } - public function del() { if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');} diff --git a/app/Http/Controllers/Admin/UserRankController.php b/app/Http/Controllers/Admin/UserRankController.php new file mode 100644 index 0000000..b20a4e2 --- /dev/null +++ b/app/Http/Controllers/Admin/UserRankController.php @@ -0,0 +1,92 @@ +$v) + { + + } + } + + return view('admin.userrank.index', $data); + } + + public function add() + { + if(Helper::isPostRequest()) + { + if(isset($_POST['editorValue'])){unset($_POST['editorValue']);} + unset($_POST["_token"]); + + if(DB::table('user_rank')->insert(array_filter($_POST))) + { + success_jump('添加成功!', route('admin_slide')); + } + else + { + error_jump('添加失败!请修改后重新添加'); + } + } + + return view('admin.userrank.add'); + } + + public function edit() + { + if(Helper::isPostRequest()) + { + if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else{$id="";exit;} + + if(isset($_POST['editorValue'])){unset($_POST['editorValue']);} + unset($_POST["_token"]); + + if(DB::table('user_rank')->where('id', $id)->update($_POST)) + { + success_jump('修改成功!', route('admin_slide')); + } + else + { + error_jump('修改失败!'); + } + } + + if(!empty($_GET["id"])){$id = $_GET["id"];}else{$id="";} + if(preg_match('/[0-9]*/',$id)){}else{exit;} + + $data['id'] = $id; + $data['post'] = object_to_array(DB::table('user_rank')->where('id', $id)->first(), 1); + + return view('admin.userrank.edit', $data); + } + + public function del() + { + if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');} + + if(DB::table('user_rank')->whereIn("id", explode(',', $id))->delete()) + { + success_jump('删除成功'); + } + else + { + error_jump('删除失败!请重新提交'); + } + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Admin/UserWithdrawController.php b/app/Http/Controllers/Admin/UserWithdrawController.php index 4049150..578417a 100644 --- a/app/Http/Controllers/Admin/UserWithdrawController.php +++ b/app/Http/Controllers/Admin/UserWithdrawController.php @@ -21,7 +21,7 @@ class UserWithdrawController extends CommonController { foreach($posts as $k=>$v) { - $posts[$k]->user = DB::table('user')->where('id', $v->id)->first(); + $posts[$k]->user = DB::table('user')->where('id', $v->user_id)->first(); $posts[$k]->status_text = UserWithdraw::getStatusText(['status'=>$v->status]); } } @@ -72,16 +72,22 @@ class UserWithdrawController extends CommonController { $data['status'] = 4; - + //增加用户余额 + DB::table('user')->where(array('id'=>$user_withdraw->user_id))->increment('money', $user_withdraw->money); + //添加用户余额记录 + DB::table('user_money')->insert(array('user_id'=>$user_withdraw->user_id,'type'=>0,'money'=>$user_withdraw->money,'des'=>'提现失败-返余额','user_money'=>DB::table('user')->where(array('id'=>$user_withdraw->user_id))->value('money'),'add_time'=>time())); } elseif($_POST["type"]==1) { $data['status'] = 2; } - if(!isset($data)){$res = DB::table('user_withdraw')->where('id', $id)->update($data);} - - if(!isset($res)){return ReturnData::create(ReturnData::SYSTEM_FAIL);} + if(isset($data)) + { + $res = DB::table('user_withdraw')->where('id', $id)->update($data); + + if(!$res){return ReturnData::create(ReturnData::SYSTEM_FAIL);} + } return ReturnData::create(ReturnData::SUCCESS); } diff --git a/app/Http/Controllers/Home/IndexController.php b/app/Http/Controllers/Home/IndexController.php index c61f01c..ef481e4 100644 --- a/app/Http/Controllers/Home/IndexController.php +++ b/app/Http/Controllers/Home/IndexController.php @@ -28,20 +28,20 @@ class IndexController extends CommonController //商品列表页 public function goodslist(Request $request) { - $cat = $request->input('id', ''); + $typeid = $request->input('id', ''); $page = $request->input('page', ''); //推荐 - $tuijian = $request->input('tuijian', ''); - if($tuijian){$where['tuijian'] = $tuijian;} + if($request->input('tuijian', '') != ''){$where['tuijian'] = $request->input('tuijian');} + if($request->input('brand_id', '') != ''){$where['brand_id'] = $request->input('brand_id');} $pagenow = $page; $post = ''; - if($cat) + if($typeid) { - $where['typeid'] = $cat; - $post = object_to_array(DB::table('goods_type')->where('id', $cat)->first(), 1); + $where['typeid'] = $typeid; + $post = object_to_array(DB::table('goods_type')->where('id', $typeid)->first(), 1); } $data['post'] = $post; @@ -49,6 +49,8 @@ class IndexController extends CommonController $goods = DB::table("goods"); if(isset($where)){$goods = $goods->where($where);} + if($request->input('keyword', '') != ''){$goods = $goods->where('title', 'like', '%'.$request->input('keyword').'%');} + $counts = $goods->count(); if($counts>sysconfig('CMS_MAXARC')){$counts=sysconfig('CMS_MAXARC');} $pagesize = sysconfig('CMS_PAGESIZE');$page=0; @@ -67,7 +69,7 @@ class IndexController extends CommonController $data['pagenav'] = '';if($nextpage<=$pages && $nextpage>0){$data['pagenav'] = $this->listpageurl(route('home_goodslist'),$_SERVER['QUERY_STRING'],$nextpage);} $data['goods_type_list'] = object_to_array(DB::table('goods_type')->where(['pid'=>0,'status'=>1])->select('id','name')->take(30)->orderBy('listorder','asc')->get()); - $data['id'] = $cat; + $data['id'] = $typeid; return view('home.index.goodslist', $data); } @@ -111,7 +113,9 @@ class IndexController extends CommonController if($page==1 || $page==0){}else{$res['page'] = $page;} - return $http_host.'?'.http_build_query($res); + if($res){$res = $http_host.'?'.http_build_query($res);} + + return $res; } //列表页 @@ -151,6 +155,49 @@ class IndexController extends CommonController return view('home.index.'.$post['templist'], $data); } + //文章列表页 + public function arclist(Request $request) + { + $cat = $request->input('id', ''); + $page = $request->input('page', ''); + + $pagenow = $page; + $post = ''; + + if($cat) + { + $where['typeid'] = $cat; + $post = object_to_array(DB::table('arctype')->where('id', $cat)->first(), 1); + } + + $data['post'] = $post; + + $article = DB::table("article"); + if(isset($where)){$article = $article->where($where);} + + $counts = $article->count(); + if($counts>sysconfig('CMS_MAXARC')){$counts=sysconfig('CMS_MAXARC');dd($counts);} + $pagesize = sysconfig('CMS_PAGESIZE');$page=0; + if($counts % $pagesize){//取总数据量除以每页数的余数 + $pages = intval($counts/$pagesize) + 1; //如果有余数,则页数等于总数据量除以每页数的结果取整再加一,如果没有余数,则页数等于总数据量除以每页数的结果 + }else{$pages = $counts/$pagesize;} + if(!empty($pagenow)){if($pagenow==1 || $pagenow>$pages){return redirect()->route('page404');}$page = $pagenow-1;$nextpage=$pagenow+1;$previouspage=$pagenow-1;}else{$page = 0;$nextpage=2;$previouspage=0;} + $data['page'] = $page; + $data['pages'] = $pages; + $data['counts'] = $counts; + $start = $page*$pagesize; + + $posts = object_to_array($article->skip($start)->take($pagesize)->get()); + + $data['posts'] = $posts; //获取列表 + $data['pagenav'] = '';if($nextpage<=$pages && $nextpage>0){$data['pagenav'] = $this->listpageurl(route('home_arclist'),$_SERVER['QUERY_STRING'],$nextpage);} + + $data['arctype_list'] = object_to_array(DB::table('arctype')->where(['pid'=>0,'is_show'=>0])->select('id','name')->take(30)->orderBy('listorder','asc')->get()); + $data['id'] = $cat; + + return view('home.index.arclist', $data); + } + //文章详情页 public function detail($id) { diff --git a/app/Http/Controllers/Weixin/WxPayController.php b/app/Http/Controllers/Weixin/WxPayController.php index 83a3211..f67f9b1 100644 --- a/app/Http/Controllers/Weixin/WxPayController.php +++ b/app/Http/Controllers/Weixin/WxPayController.php @@ -47,7 +47,7 @@ class WxPayController extends CommonController //更新充值支付记录状态 DB::table('user_recharge')->where(array('recharge_sn'=>$post_data['out_trade_no'],'status'=>0))->update(array('pay_time'=>$pay_time_timestamp,'pay_type'=>1,'status'=>1,'trade_no'=>$post_data['transaction_id'],'pay_money'=>$pay_money)); //增加用户余额 - DB::table('user')->where(array('id'=>$user_recharge->user_id))->decrement('money', $pay_money); + DB::table('user')->where(array('id'=>$user_recharge->user_id))->increment('money', $pay_money); //添加用户余额记录 DB::table('user_money')->insert(array('user_id'=>$user_recharge->user_id,'type'=>0,'money'=>$pay_money,'des'=>'充值','user_money'=>DB::table('user')->where(array('id'=>$user_recharge->user_id))->value('money'),'add_time'=>time())); } diff --git a/public/css/style.css b/public/css/style.css index 43471e2..f01effd 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -32,6 +32,12 @@ a{color:#313131;text-decoration:none;}a:hover{text-decoration:none;color:#22ac38 .pul .dock .sold-num {filter: none;display: inline-block;line-height: 20px;padding: 0 6px;background-color: rgba(0,0,0,.1);filter: progid:DXImageTransform.Microsoft.gradient(enabled='true', startColorstr='#19000000', endColorstr='#19000000');-webkit-border-radius: 3px;-webkit-background-clip: padding-box;-moz-border-radius: 3px;-moz-background-clip: padding;border-radius: 3px;background-clip: padding-box;color: #fff;font-size: 12px;} .pul .dock .sold-num em {font-size: 14px;color: #fff;font-weight: 700;line-height: 17px;} +.list{padding:20px 0;border-bottom:1px solid #e5e5e5;} +.tit{display:block;font-weight:normal;font-size:24px;line-height:1.3;} +.list p{margin-top:10px;word-break:break-all;color:#999;font-size:14px;line-height:1.5;}.list p a{color:#e74c3c;}.list p:after{content:"..";} +.info{margin-top:8px;color:#bbb;font-size:12px;}.info a{color:#ea5a3d;margin-right:8px;}.info .fr{color:#444;} +.list .limg{width:169px;height:119px;float:left;margin-right:20px;}.list .limg img{width:169px;height:119px;vertical-align:top;} + .page,.pages{text-align:center;padding:15px 0px;}.page a:hover{background:#FF5E52;color:#fff;} .page a{display:inline-block;height:32px;line-height:32px;padding:0 45px;font-size:14px;color:#fff;background:#22ac38;margin-right:8px;border-radius:3px;box-shadow:1px 1px 2px #eee;} @@ -56,7 +62,7 @@ a{color:#313131;text-decoration:none;}a:hover{text-decoration:none;color:#22ac38 .ju-naver a {display: block;text-decoration: none;} .ju-naver .nav-menu {float: right;margin-top: 28px;} .ju-naver .nav-menu li {display: inline-block;position: relative;margin-right: 2px;} -.ju-naver .nav-menu a {color: #4A4A4A;font-size: 16px;position: relative;height: 26px;line-height: 26px;padding: 0 6px;-webkit-border-radius: 3px;-webkit-background-clip: padding-box;-moz-border-radius: 3px;-moz-background-clip: padding;border-radius: 3px;background-clip: padding-box;} +.ju-naver .nav-menu a {color: #4A4A4A;font-size: 16px;position: relative;padding:2px 6px;-webkit-border-radius: 3px;-webkit-background-clip: padding-box;-moz-border-radius: 3px;-moz-background-clip: padding;border-radius: 3px;background-clip: padding-box;} .ju-naver .nav-menu a:hover {background-color: #EDEDED;} #slideBox{width:740px;height:347px;overflow:hidden;position:relative;} diff --git a/public/images/logo.png b/public/images/logo.png index 11e550c..9466235 100644 Binary files a/public/images/logo.png and b/public/images/logo.png differ diff --git a/public/images/logo2.png b/public/images/logo2.png new file mode 100644 index 0000000..6bab1ee Binary files /dev/null and b/public/images/logo2.png differ diff --git a/resources/views/admin/UserWithdraw/index.blade.php b/resources/views/admin/UserWithdraw/index.blade.php index c8307d9..278951f 100644 --- a/resources/views/admin/UserWithdraw/index.blade.php +++ b/resources/views/admin/UserWithdraw/index.blade.php @@ -19,7 +19,7 @@ id; ?> -user->user_name; ?>
user->mobile){echo 'TEL:'.$row->user->mobile;} ?> +user->user_name; ?>user->mobile){echo '
TEL:'.$row->user->mobile;} ?> money; ?> name; ?> method; ?> diff --git a/resources/views/admin/user/edit.blade.php b/resources/views/admin/user/edit.blade.php index 65b5341..1c91ec0 100644 --- a/resources/views/admin/user/edit.blade.php +++ b/resources/views/admin/user/edit.blade.php @@ -1,34 +1,23 @@ @extends('admin.layouts.app') -@section('title', '管理员修改') +@section('title', '会员信息修改') @section('content') -
管理员列表 > 管理员修改
+
会员列表 > 会员信息修改
-
{{ csrf_field() }} +{{ csrf_field() }} + - - + + - - - - - - - - - + diff --git a/resources/views/admin/user/index.blade.php b/resources/views/admin/user/index.blade.php index 3736b3e..081a924 100644 --- a/resources/views/admin/user/index.blade.php +++ b/resources/views/admin/user/index.blade.php @@ -2,7 +2,7 @@ @section('title', '会员列表') @section('content') -

会员列表

[ 添加会员 ] [ 账户记录 ]

+

会员列表

[ 添加会员 ] [ 账户记录 ] [ 会员等级 ]

用户名:" class="required" style="width:30%" placeholder="在此输入用户名">昵称:" style="width:30%">
密码:
邮箱:" style="width:30%">
角色:性别: - + value="1">男 + value="2">女
@@ -28,7 +28,7 @@ - +
commission; ?> add_time); ?> status_text; ?>人工充值 | 帐户记录 | 修改id<>1){ ?> | 删除人工充值 | 帐户记录 | 修改status==1){ ?> | 删除
diff --git a/resources/views/admin/user/manualRecharge.blade.php b/resources/views/admin/user/manualRecharge.blade.php new file mode 100644 index 0000000..321d127 --- /dev/null +++ b/resources/views/admin/user/manualRecharge.blade.php @@ -0,0 +1,54 @@ +@extends('admin.layouts.app') +@section('title', '人工充值') + +@section('content') +

人工充值

+ +
{{ csrf_field() }} + + + + + + + + + + + + + + + +
当前充值用户:,账户余额
说明:正数为增加,负数为扣除
充值金额: + +
  
+ +@endsection \ No newline at end of file diff --git a/resources/views/admin/userrank/add.blade.php b/resources/views/admin/userrank/add.blade.php new file mode 100644 index 0000000..68d31ed --- /dev/null +++ b/resources/views/admin/userrank/add.blade.php @@ -0,0 +1,119 @@ +@extends('admin.layouts.app') +@section('title', '轮播图添加') + +@section('content') +
轮播图列表 > 添加轮播图
+ +
{{ csrf_field() }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
标题:
链接网址: (请用绝对地址)
跳转方式: +  _blank   +  _self +
显示平台: +  pc   +  weixin   +  app   +  wap +
是否显示: +  是   +  否 +
排序: + +
所属的组: + +
图片:
  
+ +@endsection \ No newline at end of file diff --git a/resources/views/admin/userrank/edit.blade.php b/resources/views/admin/userrank/edit.blade.php new file mode 100644 index 0000000..a641795 --- /dev/null +++ b/resources/views/admin/userrank/edit.blade.php @@ -0,0 +1,119 @@ +@extends('admin.layouts.app') +@section('title', '轮播图修改') + +@section('content') +
轮播图列表 > 轮播图修改
+ +
{{ csrf_field() }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
标题:
链接网址: (请用绝对地址)
跳转方式: + /> _blank   + /> _self +
显示平台: + /> pc   + /> weixin   + /> app   + /> wap +
是否显示: + /> 是   + /> 否 +
排序: + +
所属的组: + +
图片: " src="" width="120" height="80" id="picview">
  
+ +@endsection \ No newline at end of file diff --git a/resources/views/admin/userrank/index.blade.php b/resources/views/admin/userrank/index.blade.php new file mode 100644 index 0000000..5a551db --- /dev/null +++ b/resources/views/admin/userrank/index.blade.php @@ -0,0 +1,26 @@ +@extends('admin.layouts.app') +@section('title', '会员等级列表') + +@section('content') +

会员等级管理

[ 添加会员等级 ]

+ +
+ + + + + + + + + + + + + + + +
ID等级名称等级排序管理
id; ?>title; ?>rank; ?>listorder; ?>修改 | 删除
+ + +@endsection \ No newline at end of file diff --git a/resources/views/home/common/header.blade.php b/resources/views/home/common/header.blade.php index 8bead4f..1a77ed9 100644 --- a/resources/views/home/common/header.blade.php +++ b/resources/views/home/common/header.blade.php @@ -25,22 +25,15 @@ -
+
-

+

-
+
-
+
-
+
+ + -
    $v){ ?> @@ -44,13 +87,12 @@

    库存()

    ¥
    -
    ¥ 退货赔运费
    件已付款
    +
    ¥ 包邮
    件已付款
- -
@include('home.common.footer') +@include('home.common.footer')