dever 6 лет назад
Родитель
Сommit
3bb7f0b4fb
4 измененных файлов с 65 добавлено и 22 удалено
  1. 56 16
      content/lib/Article.php
  2. 2 2
      journal/database/active.php
  3. 6 3
      journal/database/buy.php
  4. 1 1
      spider/database/wechat.php

+ 56 - 16
content/lib/Article.php

@@ -20,7 +20,22 @@ class Article
         //embed
         $data['content_array'] = array();
 
-        /*
+        if (strstr($data['content'], 'font-family:" gb","microsoft="" sans="" hiragino="" yahei","simsun";')) {
+            $data['content'] = str_replace('font-family:" gb","microsoft="" sans="" hiragino="" yahei","simsun";', '', $data['content']);
+        }
+
+        if (strstr($data['content'], 'font-family:" yahei","simsun";')) {
+            $data['content'] = str_replace('font-family:" yahei","simsun";', '', $data['content']);
+        }
+
+        if (strstr($data['content'], '"="" gb","microsoft="" sans="" hiragino="')) {
+            $data['content'] = str_replace('"="" gb","microsoft="" sans="" hiragino="', '', $data['content']);
+        }
+
+        if (strstr($data['content'], '"="')) {
+            $data['content'] = str_replace('"="', '', $data['content']);
+        }
+
         if (strstr($data['content'], 'embed')) {
             //print_r($data['content']);die;
             # 音频
@@ -30,32 +45,57 @@ class Article
 
                 }
             }
-            print_r($matches);die;
         }
 
-        if (strstr($data['content'], 'dever-video')) {
+        if (strstr($data['content'], 'data-id')) {
             # 视频
-            //print_r($data['content']);die;
-            preg_match_all('/<div class="dever-video">([\s\S]*?)<img(.*?)data-id="(.*?)" data-key="(.*?)" \/>([\s\S]*?)<\/div>/i', $data['content'], $matches);
+            preg_match_all('/<p>(\s[^>]*)<img(.*?)data-id="(.*?)" data-key="(.*?)" \/>(\s[^>]*)<\/p>/is', $data['content'], $matches);
+            $replace = array();
+            $content = $data['content'];
             if (isset($matches[3][0]) && isset($matches[4][0])) {
                 foreach ($matches[3] as $k => $v) {
-                    $data['content'] = str_replace($matches[0][$k], '{replace}', $data['content']);
+                    $content = str_replace($matches[0][$k], '{replace}'.$k.'{replace}', $content);
+                    if ($matches[4][$k] == 'video/lib/core.vod') {
+                        $method = 'video/lib/vod';
+                        $type = 2;
+                    } else {
+                        $type = 3;
+                        $method = 'video/lib/live';
+                    }
+
+                    $info = Dever::load($method)->get($v);
+                    $replace[$k] = array('id' => $v, 'type' => $type, 'content' => $info);
                 }
             }
 
-            $data['content'] = preg_replace('/<div class="dever-drop">([\s\S]*?)<\/div>/i', '', $data['content']);
-            //$data['content'] = preg_replace('/<p>([\s\S]*?){replace}([\s\S]*?)<\/p>/i', '', $data['content']);
-            print_r($data['content']);die;
-            
+            //$data['content'] = preg_replace('/<div class="dever-drop">([\s\S]*?)<\/div>/i', '', $data['content']);
+
+            $content = explode('{replace}', $content);
+            $data['content_array'] = array();
+            foreach ($content as $k => $v) {
+                if (is_numeric($v) && $v >= 0 && isset($replace[$v])) {
+                    $data['content_array'][] = $replace[$v];
+                } elseif ($content[$k]) {
+                    $data['content_array'][] = array
+                    (
+                        'type' => 1,
+                        'content' => $v,
+                    );
+                }
+            }
+        }
 
-            echo $data['content'];
-            $content = explode('{replace}', $data['content']);
-            print_r($content);
-            print_r($matches);die;
+        if (!$data['content_array']) {
+            $data['content_array'][] = array
+            (
+                'type' => 1,
+                'content' => $data['content'],
+            );
         }
-        */
 
-        
+        unset($data['content']);
+
+        print_r($data);die;
         return $data;
     }
 

+ 2 - 2
journal/database/active.php

@@ -128,7 +128,7 @@ return array
         (
             'type'      => 'varchar-80',
             'name'      => '邀请好友标题',
-            'default'   => '',
+            'default'   => '邀请好友获得积分',
             'desc'      => '邀请好友标题',
             'match'     => 'is_string',
             'update'    => 'text',
@@ -138,7 +138,7 @@ return array
         (
             'type'      => 'varchar-800',
             'name'      => '邀请好友标题介绍',
-            'default'   => '',
+            'default'   => '邀请10人开启免费阅读',
             'desc'      => '邀请好友标题介绍',
             'match'     => 'is_string',
             'update'    => 'textarea',

+ 6 - 3
journal/database/buy.php

@@ -54,7 +54,7 @@ return array
         (
             'type'      => 'varchar-80',
             'name'      => '购买小刊标题',
-            'default'   => '',
+            'default'   => '购买小刊获得积分',
             'desc'      => '购买小刊标题',
             'match'     => 'is_string',
             'update'    => 'text',
@@ -64,7 +64,7 @@ return array
         (
             'type'      => 'varchar-800',
             'name'      => '购买小刊介绍',
-            'default'   => '',
+            'default'   => '每购买一本刊获得20积分',
             'desc'      => '购买小刊介绍',
             'match'     => 'is_string',
             'update'    => 'textarea',
@@ -74,7 +74,10 @@ return array
         (
             'type'      => 'text-255',
             'name'      => '购买说明',
-            'default'   => '',
+            'default'   => "<p>1、购买成功后可直接点击【开始阅读】查看阅读期刊内容;</p>
+<p>2、小刊为虚拟商品,如无系统问题,购买后不可退换;</p>
+<p>3、每购买一本小刊,可增加20积分;</p>
+<p>4、如有其他使用问题可咨询在线客服。</p>",
             'desc'      => '请输入内容',
             'match'     => 'is_string',
             'update'    => 'editor',

+ 1 - 1
spider/database/wechat.php

@@ -49,7 +49,7 @@ return array
         'name'      => array
         (
             'type'      => 'varchar-100',
-            'name'      => '名称-直接输入公众号名称即可,系统会自动抓取该公众号的前10篇文章,每天抓取一次',
+            'name'      => '名称-直接输入公众号名称即可,系统会自动抓取该公众号的最新10篇文章',
             'default'   => '',
             'desc'      => '请输入名称',
             'match'     => 'is_string',