1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\common\api;
- use app\common\state\MainState;
- use think\facade\Db;
- use app\common\model\HousePurchase as houseModel;
- use app\common\model\HousePurchaseChildren as houseChildModel;
- use app\common\model\HousePurchaseHouseInfo as houseInfoModel;
- /**
- * Description of HouseApi
- *
- * @author sgq
- */
- class HouseApi {
- public static function getInfoById($id) {
- return houseModel::findOrEmpty($id)->toArray();
- }
- public static function getHouseInfo($idCard) {
- if (\StrUtil::isEmpOrNull($idCard)) {
- return null;
- }
- $where = [];
- $where[] = ["idCard", "=", $idCard];
- return houseInfoModel::where($where)->find();
- }
- public static function getChildren($id) {
- $where = [];
- $where[] = ["pId", "=", $id];
- return houseChildModel::where($where)->select()->toArray();
- }
- public static function getChildrenById($id) {
- return houseChildModel::where($where)->find($id);
- }
- public static function deleteById($id) {
- $data["id"] = $id;
- $data["delete"] = 1;
- $data["deleteUser"] = session("user")["uid"];
- $data["deleteTime"] = date("Y-m-d H:i:s");
- return houseModel::update($data);
- }
- public static function deleteChildrenById($id) {
- return houseChildModel::where("id", $id)->delete();
- }
- }
|