allen 3 years ago
parent
commit
1ba46dc198
5 changed files with 109 additions and 606 deletions
  1. 2 0
      .example.env
  2. 45 0
      app/admin/view/error.html
  3. 0 568
      app/admin/view/error.tpl
  4. 60 36
      app/index/view/video/index.html
  5. 2 2
      config/app.php

+ 2 - 0
.example.env

@@ -37,3 +37,5 @@ API_SECRET=8d6967d654bca47a
 MOCK=0
 # H5前端页面的域名,用于线上Referer检测
 REFERER=
+# 中奖概率 例:5000 是 5000分之一, 2 就是 2分之一
+DRAW_LIMIT=5000

+ 45 - 0
app/admin/view/error.html

@@ -0,0 +1,45 @@
+<!DOCTYPE html >
+<html>
+<head>
+    <meta charset=utf-8" />
+    <title>简简单单404文字页</title>
+    <style type="text/css">
+        body {
+            background-color: #ECECEC;
+            color: #3c3c3c;
+            text-align:center
+        }
+        .demo{width:100%;margin:0 auto;}
+        .demo p{ font-size: 2.2rem;}
+        .demo .title{ font-size: 10rem;}
+    </style>
+    <script type="text/javascript">
+        var run_404 = function(count_down_num,congge_home){
+            var go_to_home = document.getElementById('go_to_home');
+            go_to_home.innerHTML=count_down_num;
+            the_num = --count_down_num;
+            if(the_num>0){
+                setTimeout("run_404("+the_num+",'"+congge_home+"')",1000);
+            }
+            else{
+                location.href=congge_home;
+            }
+        }
+    </script>
+</head>
+
+<body>
+
+<div class="demo">
+    <p class="title">404</p>
+    <p>
+        该页面不存在,正在跳转到首页
+        <span id="go_to_home">3</span>
+        秒后跳转到首页
+    </p>
+</div>
+<script type="text/javascript">
+    run_404(3,'/');
+</script>
+</body>
+</html>

+ 0 - 568
app/admin/view/error.tpl

