1
This commit is contained in:
parent
69353c47d7
commit
76a9d8504a
@ -197,5 +197,25 @@ CREATE TABLE `t_shop_buy_record` (
|
|||||||
KEY `account_id` (`account_id`),
|
KEY `account_id` (`account_id`),
|
||||||
UNIQUE KEY `account_id_item_id` (`account_id`, `item_id`)
|
UNIQUE KEY `account_id_item_id` (`account_id`, `item_id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `t_mission`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_mission`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `t_mission` (
|
||||||
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||||
|
`mission_id` int(11) NOT NULL DEFAULT '0' COMMENT '任务id',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`idx`),
|
||||||
|
KEY `account_id` (`account_id`),
|
||||||
|
UNIQUE KEY `account_id_mission_id` (`account_id`, `mission_id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
-- Dump completed on 2015-08-19 18:51:22
|
-- Dump completed on 2015-08-19 18:51:22
|
||||||
|
60
webapp/models/Mission.php
Normal file
60
webapp/models/Mission.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace models;
|
||||||
|
|
||||||
|
require_once('mt/Item.php');
|
||||||
|
|
||||||
|
use mt;
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
|
class Mission extends BaseModel {
|
||||||
|
|
||||||
|
public static function find($missionId)
|
||||||
|
{
|
||||||
|
$row = SqlHelper::ormSelectOne(
|
||||||
|
myself()->_getSelfMysql(),
|
||||||
|
't_mission',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'mission_id' => $missionid,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function toDto($row)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'mission_id' => $row['mission_id'],
|
||||||
|
'createtime' => $row['createtime'],
|
||||||
|
'modifytime' => $row['modifytime'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function all()
|
||||||
|
{
|
||||||
|
$rows = SqlHelper::ormSelect(
|
||||||
|
myself()->_getSelfMysql(),
|
||||||
|
't_mission',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return array_map(function($row) {
|
||||||
|
$nowDaySeconds = myself()->_getNowDaySeconds();
|
||||||
|
$mondaySeconds = myself()->_getMondaySeconds();
|
||||||
|
return $row;
|
||||||
|
}, $rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allToHash()
|
||||||
|
{
|
||||||
|
$rows = self::all();
|
||||||
|
$missionHash = array();
|
||||||
|
array_walk($rows, function ($row) use(&$missionHash) {
|
||||||
|
$missionHash[$row['mission_id']] = $row;
|
||||||
|
});
|
||||||
|
return $missionHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -6,36 +6,19 @@ use phpcommon;
|
|||||||
|
|
||||||
class Task {
|
class Task {
|
||||||
|
|
||||||
|
public static function get($id)
|
||||||
public static function get($equipId)
|
|
||||||
{
|
{
|
||||||
return self::getMeta()[$equipId];
|
return getXVal(self::getMetaList(), $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getMeta()
|
protected static function getMetaList()
|
||||||
{
|
{
|
||||||
if (!self::$meta) {
|
if (!self::$metaList) {
|
||||||
self::$meta = getMetaTable('newtask@newtask.php');
|
self::$metaList = getMetaTable('task@task.php');
|
||||||
}
|
}
|
||||||
return self::$meta;
|
return self::$metaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getTaskCfgByID($_itemID)
|
protected static $metaList;
|
||||||
{
|
|
||||||
$playerSkinCfg = self::getMeta();
|
|
||||||
$itemData = null;
|
|
||||||
foreach($playerSkinCfg as $item)
|
|
||||||
{
|
|
||||||
$tmpItemID = $item["id"];
|
|
||||||
if($tmpItemID == $_itemID)
|
|
||||||
{
|
|
||||||
$itemData = $item;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $itemData;
|
|
||||||
}
|
|
||||||
protected static $itemArr;
|
|
||||||
protected static $meta;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user