table_stock.class.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * 数据库表:管理员组
  4. *
  5. * @createtime 2018/03/01
  6. * @author 空竹
  7. * @copyright 芝麻开发(http://www.zhimawork.com)
  8. */
  9. class Table_stock extends Table {
  10. protected $table_name = 'stock';//表名,不带前缀,前缀在config中定义
  11. protected $table_id = 'stock_id';//指定ID字段名称,必须
  12. protected $table_status = '';//指定状态字段名称,如果有
  13. protected $table_order = '';//指定排序字段名称,如果有
  14. //数据库结构
  15. protected function struct(){
  16. $attr = array();
  17. $attr['id'] = 'stock_id';
  18. $attr['code'] = 'stock_code';
  19. $attr['name'] = 'stock_name';
  20. $attr['desc'] = 'stock_desc';
  21. $attr['tradable_amount'] = 'stock_tradable_amount';
  22. $attr['tradable_value'] = 'stock_tradable_value';
  23. $attr['total_amount'] = 'stock_total_amount';
  24. $attr['total_value'] = 'stock_total_value';
  25. $attr['profitable'] = 'stock_profitable';
  26. $attr['pb'] = 'stock_pb';
  27. $attr['pe_static'] = 'stock_pe_static';
  28. $attr['pe_dynamic'] = 'stock_pe_dynamic';
  29. $attr['pe_ttm'] = 'stock_pe_ttm';
  30. $attr['exchange'] = 'stock_exchange';
  31. $attr['sector'] = 'stock_sector';
  32. return $attr;
  33. }
  34. public function add($attr){
  35. $param = array (
  36. 'stock_code' => array('string', $attr['code']),
  37. 'stock_name' => array('string', $attr['name']),
  38. 'stock_desc' => array('string', $attr['desc']),
  39. 'stock_tradable_amount' => array('number', $attr['tradable_amount']),
  40. 'stock_tradable_value' => array('number', $attr['tradable_value']),
  41. 'stock_ total _amount' => array('number', $attr['total_amount']),
  42. 'stock_total_value' => array('number', $attr['total_value']),
  43. 'stock_profitable' => array('number', $attr['profitable']),
  44. 'stock_pb' => array('number', $attr['pb']),
  45. 'stock_pe_static' => array('number', $attr['pe_static']),
  46. 'stock_pe_dynamic' => array('number', $attr['pe_dynamic']),
  47. 'stock_pe_ttm' => array('number', $attr['pe_ttm']),
  48. 'stock_exchange' => array('string', $attr['exchange']),
  49. 'stock_sector' => array('number', $attr['sector']),
  50. );
  51. return $this->pdo->sqlinsert($this->table_fullname, $param);
  52. }
  53. }
  54. ?>