index_day_k.class.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 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. static public function add($attrs){
  39. if (empty($attrs)) throw new Exception('参数不能为空', 102);
  40. $Table_index_day_k = new Table_index_day_k();
  41. $id = $Table_index_day_k->add($attrs);
  42. return $id;
  43. }
  44. static public function insert($attrs)
  45. {
  46. if (empty($attrs)) throw new Exception('参数不能为空', 102);
  47. $Table_index_day_k = new Table_index_day_k();
  48. $id = $Table_index_day_k->insert($attrs);
  49. return $id;
  50. }
  51. /**
  52. * @param $start_date
  53. * @param $end_date
  54. * @param $index_type
  55. * @param $num
  56. * @param $order
  57. * @return array
  58. * wanggangtao
  59. * 获取时间段指数信息
  60. */
  61. static public function getIndexListHistroy($code,$start_date,$end_date,$order)
  62. {
  63. $Table_index_day_k = new Table_index_day_k();
  64. return $Table_index_day_k->getIndexListHistroy($code,$start_date,$end_date,$order);
  65. }
  66. /***
  67. * @param $code
  68. * @param $date
  69. * @return array
  70. * 获取某天的指数数据和当天的指数数据
  71. */
  72. static public function get_current_day_index($code,$date)
  73. {
  74. $Table_index_day_k = new Table_index_day_k();
  75. return $Table_index_day_k->get_current_day_index($code,$date);
  76. }
  77. }
  78. ?>