@@ -1,568 +0,0 @@
-<?php
-
-if (!function_exists('parse_padding')) {
-    function parse_padding($source)
-    {
-        $length = strlen(strval(count($source['source']) + $source['first']));
-        return 40 + ($length - 1) * 8;
-    }
-}
-
-if (!function_exists('parse_class')) {
-    function parse_class($name)
-    {
-        $names = explode('\\', $name);
-        return '<abbr title="' . $name . '">' . end($names) . '</abbr>';
-    }
-}
-
-if (!function_exists('parse_file')) {
-    function parse_file($file, $line)
-    {
-        return '<a class="toggle" title="' . "{$file} line {$line}" . '">' . basename($file) . " line {$line}" . '</a>';
-    }
-}
-
-if (!function_exists('parse_args')) {
-    function parse_args($args)
-    {
-        $result = [];
-        foreach ($args as $key => $item) {
-            switch (true) {
-                case is_object($item):
-                    $value = sprintf('<em>object</em>(%s)', parse_class(get_class($item)));
-                    break;
-                case is_array($item):
-                    if (count($item) > 3) {
-                        $value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3)));
-                    } else {
-                        $value = sprintf('[%s]', parse_args($item));
-                    }
-                    break;
-                case is_string($item):
-                    if (strlen($item) > 20) {
-                        $value = sprintf(
-                            '\'<a class="toggle" title="%s">%s...</a>\'',
-                            htmlentities($item),
-                            htmlentities(substr($item, 0, 20))
-                        );
-                    } else {
-                        $value = sprintf("'%s'", htmlentities($item));
-                    }
-                    break;
-                case is_int($item):
-                case is_float($item):
-                    $value = $item;
-                    break;
-                case is_null($item):
-                    $value = '<em>null</em>';
-                    break;
-                case is_bool($item):
-                    $value = '<em>' . ($item ? 'true' : 'false') . '</em>';
-                    break;
-                case is_resource($item):
-                    $value = '<em>resource</em>';
-                    break;
-                default:
-                    $value = htmlentities(str_replace("\n", '', var_export(strval($item), true)));
-                    break;
-            }
-
-            $result[] = is_int($key) ? $value : "'{$key}' => {$value}";
-        }
-
-        return implode(', ', $result);
-    }
-}
-if (!function_exists('echo_value')) {
-    function echo_value($val)
-    {
-        if (is_array($val) || is_object($val)) {
-            echo htmlentities(json_encode($val, JSON_PRETTY_PRINT));
-        } elseif (is_bool($val)) {
-            echo $val ? 'true' : 'false';
-        } elseif (is_scalar($val)) {
-            echo htmlentities($val);
-        } else {
-            echo 'Resource';
-        }
-    }
-}
-?>
-<!DOCTYPE html>
-<html lang="zh">
-<head>
-    <meta charset="UTF-8">
-    <title>系统发生错误</title>
-    <meta name="robots" content="noindex,nofollow"/>
-    <style>
-        /* Base */
-        body {
-            color: #333;
-            font: 16px Verdana, "Helvetica Neue", helvetica, Arial, 'Microsoft YaHei', sans-serif;
-            margin: 0;
-            padding: 0 20px 20px;
-        }
-
-        h1 {
-            margin: 10px 0 0;
-            font-size: 28px;
-            font-weight: 500;
-            line-height: 32px;
-        }
-
-        h2 {
-            color: #4288ce;
-            font-weight: 400;
-            padding: 6px 0;
-            margin: 6px 0 0;
-            font-size: 18px;
-            border-bottom: 1px solid #eee;
-        }
-
-        h3 {
-            margin: 12px;
-            font-size: 16px;
-            font-weight: bold;
-        }
-
-        abbr {
-            cursor: help;
-            text-decoration: underline;
-            text-decoration-style: dotted;
-        }
-
-        a {
-            color: #868686;
-            cursor: pointer;
-        }
-
-        a:hover {
-            text-decoration: underline;
-        }
-
-        .line-error {
-            background: #f8cbcb;
-        }
-
-        .echo table {
-            width: 100%;
-        }
-
-        .echo pre {
-            padding: 16px;
-            overflow: auto;
-            font-size: 85%;
-            line-height: 1.45;
-            background-color: #f7f7f7;
-            border: 0;
-            border-radius: 3px;
-            font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
-        }
-
-        .echo pre > pre {
-            padding: 0;
-            margin: 0;
-        }
-
-        /* Exception Info */
-        .exception {
-            margin-top: 20px;
-        }
-
-        .exception .message {
-            padding: 12px;
-            border: 1px solid #ddd;
-            border-bottom: 0 none;
-            line-height: 18px;
-            font-size: 16px;
-            border-top-left-radius: 4px;
-            border-top-right-radius: 4px;
-            font-family: Consolas, "Liberation Mono", Courier, Verdana, "微软雅黑", serif;
-        }
-
-        .exception .code {
-            float: left;
-            text-align: center;
-            color: #fff;
-            margin-right: 12px;
-            padding: 16px;
-            border-radius: 4px;
-            background: #999;
-        }
-
-        .exception .source-code {
-            padding: 6px;
-            border: 1px solid #ddd;
-
-            background: #f9f9f9;
-            overflow-x: auto;
-
-        }
-
-        .exception .source-code pre {
-            margin: 0;
-        }
-
-        .exception .source-code pre ol {
-            margin: 0;
-            color: #4288ce;
-            display: inline-block;
-            min-width: 100%;
-            box-sizing: border-box;
-            font-size: 14px;
-            font-family: "Century Gothic", Consolas, "Liberation Mono", Courier, Verdana, serif;
-            padding-left: < ? php echo (isset($ source) & & ! empty($ source)) ? parse_padding($ source): 40;
-            ? > px;
-        }
-
-        .exception .source-code pre li {
-            border-left: 1px solid #ddd;
-            height: 18px;
-            line-height: 18px;
-        }
-
-        .exception .source-code pre code {
-            color: #333;
-            height: 100%;
-            display: inline-block;
-            border-left: 1px solid #fff;
-            font-size: 14px;
-            font-family: Consolas, "Liberation Mono", Courier, Verdana, "微软雅黑", serif;
-        }
-
-        .exception .trace {
-            padding: 6px;
-            border: 1px solid #ddd;
-            border-top: 0 none;
-            line-height: 16px;
-            font-size: 14px;
-            font-family: Consolas, "Liberation Mono", Courier, Verdana, "微软雅黑", serif;
-        }
-
-        .exception .trace h2:hover {
-            text-decoration: underline;
-            cursor: pointer;
-        }
-
-        .exception .trace ol {
-            margin: 12px;
-        }
-
-        .exception .trace ol li {
-            padding: 2px 4px;
-        }
-
-        .exception div:last-child {
-            border-bottom-left-radius: 4px;
-            border-bottom-right-radius: 4px;
-        }
-
-        /* Exception Variables */
-        .exception-var table {
-            width: 100%;
-            margin: 12px 0;
-            box-sizing: border-box;
-            table-layout: fixed;
-            word-wrap: break-word;
-        }
-
-        .exception-var table caption {
-            text-align: left;
-            font-size: 16px;
-            font-weight: bold;
-            padding: 6px 0;
-        }
-
-        .exception-var table caption small {
-            font-weight: 300;
-            display: inline-block;
-            margin-left: 10px;
-            color: #ccc;
-        }
-
-        .exception-var table tbody {
-            font-size: 13px;
-            font-family: Consolas, "Liberation Mono", Courier, "微软雅黑", serif;
-        }
-
-        .exception-var table td {
-            padding: 0 6px;
-            vertical-align: top;
-            word-break: break-all;
-        }
-
-        .exception-var table td:first-child {
-            width: 28%;
-            font-weight: bold;
-            white-space: nowrap;
-        }
-
-        .exception-var table td pre {
-            margin: 0;
-        }
-
-        /* Copyright Info */
-        .copyright {
-            margin-top: 24px;
-            padding: 12px 0;
-            border-top: 1px solid #eee;
-        }
-
-        /* SPAN elements with the classes below are added by prettyprint. */
-        pre.prettyprint .pln {
-            color: #000
-        }
-
-        /* plain text */
-        pre.prettyprint .str {
-            color: #080
-        }
-
-        /* string content */
-        pre.prettyprint .kwd {
-            color: #008
-        }
-
-        /* a keyword */
-        pre.prettyprint .com {
-            color: #800
-        }
-
-        /* a comment */
-        pre.prettyprint .typ {
-            color: #606
-        }
-
-        /* a type name */
-        pre.prettyprint .lit {
-            color: #066
-        }
-
-        /* a literal value */
-        /* punctuation, lisp open bracket, lisp close bracket */
-        pre.prettyprint .pun, pre.prettyprint .opn, pre.prettyprint .clo {
-            color: #660
-        }
-
-        pre.prettyprint .tag {
-            color: #008
-        }
-
-        /* a markup tag name */
-        pre.prettyprint .atn {
-            color: #606
-        }
-
-        /* a markup attribute name */
-        pre.prettyprint .atv {
-            color: #080
-        }
-
-        /* a markup attribute value */
-        pre.prettyprint .dec, pre.prettyprint .var {
-            color: #606
-        }
-
-        /* a declaration; a variable name */
-        pre.prettyprint .fun {
-            color: red
-        }
-
-        /* a function name */
-    </style>
-</head>
-<body>
-<?php if (\think\facade\App::isDebug()) { ?>
-    <?php foreach ($traces as $index => $trace) { ?>
-        <div class="exception">
-            <div class="message">
-                <div class="info">
-                    <div>
-                        <h2><?php echo "#{$index} [{$trace['code']}]" . sprintf('%s in %s', parse_class($trace['name']), parse_file($trace['file'], $trace['line'])); ?></h2>
-                    </div>
-                    <div><h1><?php echo nl2br(htmlentities($trace['message'])); ?></h1></div>
-                </div>
-            </div>
-            <?php if (!empty($trace['source'])) { ?>
-                <div class="source-code">
-                    <pre class="prettyprint lang-php"><ol start="<?php echo $trace['source']['first']; ?>"><?php foreach ((array)$trace['source']['source'] as $key => $value) { ?><li class="line-<?php echo " {$index}-" . ($key + $trace['source']['first']) . ($trace['line'] === $key + $trace['source']['first'] ? ' line-error' : ''); ?>"><code><?php echo htmlentities($value); ?></code></li><?php } ?></ol></pre>
-                </div>
-            <?php } ?>
-            <div class="trace">
-                <h2 data-expand="<?php echo 0 === $index ? '1' : '0'; ?>">Call Stack</h2>
-                <ol>
-                    <li><?php echo sprintf('in %s', parse_file($trace['file'], $trace['line'])); ?></li>
-                    <?php foreach ((array)$trace['trace'] as $value) { ?>
-                        <li>
-                            <?php
-                            // Show Function
-                            if ($value['function']) {
-                                echo sprintf('at %s%s%s(%s)', isset($value['class']) ? parse_class($value['class']) : '', $value['type'] ?? '', $value['function'], isset($value['args']) ? parse_args($value['args']) : '');
-                            }
-
-                            // Show line
-                            if (isset($value['file']) && isset($value['line'])) {
-                                echo sprintf(' in %s', parse_file($value['file'], $value['line']));
-                            }
-                            ?>
-                        </li>
-                    <?php } ?>
-                </ol>
-            </div>
-        </div>
-    <?php } ?>
-<?php } else { ?>
-    <div class="exception">
-        <div class="info"><h1><?php echo htmlentities($message); ?></h1></div>
-    </div>
-<?php } ?>
-
-<?php if (!empty($datas)) { ?>
-    <div class="exception-var">
-        <h2>Exception Datas</h2>
-        <?php foreach ((array)$datas as $label => $value) { ?>
-            <table>
-                <?php if (empty($value)) { ?>
-                    <caption><?php echo $label; ?><small>empty</small></caption>
-                <?php } else { ?>
-                    <caption><?php echo $label; ?></caption>
-                    <tbody>
-                    <?php foreach ((array)$value as $key => $val) { ?>
-                        <tr>
-                            <td><?php echo htmlentities($key); ?></td>
-                            <td><?php echo_value($val); ?></td>
-                        </tr>
-                    <?php } ?>
-                    </tbody>
-                <?php } ?>
-            </table>
-        <?php } ?>
-    </div>
-<?php } ?>
-
-<?php if (!empty($tables)) { ?>
-    <div class="exception-var">
-        <h2>Environment Variables</h2>
-        <?php foreach ((array)$tables as $label => $value) { ?>
-            <table>
-                <?php if (empty($value)) { ?>
-                    <caption><?php echo $label; ?><small>empty</small></caption>
-                <?php } else { ?>
-                    <caption><?php echo $label; ?></caption>
-                    <tbody>
-                    <?php foreach ((array)$value as $key => $val) { ?>
-                        <tr>
-                            <td><?php echo htmlentities($key); ?></td>
-                            <td><?php echo_value($val); ?></td>
-                        </tr>
-                    <?php } ?>
-                    </tbody>
-                <?php } ?>
-            </table>
-        <?php } ?>
-    </div>
-<?php } ?>
-
-<?php if (\think\facade\App::isDebug()) { ?>
-    <script>
-        function $(selector, node) {
-            var elements;
-
-            node = node || document;
-            if (document.querySelectorAll) {
-                elements = node.querySelectorAll(selector);
-            } else {
-                switch (selector.substr(0, 1)) {
-                    case '#':
-                        elements = [node.getElementById(selector.substr(1))];
-                        break;
-                    case '.':
-                        if (document.getElementsByClassName) {
-                            elements = node.getElementsByClassName(selector.substr(1));
-                        } else {
-                            elements = get_elements_by_class(selector.substr(1), node);
-                        }
-                        break;
-                    default:
-                        elements = node.getElementsByTagName();
-                }
-            }
-            return elements;
-
-            function get_elements_by_class(search_class, node, tag) {
-                var elements = [], eles,
-                    pattern = new RegExp('(^|\\s)' + search_class + '(\\s|$)');
-
-                node = node || document;
-                tag = tag || '*';
-
-                eles = node.getElementsByTagName(tag);
-                for (var i = 0; i < eles.length; i++) {
-                    if (pattern.test(eles[i].className)) {
-                        elements.push(eles[i])
-                    }
-                }
-
-                return elements;
-            }
-        }
-
-        $.getScript = function (src, func) {
-            var script = document.createElement('script');
-
-            script.async = 'async';
-            script.src = src;
-            script.onload = func || function () {
-            };
-
-            $('head')[0].appendChild(script);
-        }
-
-        ;(function () {
-            var files = $('.toggle');
-            var ol = $('ol', $('.prettyprint')[0]);
-            var li = $('li', ol[0]);
-
-            // 短路径和长路径变换
-            for (var i = 0; i < files.length; i++) {
-                files[i].ondblclick = function () {
-                    var title = this.title;
-
-                    this.title = this.innerHTML;
-                    this.innerHTML = title;
-                }
-            }
-
-            (function () {
-                var expand = function (dom, expand) {
-                    var ol = $('ol', dom.parentNode)[0];
-                    expand = undefined === expand ? dom.attributes['data-expand'].value === '0' : undefined;
-                    if (expand) {
-                        dom.attributes['data-expand'].value = '1';
-                        ol.style.display = 'none';
-                        dom.innerText = 'Call Stack (展开)';
-                    } else {
-                        dom.attributes['data-expand'].value = '0';
-                        ol.style.display = 'block';
-                        dom.innerText = 'Call Stack (折叠)';
-                    }
-                };
-                var traces = $('.trace');
-                for (var i = 0; i < traces.length; i++) {
-                    var h2 = $('h2', traces[i])[0];
-                    expand(h2);
-                    h2.onclick = function () {
-                        expand(this);
-                    };
-                }
-            })();
-
-            $.getScript('//cdn.bootcss.com/prettify/r298/prettify.min.js', function () {
-                prettyPrint();
-            });
-        })();
-    </script>
-<?php } ?>
-</body>
-</html>

