stock.class.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /***
  3. * Class Stock
  4. * * @author 王刚涛
  5. * 日线数据
  6. */
  7. class Stock {
  8. static public function getAllList()
  9. {
  10. $Table_stock = new Table_stock();
  11. return $Table_stock->getList(array(), 0, 0, 0, 1); //升序
  12. }
  13. static public function getInfoById($id)
  14. {
  15. $Table_stock = new Table_stock();
  16. return $Table_stock->getInfoById($id);
  17. }
  18. static public function getInfoByCode($code)
  19. {
  20. $Table_stock = new Table_stock();
  21. return $Table_stock->getInfoByCode($code);
  22. }
  23. static public function getList($filter = array(), $sector=0, $page=0, $pageSize=0)
  24. {
  25. $Table_stock = new Table_stock();
  26. return $Table_stock->getList($filter, $sector, $page, $pageSize);
  27. }
  28. static public function getStockList($filter = array(), $count, $page, $pagesize)
  29. {
  30. $Table_stock = new Table_stock();
  31. return $Table_stock->getStockList($filter, $count,$page, $pagesize);
  32. }
  33. static public function addOrUpdateByCode($attrs)
  34. {
  35. if (empty($attrs)) throw new Exception('参数不能为空', 101);
  36. if (empty($attrs['code'])) throw new Exception('股票代码不能为空', 102);
  37. $Table_stock = new Table_stock();
  38. $id = $Table_stock->addOrUpdateByCode($attrs);
  39. return $id;
  40. }
  41. }
  42. ?>