| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- /***
- * Class Stock
- * * @author 王刚涛
- * 日线数据
- */
- class Stock {
- public function __construct()
- {
- }
- static public function getInfoById($id)
- {
- $Table_stock = new Table_stock();
- return $Table_stock->getInfoById($id);
- }
- static public function update($stock_id,$attrs)
- {
- if (empty($attrs)) throw new Exception('参数不能为空', 102);
- $Table_stock = new Table_stock();
- $id = $Table_stock->update($stock_id,$attrs);
- return $id;
- }
- static public function updateByCode($stock_code,$attrs)
- {
- if (empty($attrs)) throw new Exception('参数不能为空', 102);
- $Table_stock = new Table_stock();
- $id = $Table_stock->updateByCode($stock_code,$attrs);
- return $id;
- }
- static public function add($attrs)
- {
- if (empty($attrs)) throw new Exception('参数不能为空', 101);
- $Table_stock = new Table_stock();
- $id = $Table_stock->add($attrs);
- return $id;
- }
- static public function getList($filter = array(), $count=0, $page=0, $pageSize=0)
- {
- $Table_stock = new Table_stock();
- return $Table_stock->getList($filter, $count, $page, $pageSize);
- }
- /****
- * @param array $filter
- * @param int $count
- * @param int $page
- * @param int $pageSize
- * @return array|int
- * 获取股票的代码列表
- */
- static public function getStockCodeList()
- {
- $Table_stock = new Table_stock();
- return $Table_stock->getStockCodeList();
- }
- static public function updateCodeAndName($attrs)
- {
- if (empty($attrs)) throw new Exception('参数不能为空', 101);
- $Table_stock = new Table_stock();
- $rs = $Table_stock->getInfoByCode($attrs['code']);
- if (empty($rs)) {
- $id = $Table_stock->addCodeAndName($attrs);
- } else {
- $id = $rs['id'];
- $Table_stock->update($id, $attrs);
- }
- return $id;
- }
- }
- ?>
|