table_index.class.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * 数据库表:管理员组
  4. *
  5. * @createtime 2018/03/01
  6. * @author 空竹
  7. * @copyright 芝麻开发(http://www.zhimawork.com)
  8. */
  9. class Table_index extends Table {
  10. protected $table_name = 'index';//表名,不带前缀,前缀在config中定义
  11. protected $table_id = 'index_id';//指定ID字段名称,必须
  12. protected $table_status = '';//指定状态字段名称,如果有
  13. protected $table_order = '';//指定排序字段名称,如果有
  14. //数据库结构
  15. protected function struct(){
  16. $attr = array();
  17. $attr['id'] = 'index_id';
  18. $attr['code'] = 'index_code';
  19. $attr['name'] = 'index_name';
  20. $attr['exchange'] = 'index_exchange';
  21. $attr['sector'] = 'index_sector';
  22. return $attr;
  23. }
  24. public function add($attr){
  25. $param = array (
  26. 'index_code' => array('string', $attr['code']),
  27. 'index_name' => array('string', $attr['name']),
  28. 'index_exchange' => array('string', $attr['exchange']),
  29. 'index_sector' => array('number', $attr['sector']),
  30. );
  31. return $this->pdo->sqlinsert($this->table_fullname, $param);
  32. }
  33. }
  34. ?>