SQL Add新欄位: Theme內新增起始標的
This commit is contained in:
parent
0cd8ba2d16
commit
3e44a65b79
@ -556,6 +556,7 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
|
||||
'activity_id' => $sact->getId(),
|
||||
'theme_id' => $sact->getThemeId(),
|
||||
'theme_name' => $sact->getThemeName(),
|
||||
'start_target_id' => $sact->getStartTargetId(),
|
||||
'start_time' => $sact->getStartTime(),
|
||||
'expired_time' => $sact->getExpiredTime(),
|
||||
'have_time' => $sact->getRealLearnTime(),
|
||||
@ -620,6 +621,7 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
|
||||
'activity_id' => $sact->getId(),
|
||||
'theme_id' => $sact->getThemeId(),
|
||||
'theme_name' => $sact->getThemeName(),
|
||||
'start_target_id' => $sact->getStartTargetId(),
|
||||
'start_time' => $sact->getStartTime(),
|
||||
'expired_time' => $sact->getExpiredTime(),
|
||||
'have_time' => $sact->getRealLearnTime(),
|
||||
|
@ -28,7 +28,7 @@ class DBTheme extends Database {
|
||||
protected function queryThemeByWhere($where) {
|
||||
|
||||
$sqlString = "SELECT `ThID`, `ThName`, ".
|
||||
"`ThLearnTime`, `ThIntroduction`, ".
|
||||
"`ThLearnTime`, `StartTID`, `ThIntroduction`, ".
|
||||
"`ThBuildTime`, `ThModifyTime`, ".
|
||||
"(SELECT count(`TID`) FROM `chu__TBelong` AS `belong`
|
||||
WHERE `belong`.`ThID` = `theme`.`ThID`) AS `TargetTotal`".
|
||||
@ -46,13 +46,14 @@ class DBTheme extends Database {
|
||||
foreach($queryResultAll as $key => $thisResult) {
|
||||
|
||||
array_push($result,
|
||||
array( 'theme_id' => $thisResult['ThID'],
|
||||
'name' => $thisResult['ThName'],
|
||||
'learn_time' => $thisResult['ThLearnTime'],
|
||||
'introduction' => $thisResult['ThIntroduction'],
|
||||
'target_total' => $thisResult['TargetTotal'],
|
||||
'build_time' => $thisResult['ThBuildTime'],
|
||||
'modify_time' => $thisResult['ThModifyTime'] )
|
||||
array( 'theme_id' => $thisResult['ThID'],
|
||||
'name' => $thisResult['ThName'],
|
||||
'learn_time' => $thisResult['ThLearnTime'],
|
||||
'start_target_id' => $thisResult['StartTID'],
|
||||
'introduction' => $thisResult['ThIntroduction'],
|
||||
'target_total' => $thisResult['TargetTotal'],
|
||||
'build_time' => $thisResult['ThBuildTime'],
|
||||
'modify_time' => $thisResult['ThModifyTime'] )
|
||||
);
|
||||
}
|
||||
return $result;
|
||||
|
@ -425,6 +425,19 @@ class StudyActivity {
|
||||
|
||||
// ========================================================================
|
||||
|
||||
/**
|
||||
* 取得此主題的標的起始點
|
||||
*
|
||||
* @return int 標的編號
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function getStartTargetId(){
|
||||
$theme = new Theme( $this->getThemeId() );
|
||||
return $theme->getStartTargetId();
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
|
||||
/**
|
||||
* 此標的是否已學習過
|
||||
*
|
||||
|
@ -146,6 +146,16 @@ class Theme {
|
||||
return $this->queryResultArray['learn_time'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 取得此主題的標的起始點
|
||||
*
|
||||
* @return int 標的編號
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function getStartTargetId(){
|
||||
return (int)$this->queryResultArray['start_target_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 取得建立時間
|
||||
*
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- 主機: localhost
|
||||
-- 產生時間: 2015 年 01 月 06 日 12:56
|
||||
-- 產生時間: 2015 年 01 月 19 日 15:32
|
||||
-- 伺服器版本: 5.6.16
|
||||
-- PHP 版本: 5.5.9
|
||||
|
||||
@ -547,7 +547,7 @@ CREATE TABLE IF NOT EXISTS `chu__Target` (
|
||||
--
|
||||
|
||||
INSERT INTO `chu__Target` (`TID`, `AID`, `TNum`, `TName`, `TMapID`, `TLearnTime`, `PLj`, `Mj`, `S`) VALUES
|
||||
(0, NULL, NULL, '入口', NULL, 0, 100000, 0, NULL),
|
||||
(0, 1, NULL, '入口', NULL, 0, 1000000000, 0, NULL),
|
||||
(1, 1, NULL, '含有生物遺跡的岩石', 'map_01_02_03.png', 7, 2, 0, 1),
|
||||
(2, 1, NULL, '岩石中的紀錄', 'map_01_02_03.png', 8, 2, 0, 1),
|
||||
(3, 4, NULL, '生命在水中的演化', 'map_01_02_03.png', 3, 2, 0, 1),
|
||||
@ -609,18 +609,19 @@ CREATE TABLE IF NOT EXISTS `chu__Theme` (
|
||||
`ThID` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`ThName` varchar(100) COLLATE utf8_unicode_ci NOT NULL COMMENT '主題名稱',
|
||||
`ThLearnTime` int(4) NOT NULL COMMENT '學習此主題要花的總時間(m)',
|
||||
`StartTID` int(10) NOT NULL COMMENT '此主題的標的起始點',
|
||||
`ThIntroduction` tinytext COLLATE utf8_unicode_ci COMMENT '介紹',
|
||||
`ThBuildTime` datetime NOT NULL,
|
||||
`ThModifyTime` datetime NOT NULL,
|
||||
PRIMARY KEY (`ThID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='主題' AUTO_INCREMENT=3 ;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='主題' AUTO_INCREMENT=2 ;
|
||||
|
||||
--
|
||||
-- 資料表的匯出資料 `chu__Theme`
|
||||
--
|
||||
|
||||
INSERT INTO `chu__Theme` (`ThID`, `ThName`, `ThLearnTime`, `ThIntroduction`, `ThBuildTime`, `ThModifyTime`) VALUES
|
||||
(1, '生命科學', 40, NULL, '2014-10-23 17:21:03', '2014-10-23 17:21:03');
|
||||
INSERT INTO `chu__Theme` (`ThID`, `ThName`, `ThLearnTime`, `StartTID`, `ThIntroduction`, `ThBuildTime`, `ThModifyTime`) VALUES
|
||||
(1, '生命科學', 40, 0, NULL, '2014-10-23 17:21:03', '2014-10-23 17:21:03');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user