2 Star 3 Fork 1

老罗 / TickyCMS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test.php 14.48 KB
一键复制 编辑 原始数据 按行查看 历史
老罗 提交于 2019-02-26 15:52 . 加入采集模块,删除manage函数
<?php
error_reporting(E_ALL);
header('Content-Type: text/html; charset=utf-8'); //网页编码
$dsn = "mysql:host=127.0.0.1;port=3306;dbname=tickycms";
$db = new PDO($dsn, 'root', '123456');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); //使用缓冲查询,仅mysql有效
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); //启用预处理语句的模拟
$db->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); //强制列名小写
$db->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL); //指定数据库返回的NULL值在php中对应的数值
$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1); //开启自动提交
$db->exec('SET NAMES utf8');
$_lang = include '/application/common/lang/zh-cn.php';
//modelFieldInit();
/**/
function modelFieldInit() {
global $db, $_lang;
$db->exec('delete from tky_model_field where fieldid>47');
model_field_init(1, 'news');
model_field_init(2, 'product');
model_field_init(3, 'download');
}
function model_field_init($modelid, $modelName) {
global $db, $_lang;
echo "=======================模型字段 ==========================<br>";
$table = $db->query('SHOW COLUMNS FROM tky_' . $modelName)->fetchAll(PDO::FETCH_ASSOC);
foreach ($table as $row) {
$field = $row['Field'];
$type = $row['Type'];
$lang = $_lang[$modelName . '_' . $field];
$fieldtype = 'input';
if (strpos($type, 'text') !== false) {
$fieldtype = 'editor';
}
if (strpos($field, 'contentid') !== false) {
continue;
}
$sql = "INSERT INTO `tky_model_field` (`modelid`, `field`, `name`, `tips`, `css`, `minlength`, `maxlength`, `errortips`, `fieldtype`, `defaultvalue`, `setting`, `isrequired`, `issystem`, `isunique`, `isadd`, `listorder`, `disabled`, `type`, `status`) "
. "VALUES ('" . $modelid . "', '" . $field . "', '" . $lang . "', '" . $lang . "', 'form-control', '0', '255', '" . $lang . "不能为空', '" . $fieldtype . "', '0', '', '1', '0', '0', '0', '5', '1', '0', '1')";
echo '' . $sql . '<br>';
//echo $lang . '=' . $modelName . '_' . $field . '<br>';
$db->exec($sql);
}
echo '=========end======tky_' . $modelName . '===模型字段====================<br>';
}
function model_news_testdata() {
global $db;
echo "===============新闻 ===================<br>";
for ($x = 4; $x <= 50; $x++) {
echo "生成新闻:$x <br>";
$db->query("INSERT INTO `tky_cms_content` (`contentid`, `siteid`, `modelid`, `catid`, `uid`, `title`, `description`, `url`, `flag`, `tag`, `sort`, `allowcomment`, `views`, `replies`, `readperm`, `readpoint`, `is_push`, `status`, `inputtime`, `updatetime`) VALUES ('52', '1', '1', '12', '1', 'LCLFramework框架 1.1 Pre-Alpha 源码公布', '使用开发框架的好处:\r\n1.框架在技术上为软件系统提供了完整的模式实践\r\n2.框架为团队提供了合理可行的软件开发过程模式\r\n3.框架的应用大大提高了团队的开发效率,团队只需要关注与领域相关的业务实现,而无需关注具体的技术实现\r\n4.框架的应用大大降低了出现缺陷(Bug)的几率,因为大多数支撑业务系统的代码都经过了严格的测试和实战的考验\r\n5.框架的应用还为软件系统的整合与集成带来了便捷', '', '1,2,3,4,5,6', '源码公布,LCL', '0', '0', '0', '0', '0', '0', '0', '0', '1550194621', '1550194621')");
$db->query("INSERT INTO `tky_cms_news` (`contentid`, `author`, `befrom`, `content`) VALUES ('52', '1', '1', '<p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\">使用开发框架的好处:<br/>1.框架在技术上为软件系统提供了完整的模式实践<br/>2.框架为团队提供了合理可行的软件开发过程模式<br/>3.框架的应用大大提高了团队的开发效率,团队只需要关注与领域相关的业务实现,而无需关注具体的技术实现<br/>4.框架的应用大大降低了出现缺陷(Bug)的几率,因为大多数支撑业务系统的代码都经过了严格的测试和实战的考验<br/>5.框架的应用还为软件系统的整合与集成带来了便捷</p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><span style=\"font-size: medium;\"><strong>LCLFramework 框架简要说明</strong>:</span></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\">LCLFramework就是一套在.NET下支持面向领域驱动的软件系统管理类软件的快速开发框架 ,其目标主要专注于:<span style=\"font-size: medium;\"><br/>1. 快速开发:<br/>&nbsp;&nbsp;&nbsp; DDD、界面自动生成、数据库自动生成与升级、易用的业务逻辑编写框架。<br/>2. 产品线工程:<br/>&nbsp;&nbsp;&nbsp; 插件化业务模块积累、客户化二次开发、实施配置平台。<br/>3. 一套代码,可同时生成并运行 C/S、单机版、B/S 三种应用程序。<br/>&nbsp;&nbsp;&nbsp; C/S版本 与 单机版 代码重用率 100%。<br/>&nbsp;&nbsp;&nbsp; C/S版本 与 B/S版本 重用服务端代码(完全重用服务层以下代码。结合界面生成,只需要编写少量的界面层控制代码即可)。</span></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><strong><span style=\"font-size: medium;\">已完成:</span></strong></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><span style=\"font-size: medium;\">1.基于NuGet Package Manager提供方便快捷的类库包发布方式,开发人员无需关心程序集之间的版本依赖关系<br/>2.提供对领域驱动设计中基本元素的封装。比如:实体、聚合根、领域仓储等概念进行了有效的封装和实现<br/>3.提供对现有流行框架的支持。比如:能够很好地支持ASP.NET MVC以及ASP.NET Web API的使用和开发<br/>4.提供基于Microsoft Patterns &amp; Practices Unity的IoC容器和服务定位器(Service Locator)的实现。不仅如此,开发人员还能根据项目的实际需求对IoC容器和服务定位器进行扩展,使其能够支持更多的Dependency Injection(DI)框架。比如可以很方便地扩展LCLFramework,使其能够支持基于StructureMap、Ninject等流行的DI框架<br/>5.提供基于Entity Framework的仓储实现。在应用程序中使用这种仓储,也就基本涵盖了所有面向关系型数据库的对象持久化方案。不仅如此,开发人员还能根据项目的实际需求,对仓储实现进行扩展,以支持更多种类的对象持久化机制</span></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><strong><span style=\"font-size: medium;\">计划:</span></strong></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><span style=\"font-size: medium;\">1:DemainDSL<br/>2:MVCPlugin<br/>3:DEMO<br/>4:工具</span></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><span style=\"font-size: medium;\"><strong>开源地址</strong>:</span><a href=\"http://undefined\" style=\"color: rgb(0, 0, 0); text-decoration-line: underline;\"><span style=\"font-size: medium;\">https://github.com/luomingui</span></a></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><span style=\"font-size: medium;\"><strong>源码下载</strong>:代码对应的 SVN 地址:https://github.com/luomingui/LCLFramework</span><span style=\"font-size: medium;\">(没有帐号密码的可以把 https 换为 http 即可下载。)。暂时没有提供完整压缩包的下载,之后比较稳定能达到 Alpha 阶段时,我们会再提供完整压缩包的下载。</span></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><span style=\"font-size: medium;\"><strong>帮助手册</strong>:由于时间及人员的关系,现在还没有发布可用的使用说明。我之后会陆续添加一些 LCL 的使用说明文档。大家可以关注我的博客。</span></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><span style=\"font-size: medium;\"><strong>QQ交流群</strong>:由于暂时没有完整的帮助手册,所以新开通了一个 QQ 群,方便试用的朋友在里面进行交流。群号:34178394。</span></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><span style=\"font-size: medium;\">要使用LCLF进行应用程序开发,您需要安装Visual Studio 2012以上的版本(以下简称Visual Studio 2012+),从LCL 1.0开始,需要Micrsoft.NET Framework 4.5的支持,因此强烈建议使用Visual Studio 2012+进行开发。</span></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><span style=\"font-size: medium;\">使用NuGet来管理LCL的程序集引用的另一个好处是,使得今后LCL类库包的发布变得非常简单。</span></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><a href=\"http://undefined\" style=\"color: rgb(255, 102, 0); text-decoration-line: underline;\"><span style=\"font-size: medium;\"><img title=\"image\" src=\"https://images0.cnblogs.com/blog/54346/201411/252100397622337.png\" alt=\"image\" width=\"900\" height=\"600\" style=\"max-width: 100%; height: auto; width: auto; max-height: 100%; background-image: none; display: inline;\"/></span></a></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\">&nbsp;</p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><a href=\"http://undefined\" style=\"color: rgb(0, 0, 0); text-decoration-line: underline;\"><span style=\"font-size: medium;\">LCLFramework框架之Service模式</span></a></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><a href=\"http://undefined\" style=\"color: rgb(0, 0, 0); text-decoration-line: underline;\"><span style=\"font-size: medium;\">LCLFramework框架之IOC</span></a></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><a href=\"http://undefined\" style=\"color: rgb(0, 0, 0); text-decoration-line: underline;\"><span style=\"font-size: medium;\">LCLFramework框架之Plugin模式</span></a></p><p style=\"margin: 10px auto; text-align: justify; color: rgb(0, 0, 0); font-family: &quot;PingFang SC&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial, &quot;Microsoft Yahei&quot;, sans-serif; font-size: 12px; white-space: normal;\"><a href=\"http://undefined\" style=\"color: rgb(0, 0, 0); text-decoration-line: underline;\"><span style=\"font-size: medium;\">LCLFramework框架之Repository模式</span></a></p><p><br/></p>')");
}
}
function debug($var = null, $vardump = false) {
echo '<pre>';
$vardump = empty($var) ? true : $vardump;
if ($vardump) {
var_dump($var);
} else {
print_r($var);
}
echo '</pre>';
//exit();
}
function db($dbname = 'tickycms') {
$dsn = "mysql:host=127.0.0.1;port=3306;dbname=" . $dbname;
$db = new PDO($dsn, 'root', '123456');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); //使用缓冲查询,仅mysql有效
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); //启用预处理语句的模拟
$db->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); //强制列名小写
$db->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL); //指定数据库返回的NULL值在php中对应的数值
$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1); //开启自动提交
$db->exec('SET NAMES utf8');
echo "==当前数据库:" . $dsn . "===================<br>";
return $db;
}
PHP
1
https://gitee.com/luomingui/TickyCMS.git
git@gitee.com:luomingui/TickyCMS.git
luomingui
TickyCMS
TickyCMS
master

搜索帮助