HouseApi.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\common\api;
  3. use app\common\state\MainState;
  4. use think\facade\Db;
  5. use app\common\model\HousePurchase as houseModel;
  6. use app\common\model\HousePurchaseChildren as houseChildModel;
  7. use app\common\model\HousePurchaseHouseInfo as houseInfoModel;
  8. /**
  9. * Description of HouseApi
  10. *
  11. * @author sgq
  12. */
  13. class HouseApi {
  14. public static function getInfoById($id) {
  15. return houseModel::findOrEmpty($id)->toArray();
  16. }
  17. public static function getHouseInfo($idCard) {
  18. if (\StrUtil::isEmpOrNull($idCard)) {
  19. return null;
  20. }
  21. $where = [];
  22. $where[] = ["idCard", "=", $idCard];
  23. return houseInfoModel::where($where)->find();
  24. }
  25. public static function getChildren($id) {
  26. $where = [];
  27. $where[] = ["pId", "=", $id];
  28. return houseChildModel::where($where)->select()->toArray();
  29. }
  30. public static function getChildrenById($id) {
  31. return houseChildModel::where($where)->find($id);
  32. }
  33. public static function deleteById($id) {
  34. $data["id"] = $id;
  35. $data["delete"] = 1;
  36. $data["deleteUser"] = session("user")["uid"];
  37. $data["deleteTime"] = date("Y-m-d H:i:s");
  38. return houseModel::update($data);
  39. }
  40. public static function deleteChildrenById($id) {
  41. return houseChildModel::where("id", $id)->delete();
  42. }
  43. }