dever 4 years ago
parent
commit
73f436343d

+ 13 - 1
app/collection/database/info.php

@@ -132,10 +132,22 @@ $config = array
             //'list'        => true,
         ),
 
+        'logo'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => 'LOGO图片-图片尺寸150*150px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'default'   => '',
+            'desc'      => 'LOGO图片',
+            'match'     => 'is_string',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150*150',
+        ),
+
         'pic_cover'     => array
         (
             'type'      => 'varchar-150',
-            'name'      => '封面图-也用作分享图片,图片尺寸660*660px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
+            'name'      => '封面图-用作列表页的图片,也用作分享图片,图片尺寸660*660px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
             'default'   => '',
             'desc'      => '封面图',
             'match'     => 'is_string',

+ 56 - 0
app/collection/lib/Core.php

@@ -76,4 +76,60 @@ class Core
 
         return $code;
     }
+
+    protected function getInfoCode()
+    {
+        # 获取最新的用户记录
+        $where['info_id'] = $this->id;
+        $where['uid'] = $this->uid;
+        $record = Dever::db('collection/user_record')->one($where);
+        if ($record) {
+            $parent_page_id = $record['parent_page_id'];
+            $page_id = $record['page_id'];
+            $times = $record['times_id'];
+            $index = $record['index'];
+            $day = $record['day'];
+        } else {
+            # 获取最新的章节页id
+            $page_where['info_id'] = $this->id;
+            $page_where = $this->getTimesId($page_where);
+            $page = Dever::db('collection/page')->child($page_where);
+            $parent_page_id = $page_id = 0;
+            if ($page) {
+                $parent_page_id = $page[0]['page_id'];
+                $page_id = $page[0]['id'];
+            } else {
+                Dever::alert('内容还没有准备好');
+            }
+            $times = 0;
+            if ($this->times) {
+                $times = $this->times;
+            }
+            $index = 0;
+            $day = 0;
+        }
+
+        # 获取code
+        $code = $this->getCode($this->id, $parent_page_id, $page_id, $index, $times, $day);
+
+        return $code;
+    }
+
+    # 获取时光id
+    protected function getTimesId($where)
+    {
+        # 获取当前年份的最新的时光
+        if (!$this->times) {
+            $where['year'] = date('Y');
+            $times = Dever::db('collection/times')->getNew($where);
+            if ($times) {
+                $this->times = $times['id'];
+            }
+        }
+        if ($this->times) {
+            $where['times_id'] = $this->times;
+        }
+
+        return $where;
+    }
 }

+ 30 - 67
app/collection/src/Api.php

@@ -16,11 +16,6 @@ class Api extends Core
         }
     }
 
-    public function data()
-    {
-        return Dever::db('collection/info')->state();
-    }
-
     # 获取用户信息
     public function getUser()
     {
@@ -152,11 +147,7 @@ class Api extends Core
     {
         # 是否已经购买
         $data['is_buy'] = false;
-        $data['button'] = array(
-            'bgcolor' => 'background: linear-gradient(to right, #000000,#000000) !important;color:#fff;',
-            'color' => 'color:#fff',
-            'name' => array('入口', '排行榜')
-        );
+        
         $data['info'] = Dever::db('collection/info')->one($this->id);
         if ($data['info']) {
             $data['info']['user'] = array();
@@ -173,52 +164,38 @@ class Api extends Core
                 $data['is_buy'] = true;
             }
 
-            $data['button']['name'] = explode(',', $data['info']['button']);
-            if ($data['info']['button_bgcolor'] && $data['info']['button_bgjcolor']) {
-                $data['button']['bgcolor'] = 'background: linear-gradient(to right, '.$data['info']['button_bgcolor'].','.$data['info']['button_bgjcolor'].') !important;';
-            }
-            if ($data['info']['button_ftcolor']) {
-                $data['button']['color'] = 'color:' . $data['info']['button_ftcolor'];
-                $data['button']['bgcolor'] .= $data['button']['color'];
-            }
-
-            # 获取最新的用户记录
-            $where['info_id'] = $this->id;
-            $where['uid'] = $this->uid;
-            $record = Dever::db('collection/user_record')->one($where);
-            if ($record) {
-                $parent_page_id = $record['parent_page_id'];
-                $page_id = $record['page_id'];
-                $times = $record['times_id'];
-                $index = $record['index'];
-                $day = $record['day'];
-            } else {
-                # 获取最新的章节页id
-                $page_where['info_id'] = $data['info']['id'];
-                $page_where = $this->getTimesId($page_where);
-                $page = Dever::db('collection/page')->child($page_where);
-                $parent_page_id = $page_id = 0;
-                if ($page) {
-                    $parent_page_id = $page[0]['page_id'];
-                    $page_id = $page[0]['id'];
-                } else {
-                    Dever::alert('内容还没有准备好');
-                }
-                $times = 0;
-                if ($this->times) {
-                    $times = $this->times;
-                }
-                $index = 0;
-                $day = 0;
-            }
+            # 获取按钮样式
+            $data['button'] = $this->button($data['info']);
 
             # 获取code
-            $data['code'] = $this->getCode($data['info']['id'], $parent_page_id, $page_id, $index, $times, $day);
+            $data['code'] = $this->getInfoCode();
+        } else {
+            Dever::alert('内容还没有准备好');
         }
 
         return $data;
     }
 