+ 60 - 36
app/index/view/video/index.html

@@ -148,7 +148,7 @@
     };
 
     var data = `{  "initial": [ "js/all.min.js" ],
-        "game": [  "js/default.thm.js?v=8" , "js/main.min.js?v=8"  ]
+        "game": [  "js/default.thm.js?v=9" , "js/main.min.js?v=9"  ]
     }`;
     var manifest = JSON.parse(data);
     var list = manifest.initial.concat(manifest.game);
@@ -171,8 +171,22 @@
     });
 </script>
 
+<script>    
+    function getQueryString(name) {
+        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+        var r = window.location.search.substr(1).match(reg);
+        if (r != null) {
+            return (r[2]);
+        } else {
+            return null;
+        }
+    }
+</script>
 
+<script src="js/eruda.min.js"></script>
+<script>        if(getQueryString('dbg')==1){    eruda.init();    }             </script>
 <script>
+
     // 获取参数
     function getPara(_key) {
         var reg = new RegExp("(^|&)" + _key + "=([^&]*)(&|$)");
@@ -196,13 +210,48 @@
     isWeibo = '<?php echo $isWeibo; ?>';
     mock = '<?php echo $mock; ?>';
     console.log(isWeibo);
-    console.log(mock);
+    console.log('mock = ' + mock);
+
+    function onOpen(url) {
+        console.log('-----onOpen-------')
+        let scheme;
+        if (!url) {
+            url = location.href; // 要打开的 H5 页面的地址
+            scheme = `sinaweibo://browser?url=${encodeURIComponent(url)}`;
+        } else {
+            if (url.search('http') != -1) {
+                scheme = `sinaweibo://browser?url=${encodeURIComponent(url)}`;
+            } else {
+                scheme = url;
+            }
+        }
+        console.log('打开链接:', scheme);
+
+        if (isWeibo == 0) {    
+            // 非微博
+            var u = `https://m.weibo.cn/feature/openapp?scheme=${encodeURIComponent(scheme)}`;
+            console.log('u = ' + u )
+            // window.location.href = u;
+
+            setTimeout(function(){
+                 window.location.href = u;
+            } , 300 )
+        }else{
+            // 微博
+            console.log('微博环境')
+        }
+
+    }
 
     if (mock == '0') {
         if (isWeibo != '1') {
             showMessage('请使用微博客户端打开');
             onOpen();
+        }else{
+            console.log('isweibo......')
         }
+    }else{
+        console.log('mock !==== 0')
     }
 
     console.log("isWeibo = " + isWeibo)
@@ -219,39 +268,10 @@
         window.location.href = `sinaweibo://login?redirect_scheme=${(encodeURIComponent(location.href))} `;
     }
 
