HouseApi.php 818 B

123456789101112131415161718192021222324252627282930313233343536
  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. /**
  8. * Description of HouseApi
  9. *
  10. * @author sgq
  11. */
  12. class HouseApi {
  13. public static function getInfoById($id) {
  14. return houseModel::findOrEmpty($id)->toArray();
  15. }
  16. public static function getHouseInfo($idCard) {
  17. if (\StrUtil::isEmpOrNull($idCard)) {
  18. return null;
  19. }
  20. $where = [];
  21. $where[] = ["idCard", "=", $idCard];
  22. return houseModel::where($where)->find();
  23. }
  24. public static function getChildren($id) {
  25. $where = [];
  26. $where[] = ["pId", "=", $id];
  27. return houseChildModel::where($where)->select()->toArray();
  28. }
  29. }