dyjh 6 jaren geleden
bovenliggende
commit
007ebe909e

+ 86 - 0
app/Furniture.php

xqd
@@ -0,0 +1,86 @@
+<?php
+namespace App;
+/**
+ * Created by PhpStorm.
+ * User: 思维定制
+ * Date: 2019/3/20
+ * Time: 11:20
+ */
+define('HOME_ROOT', dirname(__FILE__));
+
+
+class Furniture
+{
+
+    public static $currentItems = [];
+
+    public function __construct()
+    {
+
+    }
+
+    /**
+     * 解析路由
+     *
+     * 后台访问  /web/index.php?c=site&a=entry&m=sz_yi&do=xxx&route=module.controller.action
+     * 前台      /app/index.php....
+     *
+     * 多字母的路由用中划线隔开 比如:
+     *      TestCacheController
+     *          function testClean()
+     * 路由写法为   test-cache.test-clean
+     *
+     */
+    public static function parseRoute($requestRoute)
+    {
+        $routes = explode('.', $requestRoute);
+        dd($routes);
+        $path = self::getAppPath();
+
+        $namespace = self::getAppNamespace();
+        $action = '';
+        $controllerName = '';
+        $currentRoutes = [];
+        $modules = [];
+        if ($routes) {
+            $length = count($routes);
+            $routeFirst = array_first($routes);
+            $countRoute = count($routes);
+            if ($routeFirst === 'plugin' || self::isPlugin()) {
+                if (self::isPlugin()) {
+                    $currentRoutes[] = 'plugin';
+                    $countRoute += 1;
+                } else {
+                    $currentRoutes[] = $routeFirst;
+                    array_shift($routes);
+                }
+                $namespace = 'Yunshop';
+                $pluginName = array_shift($routes);
+                if ($pluginName || plugin($pluginName)) {
+                    $currentRoutes[] = $pluginName;
+                    $namespace .= '\\' . ucfirst(Str::camel($pluginName));
+                    $path = base_path() . '/plugins/' . $pluginName . '/src';
+                    $length = $countRoute;
+
+                    self::findRouteFile($controllerName, $action, $routes, $namespace, $path, $length, $currentRoutes, $requestRoute, true);
+
+                    if(!app('plugins')->isEnabled($pluginName)){
+                        throw new NotFoundException("{$pluginName}插件已禁用");
+
+                    }
+                } else {
+                    throw new NotFoundException('无此插件');
+
+                }
+            } else {
+
+                self::findRouteFile($controllerName, $action, $routes, $namespace, $path, $length, $currentRoutes, $requestRoute, false);
+
+            }
+        }
+        //执行run
+
+        static::run($namespace, $modules, $controllerName, $action, $currentRoutes);
+
+    }
+}

+ 5 - 0
app/Http/Controllers/Admin/Auth/LoginController.php

xqd
@@ -65,6 +65,11 @@ class LoginController extends Controller
         return 'name';
     }
 