-    function onOpen(url) {
-        let scheme;
-        if (!url) {
-            url = location.href; // 要打开的 H5 页面的地址
-            scheme = `sinaweibo://browser?url=${encodeURIComponent(url)}`;
-        } else {
-            if (url.search('http') != -1) {
-                scheme = `sinaweibo://browser?url=${encodeURIComponent(url)}`;
-            } else {
-                scheme = url;
-            }
-        }
-        console.log('打开链接:', scheme);
-
-        if (isWeibo) {
-            window.location.href = scheme;
-        } else {
-            window.location.href = `https://m.weibo.cn/feature/openapp?scheme=${encodeURIComponent(scheme)}`;
-        }
-
-    }
+   
 
     // 关于微博 ======== END
 
-    function getQueryString(name) {
-        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
-        var r = window.location.search.substr(1).match(reg);
-        if (r != null) {
-            return (r[2]);
-        } else {
-            return null;
-        }
-    }
 
 
 
@@ -262,7 +282,7 @@
     var stayTime = 1500;
 
 
-    var version = 8;
+    var version = 9;
     var isShare = 0;
     var theTokenData = '';
 
@@ -277,6 +297,7 @@
     isBeginActivity = '<?php echo $isBeginActivity; ?>';
     user = '<?php echo $user; ?>';
     taskData = '<?php echo $task; ?>';
