Daddress.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 数据层模型
  14. */
  15. class Daddress extends BaseModel
  16. {
  17. /**
  18. * 新增
  19. * @access public
  20. * @author csdeshang
  21. * @param type $data 数据
  22. * @return type
  23. */
  24. public function addDaddress($data) {
  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. return Db::name('daddress')->where($condition)->delete();
  36. }
  37. /**
  38. * 编辑更新
  39. * @access public
  40. * @author csdeshang
  41. * @param type $data 更新数据
  42. * @param type $condition 条件
  43. * @return type
  44. */
  45. public function editDaddress($data, $condition) {
  46. return Db::name('daddress')->where($condition)->update($data);
  47. }
  48. /**
  49. * 查询单条
  50. * @access public
  51. * @author csdeshang
  52. * @param type $condition 检索条件
  53. * @param type $fields 字段
  54. * @return type
  55. */
  56. public function getAddressInfo($condition, $fields = '*') {
  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. return Db::name('daddress')->field($fields)->where($condition)->order($order)->limit($limit)->select()->toArray();
  71. }
  72. }