| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /***
- * Class Stock
- * * @author 王刚涛
- * 日线数据
- */
- class Stock {
- static public function getStockCodeList()
- {
- $Table_stock = new Table_stock();
- return $Table_stock->getStockCodeList();
- }
- static public function getInfoById($id)
- {
- $Table_stock = new Table_stock();
- return $Table_stock->getInfoById($id);
- }
- static public function getInfoByCode($code)
- {
- $Table_stock = new Table_stock();
- return $Table_stock->getInfoByCode($code);
- }
- 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);
- }
- static public function addOrUpdateByCode($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->add($attrs);
- } else {
- $id = $rs['id'];
- $Table_stock->update($id, $attrs);
- }
- return $id;
- }
- }
- ?>
|