+    public function wxLogin()
+    {
+        dd(111);
+    }
+    
     public function login(\Illuminate\Http\Request $request)
     {
 

+ 2 - 2
app/Http/Controllers/Admin/Base/RoleController.php

xqd
@@ -100,14 +100,14 @@ class RoleController extends Controller
             $menuIds = Request::input('menu_ids');
             if($this->_user['is_root']) {
                 $allMenus = false;
-            }else{
+            } else {
                 $allMenus = array();
                 foreach ($this->_user['menus'] as $value) {
                     $allMenus[] = $value['id'];
                 }
             }
             $ok = $objAcl->setRole($id, $menuIds,$allMenus);
-            if($ok) {
+            if ($ok) {
                 $arr['status'] = SUCESS_CODE;
 
             }else{

+ 1 - 1
app/Providers/RouteServiceProvider.php

xqd
@@ -34,7 +34,7 @@ class RouteServiceProvider extends ServiceProvider
      * @return void
      */
     public function map()
-    {
+    {dd(123);
         $this->mapApiRoutes();
 
         $this->mapWebRoutes();

BIN
icon.jpg


+ 25 - 0
manifest.xml

xqd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://9026.com/" versionCode="">
+    <application setting="false">
+        <name><![CDATA[在线画册]]></name>
+        <identifie><![CDATA[furniture]]></identifie>
+        <version><![CDATA[1.0]]></version>
+        <type><![CDATA[business]]></type>
+        <ability><![CDATA[在线画册]]></ability>
+        <description><![CDATA[在线画册]]></description>
+        <author><![CDATA[在线画册]]></author>
+        <url><![CDATA[http://9026.com]]></url>
+  </application>
+    <platform>
+        <supports>
+            <item type="wxapp"/>
+        </supports>
+    </platform>
+    <bindings>
+    </bindings>
+    <permissions>
+    </permissions>
+    <install><![CDATA[]]></install>
+    <uninstall><![CDATA[]]></uninstall>
+    <upgrade><![CDATA[]]></upgrade>
+</manifest>

+ 5 - 0
map.json

xqd
@@ -0,0 +1,5 @@
+微猫源码
+
+http://www.weixin2015.cn
+
+QQ:2058430070

+ 30 - 0
module.php

xqd
@@ -0,0 +1,30 @@
+<?php
+
+//namespace zjhj_mall;
+$entry = '/public/';
+
+if (file_exists(__DIR__ . $entry)) {
+    global $_W;
+    $wUser = [
+        'uid' => $_W['user']['uid'],
+        'name' => $_W['user']['name'],
+        'username' => $_W['user']['username'],
+    ];
+    $wAccount = [
+        'acid' => $_W['account']['acid'],
+        'name' => $_W['account']['name'],
+    ];
+
+    require __DIR__ . '/vendor/autoload.php';
+    $request = new Illuminate\Http\Request;
+    session_start();
+    $_SESSION["store_id"] = $_W['uniacid'];
+    $_SESSION["wUser"] = $wUser;
+    $_SESSION["wAccount"] = $wAccount;
+    $_SESSION["route"] = 'Admin/Auth/Login/wxLogin';
+    $uri = $_W['siteroot'] . 'addons/' . $_W['current_module']['name'] . $entry;
+    header('Location: ' . $uri);
+    exit;
+} else {
+    die('应用入口文件缺失,请联系开发者处理!');
+}

+ 1 - 1
public/index.php

xqd
@@ -57,4 +57,4 @@ $response = $kernel->handle(
 
 $response->send();
 
-$kernel->terminate($request, $response);
+$kernel->terminate($request, $response);

+ 2 - 2
routes/admin.php

xqd
@@ -12,8 +12,8 @@
 */
 //
 //Route::get('/login', 'Admin\Foundation\LoginController@login');
-Route::get('login', 'Auth\LoginController@showLoginForm')->name('admin.login');
-Route::post('login', 'Auth\LoginController@login');
+//Route::get('login', 'Auth\LoginController@showLoginForm')->name('admin.login');
+//Route::post('login', 'Auth\LoginController@login');
 Route::get('album_login', 'Auth\LoginController@showAlbumLoginForm');
 
 Route::get('dologin', 'Auth\LoginController@doLogin');

+ 34 - 9
routes/web.php

xqd xqd xqd
@@ -1,5 +1,5 @@
 <?php
-
+use App\Furniture;
 /*
 |--------------------------------------------------------------------------
 | Web Routes
@@ -11,9 +11,7 @@
 |
 */
 
-Route::get('/', function () {
-    return view('welcome');
-});
+Route::get('/web/bind', 'Web\AuthController@bind');
 
 
 Route::get('attachment/{md5}', [
@@ -38,9 +36,36 @@ Route::get('image/{md5}', [
 //     $obj = $obj->find(1);
 //     var_dump($obj);exit;
 // });
+Route::any('/', function () {
+    //dd(request()->getRequestUri());
+    Route::any('', ['as' => 'admin',
+        'uses' => 'Base\IndexController@index']);dd(11);
+    //后台
+    if (strpos(request()->getRequestUri(), '/addons/') !== false) {
+        //如未设置当前公众号则加到选择公众号列表
+        session_start();
+        if (empty($_SESSION['store_id']) || empty($_SESSION['wUser']) || empty($_SESSION['wAccount'])) {
+            return redirect('../../../web/index.php?c=wxapp&a=display');
+        }
+        session()->put('store_id', $_SESSION['store_id']);
+        session()->put('wUser', $_SESSION['wUser']);
+        session()->put('wAccount', $_SESSION['wAccount']);
+       // Furniture::parseRoute();
+        $route_url = $_SESSION['route'];
+        $route = $baseRoute = explode('/',$route_url);
 
-Route::get('/test', 'TestController@index');
-Route::get('/web/bind', 'Web\AuthController@bind');
-Route::any('/web/notify', 'Web\AuthController@notify');
-/*Route::group(['prefix'=>'web','namespace'=>'Web','middleware' => ['web', 'wechat.oauth:snsapi_userinfo']],function (){
-    Route::any('bind','AuthController@bind');});*/
+
+        if (count($route) > 1) {
+            unset($route[count($route) - 1]);
+            $file = app_path() . '/Http/Controllers/' . implode("/", $route) . "Controller.php";
+            if (file_exists($file)) {
+                $controller = implode("\\", $route) . "Controller";
+                $action = $controller . "@" . $baseRoute[count($route)];
+                //dd($route[0]);
+                Route::any('/', ['as' => $route[0],
+                    'uses' => $action]);
+            }
+        }
+
+    }
+});