index_day_k.class.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /**
  3. * Class Day_k_base
  4. * @author 王刚涛
  5. * 日线数据
  6. */
  7. class Index_day_k {
  8. static public function getInfoById($id)
  9. {
  10. $Table_index_day_k = new Table_index_day_k();
  11. return $Table_index_day_k->getInfoById($id);
  12. }
  13. static public function getInfoByCodeAndDate($code, $date)
  14. {
  15. $Table_index_day_k = new Table_index_day_k();
  16. return $Table_index_day_k->getInfoByCodeAndDate($code, $date);
  17. }
  18. static public function getList($filter = array(), $count=0, $page=0, $pagesize=0, $order=0)
  19. {
  20. $Table_index_day_k = new Table_index_day_k();
  21. return $Table_index_day_k->getList($filter, $count, $page, $pagesize, $order);
  22. }
  23. static public function getAllList()
  24. {
  25. $Table_index_day_k = new Table_index_day_k();
  26. return $Table_index_day_k->getList();
  27. }
  28. static public function addOrUpdateByCodeDate($attrs)
  29. {
  30. if (empty($attrs)) throw new Exception('参数不能为空', 101);
  31. if (empty($attrs['code'])) throw new Exception('股票代码不能为空', 102);
  32. if (empty($attrs['date'])) throw new Exception('日期不能为空', 103);
  33. $Table_index_day_k = new Table_index_day_k();
  34. $id = $Table_index_day_k->addOrUpdateByCodeDate($attrs);
  35. return $id;
  36. }
  37. //----------------------------------------
  38. /***
  39. * @param $code
  40. * @param $start_date
  41. * @param $traceback_days
  42. * @param $order
  43. * @return mixed
  44. * wanggangtao
  45. * 指数最近n天的数据
  46. */
  47. static public function index_recent_days($code,$start_date,$traceback_days,$order)
  48. {
  49. $Table_index_day_k = new Table_index_day_k();
  50. return $Table_index_day_k->index_recent_days($code,$start_date,$traceback_days,$order);
  51. }
  52. static public function add($attrs){
  53. if (empty($attrs)) throw new Exception('参数不能为空', 102);
  54. $Table_index_day_k = new Table_index_day_k();
  55. $id = $Table_index_day_k->add($attrs);
  56. return $id;
  57. }
  58. static public function insert($attrs)
  59. {
  60. if (empty($attrs)) throw new Exception('参数不能为空', 102);
  61. $Table_index_day_k = new Table_index_day_k();
  62. $id = $Table_index_day_k->insert($attrs);
  63. return $id;
  64. }
  65. /**
  66. * @param $start_date
  67. * @param $end_date
  68. * @param $index_type
  69. * @param $num
  70. * @param $order
  71. * @return array
  72. * wanggangtao
  73. * 获取时间段指数信息
  74. */
  75. static public function getIndexListHistroy($code,$start_date,$end_date,$order)
  76. {
  77. $Table_index_day_k = new Table_index_day_k();
  78. return $Table_index_day_k->getIndexListHistroy($code,$start_date,$end_date,$order);
  79. }
  80. /***
  81. * @param $code
  82. * @param $date
  83. * @return array
  84. * 获取某天的指数数据和当天的指数数据
  85. */
  86. static public function get_current_day_index($code,$date)
  87. {
  88. $Table_index_day_k = new Table_index_day_k();
  89. return $Table_index_day_k->get_current_day_index($code,$date);
  90. }
  91. }
  92. ?>