table_day_k_base.class.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: 王刚涛
  5. * Date: 2020/11/24
  6. * Time: 14:51
  7. */
  8. class Table_day_k_base extends Table {
  9. protected $base = ""; //分表的后缀日期,在进行数据库操作的时候"Table_day_k_".$base
  10. protected $table_name = "";//表名,不带前缀,前缀在config中定义
  11. protected $table_id = "day_k_id";//指定ID字段名称,必须
  12. protected $table_status = '';//指定状态字段名称,如果有
  13. protected $table_order = '';//指定排序字段名称,如果有
  14. protected $table_fullname = "";//拼接好后表名
  15. //数据库结构
  16. protected function struct(){
  17. $attr = array();
  18. $attr['id'] = 'day_k_id';
  19. $attr['date'] = 'day_k_date';
  20. $attr['code'] = 'day_k_code';
  21. $attr['type'] = 'day_k_open_price';
  22. $attr['multiple'] = 'day_k_close_price';
  23. $attr['subprice'] = 'day_k_hightest_price';
  24. $attr['oldprice'] = 'day_k_lowest_price';
  25. $attr['newprice'] = 'day_k_increase_price';
  26. $attr['oldprice'] = 'day_k_increase_value';
  27. $attr['newprice'] = 'day_k_turnover';
  28. $attr['oldprice'] = 'day_k_amount';
  29. $attr['newprice'] = 'day_k_value';
  30. $attr['oldprice'] = 'day_k_open_price_qfq';
  31. $attr['newprice'] = 'day_k_close_price_qfq';
  32. $attr['newprice'] = 'day_k_hightest_price_qfq';
  33. $attr['oldprice'] = 'day_k_lowest_price_qfq';
  34. $attr['newprice'] = 'day_k_m5';
  35. $attr['newprice'] = 'day_k_m10';
  36. $attr['oldprice'] = 'day_k_m20';
  37. $attr['newprice'] = 'day_k_m60';
  38. $attr['newprice'] = 'day_k_kdj';
  39. $attr['oldprice'] = 'day_k_macd';
  40. $attr['newprice'] = 'day_k_rsi';
  41. return $attr;
  42. }
  43. /***
  44. * Table_day_k_base constructor.
  45. * 构造函数,动态获取表的后缀年月
  46. * 王刚涛
  47. */
  48. public function __construct($base) {
  49. $this->base=date("Ym");
  50. $this->table_name= "day_k_".$base;//表名不代前缀
  51. $this->table_fullname= "boniu_"."day_k_".$base;//表名代前缀
  52. $this ->createBaseTable();
  53. }
  54. /****
  55. *在构造函数中调用该函数,自动创建表
  56. * 王刚涛
  57. */
  58. public function createBaseTable(){
  59. $sqlarr[] = "CREATE TABLE IF NOT EXISTS `". $this->table_fullname."` as select * from boniu_day_k_base where 0 ";
  60. }
  61. public function add($attr){
  62. $param = array (
  63. 'admingroup_name' => array('string', $attr['name'])
  64. );
  65. return $this->pdo->sqlinsert($this->table_fullname, $param);
  66. }
  67. //获取列表(分页)
  68. //$count、$page和$pagesize都为0时,返回全部结果(适用于无需分页的情况)
  69. //
  70. //@param $filter array -- 过滤条件,格式见Table::filterToWhere
  71. //@param $count -- 0:返回列表 1:返回结果数量
  72. //@param $page -- 当前第几页
  73. //@param $pagesize -- 每页数量
  74. public function getList($filter = array(), $count = 0, $page = 0, $pagesize = 0)
  75. {
  76. }
  77. }
  78. ?>