|
|
@@ -14,80 +14,27 @@ class Table_index extends Table {
|
|
|
protected $table_id = 'index_id';//指定ID字段名称,必须
|
|
|
protected $table_status = '';//指定状态字段名称,如果有
|
|
|
protected $table_order = '';//指定排序字段名称,如果有
|
|
|
+
|
|
|
//数据库结构
|
|
|
protected function struct(){
|
|
|
$attr = array();
|
|
|
-
|
|
|
$attr['id'] = 'index_id';
|
|
|
$attr['code'] = 'index_code';
|
|
|
$attr['name'] = 'index_name';
|
|
|
- $attr['exchange'] = 'index_exchange';
|
|
|
- $attr['sector'] = 'index_sector';
|
|
|
+ $attr['exchange'] = 'index_exchange';
|
|
|
+ $attr['sector'] = 'index_sector';
|
|
|
return $attr;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public function add($attr){
|
|
|
$param = array (
|
|
|
- 'index_date' => array('number', $attr['date']),
|
|
|
- 'index_open_price' => array('number', $attr['open_price']),
|
|
|
- 'index_close_price' => array('number', $attr['close_price']),
|
|
|
- 'index_highest_price' => array('number', $attr['highest_price']),
|
|
|
- 'index_lowest_price' => array('number', $attr['lowest_price']),
|
|
|
- 'index_increase_value' => array('number', $attr['increase_value']),
|
|
|
- 'index_increase_price' => array('number', $attr['increase_price']),
|
|
|
- 'index_amount' => array('number', $attr['amount']),
|
|
|
- 'index_value' => array('number', $attr['value']),
|
|
|
+ 'index_code' => array('string', $attr['code']),
|
|
|
+ 'index_name' => array('string', $attr['name']),
|
|
|
+ 'index_exchange' => array('string', $attr['exchange']),
|
|
|
+ 'index_sector' => array('number', $attr['sector']),
|
|
|
);
|
|
|
return $this->pdo->sqlinsert($this->table_fullname, $param);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /****
|
|
|
- * @return array
|
|
|
- * wanggangtao
|
|
|
- *
|
|
|
- */
|
|
|
- public function getIndexList(){
|
|
|
-
|
|
|
- $where="where 1=1";
|
|
|
- $sql = "select "."`*`". "from ". $this->table_fullname ." $where order by ".$this->table_id." asc";
|
|
|
- $rs = $this->pdo->sqlQuery($sql);
|
|
|
- $r = array();
|
|
|
- if($rs){
|
|
|
- foreach($rs as $key => $val){
|
|
|
- $r[$key] = $this->dataToAttr($val);
|
|
|
- }
|
|
|
- return $r;
|
|
|
- }else{
|
|
|
- return $r;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /***
|
|
|
- * @param $code
|
|
|
- * @return array
|
|
|
- * 获取指数的基本信息
|
|
|
- */
|
|
|
- public function get_index_info($code){
|
|
|
-
|
|
|
- $where=" where 1=1 ";
|
|
|
- $sql = "select "."`*`". "from ". $this->table_fullname . $where ;
|
|
|
- $sql.=" and index_code=".$code ;
|
|
|
- $rs = $this->pdo->sqlQuery($sql);
|
|
|
- $r = array();
|
|
|
- if($rs){
|
|
|
- foreach($rs as $key => $val){
|
|
|
- $r[$key] = $this->dataToAttr($val);
|
|
|
- }
|
|
|
- return $r[0];
|
|
|
- }else{
|
|
|
- return $r;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
?>
|