+    private function button($info)
+    {
+        $button = array(
+            'bgcolor' => 'background: linear-gradient(to right, #000000,#000000) !important;color:#fff;',
+            'color' => 'color:#fff',
+            'name' => array('入口', '排行榜')
+        );
+
+        $button['name'] = explode(',', $info['button']);
+        if ($info['button_bgcolor'] && $info['button_bgjcolor']) {
+            $button['bgcolor'] = 'background: linear-gradient(to right, '.$info['button_bgcolor'].','.$info['button_bgjcolor'].') !important;';
+        }
+        if ($info['button_ftcolor']) {
+            $button['color'] = 'color:' . $info['button_ftcolor'];
+            $button['bgcolor'] .= $button['color'];
+        }
+
+        return $button;
+    }
+
     # 获取合集下的内容
     public function getContent()
     {
@@ -230,6 +207,10 @@ class Api extends Core
         # 获取用户信息
         $data['user'] = $this->user;
         $data['info'] = Dever::db('collection/info')->one($this->id);
+        # 获取按钮样式
+        $data['info']['button'] = $this->button($data['info']);
+        # 是否可以看
+        $data['show'] = true;
         # 获取每个模块
         $data['items'] = Dever::load('collection/lib/content')->getList($this->id, $this->page_id);
         # 滑动到多少时,加载下一页
@@ -506,24 +487,6 @@ class Api extends Core
         return $result;
     }
 
-    # 获取时光id
-    private function getTimesId($where)
-    {
-        # 获取当前年份的最新的时光
-        if (!$this->times) {
-            $where['year'] = date('Y');
-            $times = Dever::db('collection/times')->getNew($where);
-            if ($times) {
-                $this->times = $times['id'];
-            }
-        }
-        if ($this->times) {
-            $where['times_id'] = $this->times;
-        }
-
-        return $where;
-    }
-
     public function video()
     {
         $link = Dever::input('link');

+ 75 - 0
config/base.php

@@ -51,6 +51,81 @@ $config['base'] = array
 
     # 站点使用邮箱还是手机作为主账号
     'account' => 'mobile',
+
+    # 性别转换 passport里1为男、2为女 3为未知,如果前端定义与这个不同,请做好转换
+    'sex' => array
+    (
+        # 前面的索引为前端传过来的值
+        2 => 2,
+        1 => 1,
+        3 => 3,
+    ),
+    'mobileCode' => array
+    (
+        # debug模式
+        'debug' => true,
+        # 发送短信的接口
+        'url' => 'https://feginesms.market.alicloudapi.com/codeNotice',
+        'url' => '',
+        # 保存方式 cookie、session、db 三种可选 默认为session
+        'save' => 'db',
+        # 发送方法 get、post
+        'method' => 'get',
+        # 是否json编码
+        'json' => false,
+        # header信息
+        'header' => 'Authorization:APPCODE ca584ae21ce54c999067e77b5995a27b',
+        # body信息
+        'body' => 'param={code}&phone={mobile}&sign={sign}&skin={skin}',
+        # 短信模板 发送短信时,请加上参数skin=1
+        'skin' => array
+        (
+            'reg' => 35247,
+            'order' => 35246,
+            'code' => 35245,
+            # 需要增加一个notice
+            'notice' => 38099,
+            # order的反馈方案修改后
+            'feedback' => 38747,
+        ),
+        # 短信签名
+        'sign' => 47159,
+        # 验证码有效期 默认10分钟
+        'timeout' => 600,
+        # 一天之内的最大发送次数,默认为10次
+        'total' => 10,
+        # 不允许多久之内重复发送,默认为60秒
+        'time' => 60,
+        # 验证码长度
+        'length' => 6,
+    ),
+    # 注册成功后,调取的接口
+    'regAction' => '',
+
+    # 注册成功后,是否发送短信,直接使用skin的key即可
+    //'regSendSms' => 'reg',
+
+    # 用户中心的列表中显示的项目
+    'passport_list_button' => array
+    (
+        /*
+        'list1' => array('订单', '"order&project=act&search_option_uid={id}&oper_parent=user&oper_project=passport"'),
+        'list2' => array('兑换码', '"info&project=code&search_option_create_uid={id}&oper_parent=user&oper_project=passport"'),
+        'list3' => array('积分', '"user&project=score&search_option_uid={id}&oper_parent=user&oper_project=passport"'),
+        */
+    ),
+
+    # 支付成功后,调用的接口
+    //'pay_notify' => 'service/lib/pay.act',
+
+    # 日志系统
+    'log' => array
+    (
+        'cron' => array
+        (
+            'ad/lib/cron.run'
+        ),
+    ),
 );
 
 

