one($id);
        $table = array();
        $user = Dever::db('passport/user')->one($info['uid']);
        $table['用户名'] = $user['username'] . '('.$info['uid'].')';
        $table['手机号'] = $user['mobile'];
        $table['产品名'] = $info['name'];
        if ($info['type'] == 1) {
            $table['支付方式'] = '购买小刊';
            $table['支付金额'] = $info['cash'];
        } elseif ($info['type'] == 3) {
            $table['支付方式'] = '购买小刊兑换码';
            $table['兑换码'] = $info['code'];
            $table['支付金额'] = $info['cash'];
        } elseif ($info['type'] == 2) {
            $table['支付方式'] = '兑换小刊';
            $table['兑换码'] = $info['code'];
        } elseif ($info['type'] == 4) {
            $table['支付方式'] = '使用通用兑换码';
            $table['兑换码'] = $info['code'];
        }
        //$table['购买数量'] = $info['num'];
        
        if ($info['source_uid'] && $info['source_uid'] != $info['uid']) {
            $user = Dever::db('passport/user')->one($info['source_uid']);
            $table['邀请人'] = $user['username'];
        }
        return Dever::table($table);
    }
    public function showOrderUserV1($id)
    {
        $info = Dever::db('act/order')->one($id);
        $table = array();
        $user = Dever::db('passport/user')->one($info['uid']);
        $table['用户名'] = $user['username'] . '('.$info['uid'].')';
        $table['手机号'] = $user['mobile'];
        $table['产品名'] = $info['name'];
        if ($info['type'] == 1) {
            $table['支付方式'] = '购买小刊';
            $table['支付金额'] = $info['cash'];
        } elseif ($info['type'] == 3) {
            $table['支付方式'] = '购买小刊兑换码';
            $table['兑换码'] = $info['code'];
            $table['支付金额'] = $info['cash'];
        } elseif ($info['type'] == 2) {
            $table['支付方式'] = '兑换小刊';
            $table['兑换码'] = $info['code'];
        } elseif ($info['type'] == 4) {
            $table['支付方式'] = '使用通用兑换码';
            $table['兑换码'] = $info['code'];
        }
        //$table['购买数量'] = $info['num'];
        
        if ($info['source_uid'] && $info['source_uid'] != $info['uid']) {
            $user = Dever::db('passport/user')->one($info['source_uid']);
            $table['邀请人'] = $user['username'];
        }
        return Dever::table($table);
    }
    # 获取订阅本数
    public function ding($id)
    {
        $data = Dever::db('journal/info')->one($id);
        $data = Dever::load('journal/api')->ding($data);
        $num_ding = $data['num_ding'];
        $num_add_ding = $data['num_add_ding'];
        $num_ratio_ding = $data['num_ratio_ding'];
        $num_view = $data['num_view'];
        $num_add_view = $data['num_add_view'];
        $num_comment = $data['num_comment'];
        $buy_num = $data['buy_num'];
        //$html = '订阅本数:('.$buy_num.'+'.$num_add_ding.')*'.$num_ratio_ding.'='.$num_ding.'
阅读数:'.$num_view.'+'.$num_add_view.'
评论数:'.$num_comment.'
';
        $cate = Dever::db('journal/cate')->one($data['cate_id']);
        $html = '《' . $cate['name'] . '》
';
        if ($data['buy'] == 1) {
            $html .= '收费电子刊
';
            $html .= '订阅本数:('.$buy_num.'+'.$num_add_ding.')*'.$num_ratio_ding.'='.$num_ding;
        } else {
            $html .= '免费电子刊
';
            $html .= '订阅数:('.$buy_num.'+'.$num_add_ding.')*'.$num_ratio_ding.'='.$num_ding;
        }
        
        return $html;
    }
    public function showOrderStatus($id)
    {
        $info = Dever::db('journal/order')->one($id);
        if ($info) {
            if ($info['status'] == 1) {
                #return '*已支付';
                return '待支付';
            } elseif ($info['status'] == 2) {
                return '已支付';
            } elseif ($info['status'] == 3) {
                return '支付失败';
            } elseif ($info['status'] == 5) {
                $table['状态'] = '已退款';
                $manage = Dever::db('manage/admin')->one($info['tk_admin']);
                $table['备注'] = $info['tk_desc'];
                $table['截图'] = '';
                //$table['退款时间'] = date('Y-m-d H:i:s', $info['tk_time']);
                $table['操作人'] = $manage['username'];
                return Dever::table($table);
            }
        }
    }
    public function showOrderStatusV1($id)
    {
        $info = Dever::db('act/order')->one($id);
        if ($info) {
            if ($info['status'] == 1) {
                #return '*已支付';
                return '待支付';
            } elseif ($info['status'] == 2) {
                return '已支付';
            } elseif ($info['status'] == 3) {
                return '支付失败';
            } elseif ($info['status'] == 5) {
                $table['状态'] = '已退款';
                $manage = Dever::db('manage/admin')->one($info['tk_admin']);
                $table['备注'] = $info['tk_desc'];
                $table['截图'] = '
';
                //$table['退款时间'] = date('Y-m-d H:i:s', $info['tk_time']);
                $table['操作人'] = $manage['username'];
                return Dever::table($table);
            }
        }
    }
	private function search($table = 'content/article')
	{
		$keyword = Dever::input('keyword');
        $yes = Dever::input('yes');
        $where = array();
        $cate = Dever::input('cate');
        if ($cate) {
            $where['cate_id'] = $cate;
        }
        if ($yes) {
            $yes = Dever::db($table)->search(array('ids' => $yes));
        }
        if (!$keyword) {
            $where['limit'] = '0,50';
            $data = Dever::db($table)->search($where);
        } else {
            $where['name'] = $keyword;
            $data = Dever::db($table)->search($where);
        }
        $result = array();
        if ($yes) {
            foreach ($yes as $k => $v) {
                if (isset($data[$k])) {
                    unset($data[$k]);
                }
                $yes[$k]['selected'] = 'selected';
            }
            $data = $yes + $data;
            $data = array_merge($data, array());
        } else {
            $data = array_merge($data, array());
        }
        if (!$data) {
            Dever::alert('暂无数据');
        }
        return $data;
	}
	# 搜索文章
    public function search_article_api()
    {
        return $this->search('content/article');
    }
    # 搜索视频
    public function search_vod_api()
    {
        return $this->search('video/vod');
    }
    # 搜索直播
    public function search_live_api()
    {
        return $this->search('video/live');
    }
    # 搜索小刊
    public function search_journal_api()
    {
        return $this->search('journal/info');
    }
    # 搜索专题
    public function search_feature_api()
    {
        return $this->search('feature/info');
    }
    # 搜索小程序
    public function search_applet_api()
    {
        return $this->search('content/applet');
    }
    # 按照分类搜索小刊
    public function search_cate_journal_api()
    {
        $level_num = Dever::input('level_num');
        $level_id = Dever::input('level_id');
        
        $auth = Dever::tops();
        $where = array();
        if ($level_num == 1) {
            $default = array
            (
                'value' => -1,
                'name' => '选择分类',
            );
            if ($auth) {
                $where['ids'] = $auth;
            }
            $data = Dever::db('journal/cate')->getIds($where);
        } elseif ($level_num == 2 && $level_id > 0) {
            $default = array
            (
                'value' => -1,
                'name' => '选择小刊',
            );
            if ($level_id > 0) {
                $where['cate_id'] = $level_id;
            } elseif ($auth) {
                $where['cate_id'] = $auth;
            }
            
            $data = Dever::db('journal/info')->getIds($where);
        } else {
            return array();
        }
        
        array_unshift($data, $default);
        $result['level_total'] = 2;
        $result['list'] = $data;
        return $result;
    }
    # 显示杂志内页
    public function journalContent()
    {
        $where['info_id'] = Dever::input('search_option_info_id');
        $where['state'] = Dever::input('search_option_state');
        $data = Dever::db('journal/content')->all($where);
        $database = Dever::load('manage/database');
        $type = Dever::db('journal/content')->config['gettype'];
        
        if ($data) {
            foreach ($data as $k => $v) {
                $data[$k]['height'] = 'height: 154px;';
                $data[$k]['info_height'] = 'height: auto;';
                if ($v['type'] > 2) {
                    $data[$k]['height'] = 'height: 104px;';
                    $data[$k]['info_height'] = 'height: 47px;';
                }
                if ($v['type'] <= 2) {
                    $data[$k]['name'] = '';
                } elseif ($v['type'] == 3) {
                    $data[$k]['pic'] = $v['focus'];
                }
                if ($v['type'] == 4 || $v['type'] == 5 || $v['type'] == 6) {
                    $data[$k]['name'] = '';
                    $data[$k]['pic'] = $v['cover'];
                }
                if ($v['type'] == 11) {
                    # 图文
                    $info = Dever::load('content/lib/article')->get($v['article_id']);
                    if ($info) {
                        $data[$k]['pic'] = $info['pic_cover'];
                        $data[$k]['name'] = $info['name'];
                    }
                } elseif ($v['type'] == 12) {
                    # 视频
                    $info = Dever::load('video/lib/vod')->get($v['vod_id']);
                    if ($info) {
                        $data[$k]['pic'] = $info['pic_cover'];
                        $data[$k]['name'] = $info['name'];
                    }
                } elseif ($v['type'] == 13) {
                    # 直播
                    $info = Dever::load('video/lib/live')->get($v['live_id']);
                    if ($info) {
                        $data[$k]['pic'] = $info['pic_cover'];
                        $data[$k]['name'] = $info['name'];
                    }
                }
                if ($v['type'] == 10) {
                    $palaces = Dever::array_decode($v['palaces']);
                    if (isset($palaces[0])) {
                        $data[$k]['pic'] = $palaces[0]['pic'];
                    }
                }
                if ($v['type'] == 21) {
                    if ($data[$k]['talk_pic']) {
                        $data[$k]['pic'] = $data[$k]['talk_pic'];
                    } else {
                        $talk = Dever::array_decode($v['talk']);
                        if ($talk) {
                            foreach ($talk as $tk => $tv) {
                                if ($tv['pic']) {
                                    $data[$k]['pic'] = $tv['pic'];
                                    break;
                                }
                            }
                        }
                    }
                }
                $data[$k]['typename'] = $type[$v['type']];
                /*
                if ($v['type'] == 1) {
                    $data[$k]['text'] = $this->text($database, $v['id'], $where['info_id']);
                } else {
                    $data[$k]['text'] = '';
                }
                */
                $data[$k]['text'] = '';
                $link = $database->url('edit', $v['id']) . '&search_option_info_id=' . $where['info_id'];
                $data[$k]['edit'] = "fastEdit($(this), '".$link."', '编辑内页', '', 1)";
                $data[$k]['editurl'] = $link;
                $data[$k]['delete'] = $database->url('delete', $v['id']);
            }
        }
        return $data;
    }
    private function text_name($link, $content_id, $info_id, $location, $name)
    {
        $where['info_id'] = $info_id;
        $where['content_id'] = $content_id;
        $where['location'] = $location;
        $info = Dever::db('journal/content_text')->one($where);
        $link .= '&search_option_info_id=' . $info_id. '&search_option_content_id=' . $content_id.'&table=content_text&search_option_location='.$location;
        if ($info) {
            $link .= '&where_id=' . $info['id'];
        }
        $html = ''.$name.'';
        return $html;
    }
    public function text($database, $content_id, $info_id)
    {
        $link = $database->url('edit');
        $location = Dever::db('journal/content_text')->config['location'];
        $html = '
| '.$name.''; if ($i == 2 || $i == 5) { $html .= ' |