+    task = ''
 
     if(isBeginActivity == 0){
         // 活动结束
@@ -284,6 +305,10 @@
     }
 
     function checkLogin(backFun){
+        console.log("user:")
+        console.log(user)
+        console.log("taskData:")
+        console.log(taskData)
 
         Main.userInfo = JSON.parse( user );
         task = JSON.parse( taskData );
@@ -291,7 +316,7 @@
         if(task.length == 0){
             TestPage.getDanNum = 0;
         }else{
-            TestPage.getDanNum = data.data.task.num;
+            TestPage.getDanNum = task.number;
         }
         console.log("Main.userInfo = " )
         console.log( Main.userInfo )
@@ -752,8 +777,7 @@
 
 
 
-<script src="js/eruda.min.js"></script>
-<script>        if(getQueryString('dbg')==1){    eruda.init();    }             </script>
+
 
 
 </body>

+ 2 - 2
config/app.php

@@ -24,5 +24,5 @@ return [
     // 非调试模式时显示错误的消息
     'error_message'    => '页面错误!请稍后再试~',
     // 调试模式异常页面的模板文件
-    'exception_tmpl'   => app()->getBasePath() . 'admin/view/error.tpl',
-];
+    'exception_tmpl'   => app()->getBasePath() . 'admin/view/error.html',
+];