notificationConf.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class notificationConf extends DooModel {
  4. public $nid;
  5. public $sid;
  6. public $conf;
  7. public $_table = 'CLD_notificationConf';
  8. public $_primarykey = 'nid';
  9. public $_fields = array (
  10. 'nid',
  11. 'sid',
  12. 'conf',
  13. );
  14. /**
  15. * 据用户ID获得信息配置
  16. * @param number $sid
  17. */
  18. function getNotificationConfBySid($sid = 0) {
  19. if (empty($sid))
  20. return array();
  21. $detail=$this->getOne(array(
  22. 'where'=>"sid=".$sid,
  23. 'asArray'=>TRUE
  24. ));
  25. return $detail;
  26. }
  27. /**
  28. * 添加一个信息配置
  29. * @param array $item 相关数据
  30. * @return number 返回ID
  31. */
  32. public function addNotification($item = array()) {
  33. $id = 0;
  34. if (is_array ( $item ) && ! empty ( $item )) {
  35. foreach ( $item as $key => $value ) {
  36. $this->$key = $value;
  37. }
  38. $id = $this->insert ();
  39. }
  40. return $id;
  41. }
  42. /**
  43. * 根据参数字段更新相应字段(主键ID必须传)
  44. * @param array $item 相关需要更新的字段信息
  45. * @return number 返回发票ID
  46. */
  47. public function setNotificationByCondition($item = array()) {
  48. $id = 0;
  49. if (is_array ( $item ) && ! empty ( $item )) {
  50. foreach ( $item as $key => $value ) {
  51. $this->$key = $value;
  52. }
  53. $id = $this->update ();
  54. }
  55. return $id;
  56. }
  57. }
  58. ?>