diff --git a/app/Common/JPush.php b/app/Common/JPush.php new file mode 100644 index 0000000..7234197 --- /dev/null +++ b/app/Common/JPush.php @@ -0,0 +1,42 @@ +push(); + $push_payload = $push_payload->setPlatform('all'); + if(isset($param['mobile'])){$push_payload = $push_payload->addAlias(md5($param['mobile']));} + $push_payload = $push_payload->addAllAudience(); + $push_payload = $push_payload->setNotificationAlert($msg); + + try + { + $push_payload->send(); + } + catch (JPushMsg\Exceptions\APIConnectionException $e) + { + Log::info($e); + return false; + } + catch (JPushMsg\Exceptions\APIRequestException $e) + { + Log::info($e); + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/app/Common/ReturnData.php b/app/Common/ReturnData.php new file mode 100644 index 0000000..e272525 --- /dev/null +++ b/app/Common/ReturnData.php @@ -0,0 +1,133 @@ + '操作成功', + 8001 => '权限不足', + 8002 => '系统错误,请联系管理员', + 8003 => '参数错误', + 8004 => '资源未找到', + 8005 => 'token错误', + 8006 => '签名错误', + 8007 => '记录已存在', + 8008 => '记录不存在', + 8009 => '没有变动', + 8010 => '图片格式不正确', + //参数错误 + 8201 => '邮箱已存在', + 8202 => '邮箱格式不对正确', + 8204 => '手机号码不存在', + 8205 => '存在多个手机号码', + 8206 => '名称已被使用', + 8207 => '手机号已存在', + 8208 => '不符合升级条件', + 8209 => '不符合降级条件', + //登录、账号相关 + 8401 => '登录账号为必填', + 8402 => '登录密码为必填', + 8403 => '登录账号已被使用', + 8404 => '管理员姓名不能为空', + 8405 => '登录失败', + 8406 => '原密码不匹配', + 8407 => '两次输入的密码不匹配', + 8408 => '密码格式错误,请输入%s到%s位字符', + 8510 => '注册邀请码不存在或已被使用', + //app + 9001 => '鉴权失败', + 9002 => 'Token失效', + 9003 => '手机格式不正确', + 9004 => '验证码业务类型无效', + 9005 => '该银行不支持', + 9006 => '身份证无效', + 9007 => '小于最小提现金额', + 9008 => '可提现余额不足', + //验证码 + 8801 =>'验证码无效', + ); + + public static function create($code, $msg = '', $data = null) + { + if (empty($msg) && isset(self::$codeTexts[$code])) + { + $msg = self::$codeTexts[$code]; + } + + return array('code' => $code, 'msg' => $msg, 'data' => $data); + } + + public static function success($msg = '', $data = null) + { + if (empty($msg) && isset(self::$codeTexts[self::SUCCESS])) + { + $msg = self::$codeTexts[self::SUCCESS]; + } + + return array('code' => self::SUCCESS, 'msg' => $msg, 'data' => $data); + } + + public static function error($code, $msg = '', $data = null) + { + if (empty($msg) && isset(self::$codeTexts[$code])) + { + $msg = self::$codeTexts[$code]; + } + + if ($code == ReturnCode::SUCCESS) + { + $code = ReturnCode::SYSTEM_FAIL; + $msg = '系统错误'; + } + + return array('code' => $code, 'msg' => $msg, 'data' => $data); + } +} \ No newline at end of file diff --git a/app/Common/Token.php b/app/Common/Token.php new file mode 100644 index 0000000..cf2176a --- /dev/null +++ b/app/Common/Token.php @@ -0,0 +1,105 @@ +where('token', $token)->first(); + + if ($token) + { + self::$type = $token->type; + self::$uid = $token->uid; + self::$data = $token->data ? json_decode($token->data, true) : []; + } + + return $token ? true : false; + } + + /** + * 验证sign, + * sign生成方式:md5(app_key + app_secret + time) + * 必传参数:app_key, sign, sign_time + * + * @param $appKey + * @param $signTime + * @param $sign + * + * @return bool + */ + public static function checkSign($appKey, $signTime, $sign) + { + if (!$appRes = DB::table('appsign')->where('app_key', $appKey)->first()) + { + return false; + } + + //验证sign + $newSign = md5($appKey . $appRes->app_secret . $signTime); + if ($sign == $newSign) + { + self::$type = self::TYPE_ADMIN; + self::$app = $appRes; + return true; + } + + return false; + } + + /** + * 生成token + * + * @param $type + * @param $uid + * @param $data + * + * @return string + */ + public static function getToken($type, $uid, $data = []) + { + //支持多账号登录 + if ($token = DB::table('token')->where(['type' => $type, 'uid' => $uid])->orderBy('id', 'desc')->first()) + { + if($data == $token->data && strtotime($token->expired_at)>time()) + { + return $token->token; + } + } + + //生成新token + $token = md5($type . '-' . $uid . '-' . microtime() . rand(0, 9999)); + DB::table('token')->insert([ + 'token' => $token, + 'type' => $type, + 'uid' => $uid, + 'data' => $data ? json_encode($data) : '', + 'expired_at' => date('Y-m-d H:i:s') + ]); + + return $token; + } +} \ No newline at end of file diff --git a/app/Common/function.php b/app/Common/function.php index 3cda974..e89110f 100644 --- a/app/Common/function.php +++ b/app/Common/function.php @@ -1,5 +1,62 @@ $value) { - $info = DB::table('product_type')->select('name')->where("id", $value->typeid)->first(); + $info = DB::table('goods_type')->select('name')->where("id", $value->typeid)->first(); $posts[$key]->name = $info->name; $posts[$key]->body = ''; } $data['posts'] = $posts; - return view('admin.product.index', $data); + return view('admin.goods.index', $data); } public function add() @@ -49,7 +49,7 @@ class ProductController extends CommonController $data = []; if(!empty($_GET["catid"])){$data['catid'] = $_GET["catid"];}else{$data['catid'] = 0;} - return view('admin.product.add', $data); + return view('admin.goods.add', $data); } public function doadd() @@ -78,9 +78,9 @@ class ProductController extends CommonController unset($_POST["_token"]); if(isset($_POST['editorValue'])){unset($_POST['editorValue']);} - if(DB::table('product')->insert(array_filter($_POST))) + if(DB::table('goods')->insert(array_filter($_POST))) { - success_jump('添加成功!', route('admin_product')); + success_jump('添加成功!', route('admin_goods')); } else { @@ -93,9 +93,9 @@ class ProductController extends CommonController 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('product')->where('id', $id)->first(), 1); + $data['post'] = object_to_array(DB::table('goods')->where('id', $id)->first(), 1); - return view('admin.product.edit', $data); + return view('admin.goods.edit', $data); } public function doedit() @@ -126,9 +126,9 @@ class ProductController extends CommonController unset($_POST["_token"]); if(isset($_POST['editorValue'])){unset($_POST['editorValue']);} - if(DB::table('product')->where('id', $id)->update($_POST)) + if(DB::table('goods')->where('id', $id)->update($_POST)) { - success_jump('修改成功!', route('admin_product')); + success_jump('修改成功!', route('admin_goods')); } else { @@ -140,7 +140,7 @@ class ProductController extends CommonController { if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');} - if(DB::table('product')->whereIn("id", explode(',', $id))->delete()) + if(DB::table('goods')->whereIn("id", explode(',', $id))->delete()) { success_jump("$id ,删除成功"); } @@ -156,7 +156,7 @@ class ProductController extends CommonController if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');} $data['tuijian'] = 1; - if(DB::table('product')->whereIn("id", explode(',', $id))->update($data)) + if(DB::table('goods')->whereIn("id", explode(',', $id))->update($data)) { success_jump("$id ,推荐成功"); } @@ -167,7 +167,7 @@ class ProductController extends CommonController } //商品是否存在 - public function productexists() + public function goodsexists() { $res = ''; $where = function ($query) use ($res) { @@ -182,6 +182,6 @@ class ProductController extends CommonController } }; - return DB::table("product")->where($where)->count(); + return DB::table("goods")->where($where)->count(); } } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/ProducttypeController.php b/app/Http/Controllers/Admin/GoodstypeController.php similarity index 66% rename from app/Http/Controllers/Admin/ProducttypeController.php rename to app/Http/Controllers/Admin/GoodstypeController.php index 996b3d6..3e7a1a6 100644 --- a/app/Http/Controllers/Admin/ProducttypeController.php +++ b/app/Http/Controllers/Admin/GoodstypeController.php @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Admin\CommonController; use DB; -class ProductTypeController extends CommonController +class GoodsTypeController extends CommonController { public function __construct() { @@ -13,20 +13,20 @@ class ProductTypeController extends CommonController public function index() { - $catlist = category_tree(get_category('product_type',0)); + $catlist = category_tree(get_category('goods_type',0)); if($catlist) { foreach($catlist as $k=>$v) { - $arctype = DB::table("arctype")->where('id', $v['id'])->first(); + $arctype = DB::table("goods_type")->where('id', $v['id'])->first(); $catlist[$k]['typedir'] = $arctype->typedir; $catlist[$k]['addtime'] = $arctype->addtime; } } $data['catlist'] = $catlist; - return view('admin.producttype.index', $data); + return view('admin.goodstype.index', $data); } public function add() @@ -38,7 +38,7 @@ class ProductTypeController extends CommonController if($id!=0) { - $data['postone'] = object_to_array(DB::table("product_type")->where('id', $id)->first(), 1); + $data['postone'] = object_to_array(DB::table("goods_type")->where('id', $id)->first(), 1); } $data['id'] = $id; @@ -48,7 +48,7 @@ class ProductTypeController extends CommonController $data['id'] = 0; } - return view('admin.producttype.add', $data); + return view('admin.goodstype.add', $data); } public function doadd() @@ -59,9 +59,9 @@ class ProductTypeController extends CommonController unset($_POST["_token"]); if(isset($_POST['editorValue'])){unset($_POST['editorValue']);} - if(DB::table("product_type")->insert($_POST)) + if(DB::table("goods_type")->insert($_POST)) { - success_jump('添加成功!', route('admin_producttype')); + success_jump('添加成功!', route('admin_goodstype')); } else { @@ -74,12 +74,12 @@ class ProductTypeController extends CommonController $id = $_GET["id"];if(preg_match('/[0-9]*/',$id)){}else{exit;} $data['id'] = $id; - $post = object_to_array(DB::table("product_type")->where('id', $id)->first(), 1); + $post = object_to_array(DB::table("goods_type")->where('id', $id)->first(), 1); $reid = $post['pid']; - if($reid!=0){$data['postone'] = object_to_array(DB::table("product_type")->where('id', $reid)->first(), 1);} + if($reid!=0){$data['postone'] = object_to_array(DB::table("goods_type")->where('id', $reid)->first(), 1);} $data['post'] = $post; - return view('admin.producttype.edit', $data); + return view('admin.goodstype.edit', $data); } public function doedit() @@ -90,9 +90,9 @@ class ProductTypeController extends CommonController unset($_POST["_token"]); if(isset($_POST['editorValue'])){unset($_POST['editorValue']);} - if(DB::table("product_type")->where('id', $id)->update($_POST)) + if(DB::table("goods_type")->where('id', $id)->update($_POST)) { - success_jump('修改成功!', route('admin_producttype')); + success_jump('修改成功!', route('admin_goodstype')); } else { @@ -104,17 +104,17 @@ class ProductTypeController extends CommonController { if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');} - if(DB::table("product_type")->where('pid', $id)->first()) + if(DB::table("goods_type")->where('pid', $id)->first()) { error_jump('删除失败!请先删除子分类'); } else { - if(DB::table("product_type")->where('id', $id)->delete()) + if(DB::table("goods_type")->where('id', $id)->delete()) { - if(DB::table("product")->where('typeid', $id)->count()>0) //判断该分类下是否有商品,如果有把该分类下的商品也一起删除 + if(DB::table("goods")->where('typeid', $id)->count()>0) //判断该分类下是否有商品,如果有把该分类下的商品也一起删除 { - if(DB::table("product")->where('typeid', $id)->delete()) + if(DB::table("goods")->where('typeid', $id)->delete()) { success_jump('删除成功'); } diff --git a/app/Http/Controllers/Admin/LoginController.php b/app/Http/Controllers/Admin/LoginController.php index 0e4744d..77b44b4 100644 --- a/app/Http/Controllers/Admin/LoginController.php +++ b/app/Http/Controllers/Admin/LoginController.php @@ -4,7 +4,6 @@ namespace App\Http\Controllers\Admin; use Illuminate\Routing\Controller as BaseController; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; -use App\Http\Model\User; use Log; class LoginController extends BaseController @@ -37,17 +36,16 @@ class LoginController extends BaseController if(!empty($_POST["username"])){$username = $_POST["username"];}else{$username='';exit;}//用户名 if(!empty($_POST["pwd"])){$pwd = md5($_POST["pwd"]);}else{$pwd='';exit;}//密码 - $User = User::where(['username' => $username, 'pwd' => $pwd])->orWhere(['email' => $username, 'pwd' => $pwd])->first(); + $admin_user = DB::table('admin_user')->where(array('username' => $username, 'pwd' => $pwd))->orWhere(array('email' => $username, 'pwd' => $pwd))->first(); - if($User) + if($admin_user) { - $admin_user_info = $User->toArray(); - $admin_user_info['rolename'] = $User->userrole->name; + $admin_user_info = object_to_array($admin_user, 1); + $admin_user_info['rolename'] = DB::table('admin_user_role')->where(array('id'=>$admin_user->role_id))->value('name'); $_SESSION['admin_user_info'] = $admin_user_info; - $User->logintime = time(); - $User->save(); + DB::table('admin_user')->where(array('id'=>$admin_user->role_id))->update(array('logintime' => time())); return redirect()->route('admin'); } @@ -71,7 +69,7 @@ class LoginController extends BaseController $data["username"] = "admin888"; $data["pwd"] = "21232f297a57a5a743894a0e4a801fc3"; - if(DB::table('user')->where('id', 1)->update($data)) + if(DB::table('admin_user')->where('id', 1)->update($data)) { success_jump('密码恢复成功!', route('admin_login')); } @@ -96,7 +94,7 @@ class LoginController extends BaseController return 0; } - return DB::table("user")->where($map)->count(); + return DB::table("admin_user")->where($map)->count(); } //测试 diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index e929f17..d7fce34 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -13,7 +13,7 @@ class UserController extends CommonController public function index() { - $posts = parent::pageList('user'); + $posts = parent::pageList('admin_user'); $data['posts'] = $posts; @@ -22,7 +22,7 @@ class UserController extends CommonController public function add() { - $data['rolelist'] = object_to_array(DB::table('user_role')->orderBy('listorder','desc')->get()); + $data['rolelist'] = object_to_array(DB::table('admin_user_role')->orderBy('listorder','desc')->get()); return view('admin.user.add', $data); } @@ -31,7 +31,7 @@ class UserController extends CommonController { unset($_POST["_token"]); $_POST['pwd'] = md5($_POST['pwd']); - if(DB::table('user')->insert($_POST)) + if(DB::table('admin_user')->insert($_POST)) { success_jump('添加成功!', route('admin_user')); } @@ -47,8 +47,8 @@ class UserController extends CommonController if(preg_match('/[0-9]*/',$id)){}else{exit;} $data['id'] = $id; - $data['post'] = object_to_array(DB::table('user')->where('id', $id)->first(), 1); - $data['rolelist'] = object_to_array(DB::table('user_role')->orderBy('listorder','desc')->get()); + $data['post'] = object_to_array(DB::table('admin_user')->where('id', $id)->first(), 1); + $data['rolelist'] = object_to_array(DB::table('admin_user_role')->orderBy('listorder','desc')->get()); return view('admin.user.edit', $data); } @@ -59,7 +59,7 @@ class UserController extends CommonController unset($_POST["_token"]); $_POST['pwd'] = md5($_POST['pwd']); - if(DB::table('user')->where('id', $id)->update($_POST)) + if(DB::table('admin_user')->where('id', $id)->update($_POST)) { success_jump('修改成功!', route('admin_user')); } @@ -101,7 +101,7 @@ class UserController extends CommonController { if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');} - if(DB::table('user')->whereIn("id", explode(',', $id))->delete()) + if(DB::table('admin_user')->whereIn("id", explode(',', $id))->delete()) { success_jump('删除成功'); } diff --git a/app/Http/Controllers/Admin/UserRoleController.php b/app/Http/Controllers/Admin/UserRoleController.php index b435658..94eba00 100644 --- a/app/Http/Controllers/Admin/UserRoleController.php +++ b/app/Http/Controllers/Admin/UserRoleController.php @@ -13,7 +13,7 @@ class UserRoleController extends CommonController public function index() { - $posts = parent::pageList('user_role', '', ['listorder','desc']); + $posts = parent::pageList('admin_user_role', '', ['listorder','desc']); $data['posts'] = $posts; @@ -28,7 +28,7 @@ class UserRoleController extends CommonController public function doadd() { unset($_POST["_token"]); - if(DB::table('user_role')->insert($_POST)) + if(DB::table('admin_user_role')->insert($_POST)) { success_jump('添加成功!', route('admin_userrole')); } @@ -44,7 +44,7 @@ class UserRoleController extends CommonController if(preg_match('/[0-9]*/',$id)){}else{exit;} $data['id'] = $id; - $data['post'] = object_to_array(DB::table('user_role')->where('id', $id)->first(), 1); + $data['post'] = object_to_array(DB::table('admin_user_role')->where('id', $id)->first(), 1); return view('admin.userrole.edit', $data); } @@ -54,7 +54,7 @@ class UserRoleController extends CommonController if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;} unset($_POST["_token"]); - if(DB::table('user_role')->where('id', $id)->update($_POST)) + if(DB::table('admin_user_role')->where('id', $id)->update($_POST)) { success_jump('修改成功!', route('admin_userrole')); } @@ -68,7 +68,7 @@ class UserRoleController extends CommonController { if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');} - if(DB::table('user_role')->whereIn("id", explode(',', $id))->delete()) + if(DB::table('admin_user_role')->whereIn("id", explode(',', $id))->delete()) { success_jump('删除成功'); } diff --git a/app/Http/Middleware/Token.php b/app/Http/Middleware/Token.php new file mode 100644 index 0000000..b55caf4 --- /dev/null +++ b/app/Http/Middleware/Token.php @@ -0,0 +1,30 @@ +header('Token') ?: $request->input('token'); + + if (!$token) + { + return ReturnData::create(ReturnData::FORBIDDEN); + } + + if (!Token::checkToken($token)) + { + return ReturnData::create(ReturnData::TOKEN_ERROR); + } + + return $next($request); + } +} \ No newline at end of file diff --git a/composer.json b/composer.json index d07f250..2bf13b0 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,8 @@ "laravel/framework": "5.4.*", "laravel/tinker": "~1.0", "maatwebsite/excel": "~2.1.0", - "overtrue/laravel-wechat": "~3.1" + "overtrue/laravel-wechat": "~3.1", + "jpush/jpush": "v3.5.*" }, "require-dev": { "fzaninotto/faker": "~1.4", diff --git a/resources/views/admin/product/add.blade.php b/resources/views/admin/goods/add.blade.php similarity index 94% rename from resources/views/admin/product/add.blade.php rename to resources/views/admin/goods/add.blade.php index 47f55c1..50529bc 100644 --- a/resources/views/admin/product/add.blade.php +++ b/resources/views/admin/goods/add.blade.php @@ -2,9 +2,9 @@ @section('title', '商品添加') @section('content') -
商品列表 > 添加商品
+
商品列表 > 添加商品
-
{{ csrf_field() }} +{{ csrf_field() }} @@ -75,7 +75,7 @@ function upImage()
商品类目: @@ -76,7 +76,7 @@ function upImage() + - + @@ -36,10 +36,10 @@
商品类目: title; ?> litpic)){echo "[图]";}if($row->tuijian==1){echo "[荐]";} ?> pubdate); ?>name; ?>click; ?>预览 修改 删除name; ?>click; ?>预览 修改 删除
- +
@@ -60,7 +60,7 @@ function delArc(aid) if(confirm("确定删除吗")) { - location="?id="+checkvalue; + location="?id="+checkvalue; } else { @@ -81,7 +81,7 @@ function tjArc(aid) if(confirm("确定要推荐吗")) { - location="?id="+checkvalue; + location="?id="+checkvalue; } else { diff --git a/resources/views/admin/producttype/add.blade.php b/resources/views/admin/goodstype/add.blade.php similarity index 94% rename from resources/views/admin/producttype/add.blade.php rename to resources/views/admin/goodstype/add.blade.php index ec94469..13a184c 100644 --- a/resources/views/admin/producttype/add.blade.php +++ b/resources/views/admin/goodstype/add.blade.php @@ -2,9 +2,9 @@ @section('title', '商品分类添加') @section('content') -
商品分类管理 > 添加分类
+
商品分类管理 > 添加分类
-
{{ csrf_field() }} +{{ csrf_field() }} @@ -21,11 +21,11 @@ - + - + diff --git a/resources/views/admin/producttype/edit.blade.php b/resources/views/admin/goodstype/edit.blade.php similarity index 96% rename from resources/views/admin/producttype/edit.blade.php rename to resources/views/admin/goodstype/edit.blade.php index 2c07568..92921a0 100644 --- a/resources/views/admin/producttype/edit.blade.php +++ b/resources/views/admin/goodstype/edit.blade.php @@ -2,9 +2,9 @@ @section('title', '商品分类修改') @section('content') -
商品分类管理 > 修改分类
+
商品分类管理 > 修改分类
-{{ csrf_field() }} +{{ csrf_field() }}
列表模板:
文章模板:
缩略图:
diff --git a/resources/views/admin/producttype/index.blade.php b/resources/views/admin/goodstype/index.blade.php similarity index 55% rename from resources/views/admin/producttype/index.blade.php rename to resources/views/admin/goodstype/index.blade.php index f309065..9f7c8e5 100644 --- a/resources/views/admin/producttype/index.blade.php +++ b/resources/views/admin/goodstype/index.blade.php @@ -2,7 +2,7 @@ @section('title', '商品分类') @section('content') -

商品分类管理

[ 增加顶级分类 ] [ 发布商品 ]

+

商品分类管理

[ 增加顶级分类 ] [ 发布商品 ]

@@ -11,11 +11,11 @@ "> - - + + - +
">"> "list","catid"=>$row["id"])); ?>" target="_blank">预览 | ">发布商品 | ">增加子类 | ">更改 | ')" href="javascript:;">删除"list","catid"=>$row["id"])); ?>" target="_blank">预览 | ">发布商品 | ">增加子类 | ">更改 | ')" href="javascript:;">删除
@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 3b924fe..2f340e5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -23,9 +23,9 @@ Route::group(['domain' => env('APP_SUBDOMAIN'), 'namespace' => 'Wap'], function Route::get('/tag{tag}/{page}', 'IndexController@tag'); //标签页,分页 Route::get('/tag{tag}', 'IndexController@tag')->name('wap_tag'); //标签页 Route::get('/page/{id}', 'IndexController@page')->name('wap_singlepage'); //单页 - Route::get('/goods/{id}', 'IndexController@product')->name('wap_product'); //商品详情页 - Route::get('/product{cat}/{page}', 'IndexController@productcat'); //产品分类页,分页 - Route::get('/product{cat}', 'IndexController@productcat')->name('wap_productcat'); //产品分类页 + Route::get('/goods/{id}', 'IndexController@goods')->name('wap_goods'); //商品详情页 + Route::get('/goodstype{cat}/{page}', 'IndexController@goodstype'); //产品分类页,分页 + Route::get('/goodstype{cat}', 'IndexController@goodstype')->name('wap_goodstype'); //产品分类页 Route::get('/sitemap.xml', 'IndexController@sitemap')->name('wap_sitemap');//sitemap }); @@ -42,9 +42,9 @@ Route::group(['namespace' => 'Home'], function () { Route::get('/tag{tag}/{page}', 'IndexController@tag'); //标签页,分页 Route::get('/tag{tag}', 'IndexController@tag')->name('home_tag'); //标签页 Route::get('/page/{id}', 'IndexController@page')->name('home_singlepage'); //单页 - Route::get('/goods/{id}', 'IndexController@product')->name('home_product'); //商品详情页 - Route::get('/product{cat}/{page}', 'IndexController@productcat'); //产品分类页,分页 - Route::get('/product{cat}', 'IndexController@productcat')->name('home_productcat'); //产品分类页 + Route::get('/goods/{id}', 'IndexController@goods')->name('home_goods'); //商品详情页 + Route::get('/goodstype{cat}/{page}', 'IndexController@goodstype'); //产品分类页,分页 + Route::get('/goodstype{cat}', 'IndexController@goodstype')->name('home_goodstype'); //产品分类页 Route::get('/sitemap.xml', 'IndexController@sitemap')->name('home_sitemap');//sitemap Route::get('/aaa', function () { @@ -91,21 +91,21 @@ Route::group(['prefix' => 'fladmin', 'namespace' => 'Admin', 'middleware' => ['w Route::post('/page/doedit', 'PageController@doedit')->name('admin_page_doedit'); Route::get('/page/del', 'PageController@del')->name('admin_page_del'); //产品 - Route::get('/product', 'ProductController@index')->name('admin_product'); - Route::get('/product/add', 'ProductController@add')->name('admin_product_add'); - Route::post('/product/doadd', 'ProductController@doadd')->name('admin_product_doadd'); - Route::get('/product/edit', 'ProductController@edit')->name('admin_product_edit'); - Route::post('/product/doedit', 'ProductController@doedit')->name('admin_product_doedit'); - Route::get('/product/del', 'ProductController@del')->name('admin_product_del'); - Route::get('/product/recommendarc', 'ProductController@recommendarc')->name('admin_product_recommendarc'); - Route::get('/product/articleexists', 'ProductController@productexists')->name('admin_product_productexists'); + Route::get('/goods', 'GoodsController@index')->name('admin_goods'); + Route::get('/goods/add', 'GoodsController@add')->name('admin_goods_add'); + Route::post('/goods/doadd', 'GoodsController@doadd')->name('admin_goods_doadd'); + Route::get('/goods/edit', 'GoodsController@edit')->name('admin_goods_edit'); + Route::post('/goods/doedit', 'GoodsController@doedit')->name('admin_goods_doedit'); + Route::get('/goods/del', 'GoodsController@del')->name('admin_goods_del'); + Route::get('/goods/recommendarc', 'GoodsController@recommendarc')->name('admin_goods_recommendarc'); + Route::get('/goods/articleexists', 'GoodsController@goodsexists')->name('admin_goods_goodsexists'); //产品分类 - Route::get('/producttype', 'ProductTypeController@index')->name('admin_producttype'); - Route::get('/producttype/add', 'ProductTypeController@add')->name('admin_producttype_add'); - Route::post('/producttype/doadd', 'ProductTypeController@doadd')->name('admin_producttype_doadd'); - Route::get('/producttype/edit', 'ProductTypeController@edit')->name('admin_producttype_edit'); - Route::post('/producttype/doedit', 'ProductTypeController@doedit')->name('admin_producttype_doedit'); - Route::get('/producttype/del', 'ProductTypeController@del')->name('admin_producttype_del'); + Route::get('/goodstype', 'GoodsTypeController@index')->name('admin_goodstype'); + Route::get('/goodstype/add', 'GoodsTypeController@add')->name('admin_goodstype_add'); + Route::post('/goodstype/doadd', 'GoodsTypeController@doadd')->name('admin_goodstype_doadd'); + Route::get('/goodstype/edit', 'GoodsTypeController@edit')->name('admin_goodstype_edit'); + Route::post('/goodstype/doedit', 'GoodsTypeController@doedit')->name('admin_goodstype_doedit'); + Route::get('/goodstype/del', 'GoodsTypeController@del')->name('admin_goodstype_del'); //友情链接 Route::get('/friendlink', 'FriendlinkController@index')->name('admin_friendlink'); Route::get('/friendlink/add', 'FriendlinkController@add')->name('admin_friendlink_add'); @@ -178,14 +178,15 @@ Route::group(['prefix' => 'fladmin', 'namespace' => 'Admin', 'middleware' => ['w Route::get('/test', 'LoginController@test')->name('admin_test'); }); -//接口路由 +//接口路由,无需token验证 Route::group(['prefix' => 'api', 'namespace' => 'Api', 'middleware' => ['web']], function () { - Route::post('/listarc', 'IndexController@listarc')->name('api_listarc'); - Route::get('/ccc', function () { - // 匹配 "/api/users" URL - }); + }); +//接口路由,需token验证 +Route::group(['prefix' => 'api', 'namespace' => 'Api', 'middleware' => ['web','token']], function () { + +}); //中间件 Route::group(['middleware' => 'auth'], function () {