Daddress.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 数据层模型
  13. */
  14. class Daddress extends BaseModel
  15. {
  16. /**
  17. * 新增
  18. * @access public
  19. * @author csdeshang
  20. * @param type $data 数据
  21. * @return type
  22. */
  23. public function addDaddress($data)
  24. {
  25. return Db::name('daddress')->insertGetId($data);
  26. }
  27. /**
  28. * 删除
  29. * @access public
  30. * @author csdeshang
  31. * @param type $condition 条件
  32. * @return type
  33. */
  34. public function delDaddress($condition)
  35. {
  36. return Db::name('daddress')->where($condition)->delete();
  37. }
  38. /**
  39. * 编辑更新
  40. * @access public
  41. * @author csdeshang
  42. * @param type $data 更新数据
  43. * @param type $condition 条件
  44. * @return type
  45. */
  46. public function editDaddress($data, $condition)
  47. {
  48. return Db::name('daddress')->where($condition)->update($data);
  49. }
  50. /**
  51. * 查询单条
  52. * @access public
  53. * @author csdeshang
  54. * @param type $condition 检索条件
  55. * @param type $fields 字段
  56. * @return type
  57. */
  58. public function getAddressInfo($condition, $fields = '*')
  59. {
  60. return Db::name('daddress')->field($fields)->where($condition)->find();
  61. }
  62. /**
  63. * 查询多条
  64. * @access public
  65. * @author csdeshang
  66. * @param type $condition 条件
  67. * @param type $fields 字段
  68. * @param type $order 排序
  69. * @param type $limit 限制
  70. * @return type
  71. */
  72. public function getAddressList($condition, $fields = '*', $order = '', $limit = 0)
  73. {
  74. return Db::name('daddress')->field($fields)->where($condition)->order($order)->limit($limit)->select()->toArray();
  75. }
  76. }