Daddress.php 1.9 KB

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