table_index_sh.class.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * 数据库表:管理员组
  4. *
  5. * @createtime 2018/03/01
  6. * @author 空竹
  7. * @copyright 芝麻开发(http://www.zhimawork.com)
  8. */
  9. class Table_index_sh extends Table {
  10. protected $table_name = 'index_sh';//表名,不带前缀,前缀在config中定义
  11. protected $table_id = 'index_sh_id';//指定ID字段名称,必须
  12. protected $table_status = '';//指定状态字段名称,如果有
  13. protected $table_order = '';//指定排序字段名称,如果有
  14. //数据库结构
  15. protected function struct(){
  16. $attr = array();
  17. $attr['id'] = 'index_sh_id';
  18. $attr['date'] = 'index_sh_date';
  19. $attr['open_price'] = 'index_sh_open_price';
  20. $attr['close_price'] = 'index_sh_close_price';
  21. $attr['increase_price'] = 'index_sh_increase_price';
  22. $attr['increase_value'] = 'index_sh_increase_value';
  23. $attr['amount'] = 'index_sh_amount';
  24. $attr['value'] = 'index_sh_value';
  25. return $attr;
  26. }
  27. public function add($attr){
  28. $param = array (
  29. 'index_sh_date' => array('number', $attr['date']),
  30. 'index_sh_open_price' => array('number', $attr['open_price']),
  31. 'index_sh_close_price' => array('number', $attr['close_price']),
  32. 'index_sh_hightest_price' => array('number', $attr['hightest_price']),
  33. 'index_sh_lowest_price' => array('number', $attr['lowest_price']),
  34. 'index_sh_increase_value' => array('number', $attr['increase_value']),
  35. 'index_sh_increase_price' => array('number', $attr['increase_price']),
  36. 'index_sh_amount' => array('number', $attr['amount']),
  37. 'index_sh_value' => array('number', $attr['value']),
  38. );
  39. return $this->pdo->sqlinsert($this->table_fullname, $param);
  40. }
  41. /***
  42. * @param $attr
  43. * @return mixed
  44. * 插入历史数据
  45. */
  46. public function insert($attr){
  47. $param = array (
  48. 'index_sh_date' => array('number', $attr['date']),
  49. 'index_sh_open_price' => array('number', $attr['open_price']),
  50. 'index_sh_close_price' => array('number', $attr['close_price']),
  51. 'index_sh_hightest_price' => array('number', $attr['hightest_price']),
  52. 'index_sh_lowest_price' => array('number', $attr['lowest_price']),
  53. 'index_sh_increase_value' => array('number', $attr['increase_value']),
  54. 'index_sh_increase_price' => array('number', $attr['increase_price']),
  55. 'index_sh_amount' => array('number', $attr['amount']),
  56. 'index_sh_value' => array('number', $attr['value']),
  57. );
  58. return $this->pdo->sqlinsert($this->table_fullname, $param);
  59. }
  60. }
  61. ?>