+ 2 - 2
main/database/config.php

@@ -64,7 +64,7 @@ return array
 			'key' 		=> '1',
 			'place'		=> '150',
 		),
-
+		
 		'cdate'		=> array
 		(
 			'type' 		=> 'int-11',
@@ -81,7 +81,7 @@ return array
 		'col' => 'name,info,cdate',
 		'value' => array
 		(
-			'"幻境","幻境",' . time(),
+			'"云店·幻境","云店·幻境",' . time(),
 		),
 	),
 

+ 113 - 0
main/database/page.php

@@ -0,0 +1,113 @@
+<?php
+
+
+$config = array
+(
+    # 表名
+    'name' => 'page',
+    # 显示给用户看的名称
+    'lang' => '单页管理',
+    # 后台菜单排序
+    'order' => 2,
+    'check' => 'key',
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            //'search'    => 'order',
+            //'list'      => true,
+            'order'     => 'desc',
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '标题',
+            'default'   => '',
+            'desc'      => '标题',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'key'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '标识',
+            'default'   => '',
+            'desc'      => '标识',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'content'      => array
+        (
+            'type'      => 'text-255',
+            'name'      => '内容',
+            'default'   => '',
+            'desc'      => '内容',
+            'match'     => 'is_string',
+            'update'    => 'editor',
+            //'list_name'		=> '链接',
+            //'list'      => 'Dever::load("content/lib/page.link", {id})',
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '录入时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    )
+);
+$auth = Dever::tops();
+
+if ($auth && $auth != 1) {
+    $config['request']['list'] = array
+    (
+        # 匹配的正则或函数 选填项
+        'option' => array
+        (
+            'name' => array('yes', 'like'),
+            'key' => array('_' . $auth, 'like'),
+        ),
+        'type' => 'all',
+        'order' => array('id' => 'desc'),
+        'page' => array(20, 'list'),
+        'col' => '*|id',
+    );
+}
+
+return $config;

+ 22 - 0
main/src/Api.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace Main\Src;
+
+use Dever;
+use Main\Lib\Core;
+
+class Api
+{
+    # 基本配置
+    public function config()
+    {
+        $data = Dever::db('main/config')->one();
+
+        $result = array();
+        $result['system_name'] = $data['name'];
+        $result['system_info'] = $data['info'];
+        $result['system_logo'] = $data['logo'];
+
+        return $result;
+    }
+}

+ 0 - 305
main/src/Content.php

@@ -1,305 +0,0 @@
-<?php
-
-namespace Main\Src;
-
-use Dever;
-use Main\Lib\Core;
-
-//class Content extends Core
-class Content
-{
-    public function test()
-    {
-        $test_url = 'http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json';
-        $appkey = '32667432-5f6a-4b45-9a84-d8bad424d421';
-        $param['RequestData'] = json_encode(array
-        (
-            'OrderCode' => '',
-            'ShipperCode' => 'zhongtong',
-            'LogisticCode' => '75323014559816',
-        ));
-        $param['EBusinessID'] = 'test1615206';
-        $param['RequestType'] = '1002';
-        $param['DataType'] = '2';
-        $param['DataSign'] = urlencode(base64_encode(md5($param['RequestData'] . $appkey)));
-
-        $data = Dever::curl($test_url, $param, 'post', true);
-        print_r($data);die;
-    }
-    public function user()
-    {
-        $user = Dever::load('passport/user')->data();
-        if ($user) {
-            $url = Dever::url('passport/login.quit');
-            $html = '<li>'.$user['email'].'</li><li><a href="'.$url.'">退出</a></li>';
-        } else {
-            $html = '<li><a href="javascript:;" onclick="login()">登录</a></li>
-                    <li><a href="javascript:;" onclick="reg()">注册</a></li>';
-        }
-
-        $config = $this->config();
-        $link = $config['email_link'];
-        $html .= '<li><a href="'.$link.'" target="_blank">企业邮箱登录</a></li>';
-
-        return $html;
-    }
-
-    # 基本配置
-    public function config()
-    {
-        return Dever::db('main/config')->one();
-    }
-
-    # 单页信息
-    public function page($key = false)
-    {
-        $key = Dever::input('key', $key);
-        $data = Dever::db('content/page')->one(array('key' => $key));
-
-        $data['link'] = Dever::url('page?key=' . $data['key'], 'main');
-        return $data;
-    }
-
-    # pdf信息
-    public function pdf()
-    {
-        $user = Dever::load('passport/user')->data();
-        if (!$user) {
-            Dever::alert('未登录');
-        }
-        $id = Dever::input('id');
-        $data = Dever::db('content/magazine')->one($id);
-        $data['view'] = 'var file = "'.$data['file'].'"';
-        return $data;
-    }
-
-    # 文章信息
-    public function view($id = false)
-    {
-        $data = array();
-        $id = Dever::input('id', $id);
-        if ($id > 0) {
-            $data = Dever::db('content/article')->one($id);
-
-            $cate = Dever::db('content/cate')->one($data['cate_id']);
-            $data['cate_name'] = $cate['name'];
-            $data['cate_link'] = Dever::url('list?cate=' . $data['cate_id'], 'main');
-
-            $author = Dever::db('content/author')->one($data['author_id']);
-            $data['author_name'] = '编辑:' . $author['name'];
-
-            $data['date'] = date('Y-m-d', $data['cdate']);
-
-            $data['share'] = 'var wbtitle = "'.$data['name'].'";var wbpic = "'.$data['pic_cover'].'";var wbappkey = "1867678939"';
-        }
-        
-        return $data;
-    }
-
-    # 栏目信息
-    public function cate($cate = false)
-    {
-        $data = array();
-        $id = Dever::input('cate', $cate);
-        if ($id > 0) {
-            $data = Dever::db('content/cate')->one($id);
-            $data['cate_link_1'] = Dever::url('list?cate=' . $data['id'], 'main');
-            $data['cate_link_2'] = Dever::url('list_text?cate=' . $data['id'], 'main');
-        }
-        
-        return $data;
-    }
-
-    # 菜单
-    public function menu()
-    {
-        $config = $this->config();
-        # 小程序去掉视频栏目
-        $cate = array();
-        //$cate['id_no'] = 2;
-        $data = Dever::db('content/cate')->getAll($cate);
-
-        if ($data) {
-            foreach ($data as $k => $v) {
-                $data[$k]['link'] = Dever::url('list?cate=' . $v['id'], 'main');
-            }
-        }
-
-        $data[-2] = array
-        (
-            'id' => -2,
-            'name' => '电子杂志',
-            'link' => Dever::url('magazine?cate=-2', 'main'),
-            'class' => '',
-        );
-
-        $data[-3] = array
-        (
-            'id' => -3,
-            'name' => '报刊订阅',
-            'link' => $config['buy_link'],
-            'class' => '',
-        );
-
-        $index = array
-        (
-            'id' => -1,
-            'name' => '首页',
-            'link' => Dever::url('home', 'main'),
-            'class' => '',
-        );
-
-        $cate = Dever::input('cate', -1);
-
-        if ($cate == -1) {
-            $index['class'] = 'active';
-        } elseif ($cate == -2) {
-            $data[-2]['class'] = 'active';
-        } else {
-            foreach ($data as $k => $v) {
-                $data[$k]['class'] = '';
-                if ($cate == $v['id']) {
-                    $data[$k]['class'] = 'active';
-                }
-            }
-        }
-        array_unshift($data, $index);
-
-
-
-        return $data;
-    }
-
-    # 焦点图
-    public function focus()
-    {
-        $cate = Dever::input('cate', -1);
-        $key = 'focus_' . $cate;
-        $name = '焦点图';
-        if ($cate > 0) {
-            $cate = Dever::db('content/cate')->one($cate);
-            if ($cate) {
-                $name = $cate['name'] . $name;
-            }
-        } else {
-            $name = '首页' . $name;
-        }
-        $data = Dever::load('push/lib/data')->get($key, $name, 6);
-        return $data;
-    }
-
-    # 获取推荐列表
-    public function getPush($data)
-    {
-        return Dever::load('push/lib/data')->get($data['key'], $data['name'], $data['num']);
-    }
-
-    # 获取广告位数据
-    public function getAd($name)
-    {
-        $info = Dever::load('push/lib/data')->getOne('ad', '广告位', 20, $name);
-        if ($info && $info['pic']) {
-            return '<a href="'.$info['link'].'" target="_blank"><img src="'.$info['pic'].'" alt="'.$info['name'].'"></a>';
-        } else {
-            return '';
-        }
-    }
-
-    # 获取首页文章列表
-    public function getList($data)
-    {
-        $where['cate_id'] = $data['cate_id'];
-        $where['limit'] = $data['num'];
-        $data = Dever::db('content/article')->getList($where);
-        if ($data) {
-            foreach ($data as $k => $v) {
-                if (isset($v['pic_index']) && $v['pic_index']) {
-                    $data[$k]['pic'] = $v['pic_index'];
-                } else {
-                    $data[$k]['pic'] = $v['pic_cover'];
-                }
-                
-                $data[$k]['link'] = $this->link($v);
-            }
-        }
-
-        return $data;
-    }
-
-    # 获取文章列表
-    public function getAll()
-    {
-        $where['cate_id'] = Dever::input('cate');
-        $data = Dever::db('content/article')->getAll($where);
-        if ($data) {
-            foreach ($data as $k => $v) {
-                $data[$k]['pic'] = $v['pic_cover'];
-                $data[$k]['link'] = $this->link($v);
-            }
-        }
-
-        return $data;
-    }
-
-    # 获取杂志列表
-    public function getMagazine()
-    {
-        $where['cate_id'] = Dever::input('cate_id', 1);
-        $data = Dever::db('content/magazine')->getAll($where);
-        $user = Dever::load('passport/user')->data();
-        if ($data) {
-            foreach ($data as $k => $v) {
-                $data[$k]['pic'] = $v['pic_cover'];
-                if ($user) {
-                    $data[$k]['link'] = Dever::url('pdf?id=' . $v['id']);
-                } else {
-                    $data[$k]['link'] = 'javascript:login()';
-                }
-            }
-        }
-
-        return $data;
-    }
-
-    # 获取杂志分类列表
-    public function getMagazineCate()
-    {
-        $data = Dever::db('content/magazine_cate')->getAll();
-        if ($data) {
-            foreach ($data as $k => $v) {
-                $data[$k]['pic'] = $v['pic_cover'];
-                $data[$k]['link'] = Dever::url('magazine_list?cate=-2&cate_id=' . $v['id']);
-            }
-        }
-
-        return $data;
-    }
-
-    # 获取文章列表
-    public function getRelation()
-    {
-        $id = Dever::input('id');
-        $info = Dever::db('content/article')->one($id);
-        $where['noid'] = $id;
-        $where['cate_id'] = $info['cate_id'];
-        $data = Dever::db('content/article')->getRelation($where);
-        if ($data) {
-            foreach ($data as $k => $v) {
-                $data[$k]['pic'] = $v['pic_cover'];
-                $data[$k]['link'] = $this->link($v);
-            }
-        }
-
-        return $data;
-    }
-
-    public function link($data)
-    {
-        if ($data['template'] == 2) {
-            $link = Dever::url('video?cate='.$data['cate_id'].'&id=' . $data['id'], 'main');
-        } else {
-            $link = Dever::url('view?cate='.$data['cate_id'].'&id=' . $data['id'], 'main');
-        }
-        return $link;
-    }
-}