appno = mt_rand(2001,9999); //应用编号 } while (self::sqlone('applist') != false); $this->appver = '1.0'; //应用版本号 $this->m_name = 'metremark'; $this->m_class = 'index'; $this->m_action = 'doindex'; $this->appname = 'Remark UI 融入米拓'; //应用名称 $this->info = 'Remark UI 融入米拓调试测试页面'; //应用描述 $this->depend = ''; //应用依赖 $this->target = 1; //是否支新窗口打开 $this->display = 1; //是否显示应用图标 $this->mlangok = 1; //是否支持多语言 } //安装主方法 public function dosql() { global $_M; $stall = self::sqlone('applist'," m_name='{$this->m_name}' "); if(!$stall){ //系统表 self::appsql(); }else{ } return 'complete'; } //执行APP相关的表数据插入 private function appsql() { global $_M; $time = time(); //注册应用 $field = " `no`='{$this->appno}', `ver` = {$this->appver}, `m_name` = '{$this->m_name}', `m_class`='{$this->m_class}', `m_action`='{$this->m_action}', `appname`='{$this->appname}', `info`='{$this->info}', `addtime`='{$time}', `updatetime`='{$time}', `target`='{$this->target}', `display`='{$this->display}', `depend`='{$this->depend}', `mlangok`='{$this->mlangok}' "; self::addsql('applist',$field); /** * 1、增加新表 * name 配置名称 * id 添加信息自动增加, * value 配置名称值 * lang 语言[后台] **/ $field = " `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(150) NOT NULL, `m_name` varchar(100) NOT NULL, `value` text, `lang` varchar(50) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_lang` (`name`,`m_name`,`lang`)"; DB::query("CREATE TABLE `".$_M['config']['tablepre']."cloud_config` ( {$field} ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8"); add_table('cloud_config'); } //公共查询方法 private function sqlone($tname,$where = '') { global $_M; $table = $_M['table'][$tname]; if(!$where){ $where = "no='{$this->appno}'"; } return DB::get_one("select * from {$table} where {$where}"); } //公共写入方法 private function addsql($tname,$field = '') { global $_M; $table = $_M['table'][$tname]; DB::query("INSERT INTO {$table} SET {$field}"); } } ?>