index_day_k.class.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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, $limit = 0)
  19. {
  20. $Table_index_day_k = new Table_index_day_k();
  21. return $Table_index_day_k->getList($filter, $count, $page, $pagesize, $order, $limit);
  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 getListOrderByDate($filter = array(), $count=0, $page=0, $pagesize=0, $order=0, $limit = 0)
  29. {
  30. $Table_index_day_k = new Table_index_day_k();
  31. return $Table_index_day_k->getListOrderByDate($filter, $count, $page, $pagesize, $order, $limit);
  32. }
  33. static public function addOrUpdateByCodeDate($attrs)
  34. {
  35. if (empty($attrs)) throw new Exception('参数不能为空', 101);
  36. if (empty($attrs['code'])) throw new Exception('股票代码不能为空', 102);
  37. if (empty($attrs['date'])) throw new Exception('日期不能为空', 103);
  38. $Table_index_day_k = new Table_index_day_k();
  39. $id = $Table_index_day_k->addOrUpdateByCodeDate($attrs);
  40. return $id;
  41. }
  42. //----------------------------------------
  43. static public function add($attrs){
  44. if (empty($attrs)) throw new Exception('参数不能为空', 102);
  45. $Table_index_day_k = new Table_index_day_k();
  46. $id = $Table_index_day_k->add($attrs);
  47. return $id;
  48. }
  49. static public function insert($attrs)
  50. {
  51. if (empty($attrs)) throw new Exception('参数不能为空', 102);
  52. $Table_index_day_k = new Table_index_day_k();
  53. $id = $Table_index_day_k->insert($attrs);
  54. return $id;
  55. }
  56. /**
  57. * @param $start_date
  58. * @param $end_date
  59. * @param $index_type
  60. * @param $num
  61. * @param $order
  62. * @return array
  63. * wanggangtao
  64. * 获取时间段指数信息
  65. */
  66. static public function getIndexListHistroy($code,$start_date,$end_date,$order)
  67. {
  68. $Table_index_day_k = new Table_index_day_k();
  69. return $Table_index_day_k->getIndexListHistroy($code,$start_date,$end_date,$order);
  70. }
  71. /***
  72. * @param $code
  73. * @param $date
  74. * @return array
  75. * 获取某天的指数数据和当天的指数数据
  76. */
  77. static public function get_current_day_index($code,$date)
  78. {
  79. $Table_index_day_k = new Table_index_day_k();
  80. return $Table_index_day_k->get_current_day_index($code,$date);
  81. }
  82. }
  83. ?>