dever 6 gadi atpakaļ
vecāks
revīzija
2e8d808588

+ 2 - 1
content/database/article.php

@@ -129,8 +129,9 @@ return array
 			'desc' 		=> '作者',
 			'desc' 		=> '作者',
 			'match' 	=> 'is_numeric',
 			'match' 	=> 'is_numeric',
 			'update'	=> 'select',
 			'update'	=> 'select',
-			'option'	=> $author,
+			//'option'	=> $author,
 			'search'	=> 'select',
 			'search'	=> 'select',
+			'update_search'	=> 'content/lib/author.search',
 		),
 		),
 
 
 		'wechat'		=> array
 		'wechat'		=> array

+ 15 - 1
content/database/author.php

@@ -99,6 +99,20 @@ return array
 
 
 	'request' => array
 	'request' => array
 	(
 	(
-		
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				'name' => array('yes', 'like'),
+				'id' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'desc'),
+			'limit' => '0,1000',
+			'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
+		),
 	),
 	),
 );
 );

+ 76 - 0
content/lib/Author.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace Content\Lib;
+
+use Dever;
+
+class Author
+{
+    # 更新数据
+    public function data($id, $name, $data)
+    {
+        $source_table = Dever::input('source_table');
+
+        $author = Dever::param('author_id', $data);
+
+        if ($author && $id > 0 && $source_table) {
+            $info = Dever::db('content/author')->one($author);
+            if (!$info) {
+                $insert['name'] = $author;
+                $author = Dever::db('content/author')->insert($insert);
+            }
+
+            Dever::db($source_table)->update(array('where_id' => $id, 'author_id' => $author));
+        }
+    }
+
+    # 搜索
+    public function search_api()
+    {
+        $keyword = Dever::input('keyword');
+
+        $yes = Dever::input('yes');
+
+        $where = array();
+
+        if ($yes) {
+            $yes = Dever::db('content/author')->getAll(array('ids' => $yes));
+        }
+        if (!$keyword) {
+            $where['limit'] = '0,50';
+            $data = Dever::db('content/author')->getAll($where);
+        } else {
+            $where['name'] = $keyword;
+            $data = Dever::db('content/author')->getAll($where);
+        }
+
+        $insert = array();
+        if (!$data && $keyword) {
+            $insert[0]['name'] = $keyword . '[新增]';
+            $insert[0]['value'] = $keyword;
+        }
+
+        $result = array();
+        if ($yes) {
+            foreach ($yes as $k => $v) {
+                if (isset($data[$k])) {
+                    unset($data[$k]);
+                }
+                $yes[$k]['selected'] = 'selected';
+            }
+            $data = $insert + $yes + $data;
+
+            $data = array_merge($data, array());
+        } else {
+            $data = $insert + $data;
+
+            $data = array_merge($data, array());
+        }
+
+        if (!$data) {
+            Dever::alert('暂无数据');
+        }
+
+        return $data;
+    }
+}

+ 2 - 1
doc/apidoc.php

@@ -274,7 +274,8 @@
  * @apiSuccess {String}   config.article_share_name 图文详情页分享文字
  * @apiSuccess {String}   config.article_share_name 图文详情页分享文字
  * @apiSuccess {String}   config.vod_share_name 视频详情页分享文字
  * @apiSuccess {String}   config.vod_share_name 视频详情页分享文字
  * @apiSuccess {String}   config.live_share_name 直播详情页分享文字
  * @apiSuccess {String}   config.live_share_name 直播详情页分享文字
- * @apiSuccess {String}   config.ios_pay ios支付设置 1为不开启小程序支付,2为开启小程序支付,使用h5支付
+ * @apiSuccess {String}   config.ios_pay ios支付设置 1为不开启小程序支付,将所有购买按钮都隐藏掉,2为开启小程序支付,使用h5支付
+ * @apiSuccess {String}   config.ios_pay_pic ios支付引导图
 
 
  * @apiSuccess {Object[]} menu 栏目
  * @apiSuccess {Object[]} menu 栏目
  * @apiSuccess {String}   menu.name 名称
  * @apiSuccess {String}   menu.name 名称

+ 17 - 1
main/database/config.php

@@ -104,7 +104,7 @@ return array
 
 
 		'hr3'		=> array
 		'hr3'		=> array
 		(
 		(
-			'name' 		=> '支付设置',
+			'name' 		=> '小程序支付设置',
 			'class'		=> '',//本项必须填写
 			'class'		=> '',//本项必须填写
 			'attr'		=> '',
 			'attr'		=> '',
 		),
 		),
@@ -120,6 +120,22 @@ return array
 			'option'	=> $ios_pay,
 			'option'	=> $ios_pay,
 		),
 		),
 
 
+		'ios_pay_pic'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> 'ios支付引导图-ios支付引导图',
+			'default' 	=> '',
+			'desc' 		=> 'ios支付引导图',
+			'match' 	=> 'option',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+			//直接上传到云端
+			//'upload'	=> 'qiniu',
+			//上传大数据
+			//'large' 	=> true,
+		),
+
 		'cdate'		=> array
 		'cdate'		=> array
 		(
 		(
 			'type' 		=> 'int-11',
 			'type' 		=> 'int-11',

+ 7 - 0
main/src/Journal.php

@@ -151,6 +151,13 @@ class Journal extends Core
             $this->setButton('read', 2, '购买阅读');
             $this->setButton('read', 2, '购买阅读');
             $this->setButton('code', 1, '兑换码阅读');
             $this->setButton('code', 1, '兑换码阅读');
         }
         }
+
+        if (isset($this->data['config']['ios_pay']) && $this->data['config']['ios_pay'] == 1 && $info['buy'] == 1) {
+            # 关闭支付
+            $this->setButton('read', 1, '开始阅读');
+            $this->setButton('code', 1, '兑换码阅读');
+            $this->setButton('share', -1);
+        }
     }
     }
 
 
     private function setButton($key = false, $status = false, $name = false)
     private function setButton($key = false, $status = false, $name = false)

+ 2 - 0
tag/lib/Core.php

@@ -52,6 +52,8 @@ class Core
             $tag = implode(',', $tag);
             $tag = implode(',', $tag);
             Dever::db($source_table)->update(array('where_id' => $id, 'tag' => $tag));
             Dever::db($source_table)->update(array('where_id' => $id, 'tag' => $tag));
         }
         }
+
+        Dever::load('content/lib/author')->data($id, $name, $data);
     }
     }
 
 
     # 搜索
     # 搜索