getModel()::getDB())->where('uid',$uid)->where($field,$value)->count()) > 0; } public function changeDefault(int $uid) { return ($this->getModel()::getDB())->where('uid',$uid)->update(['is_default' => 0]); } public function getAll(int $uid) { return (($this->getModel()::getDB())->where('uid',$uid)); } /** * 根据 地址ID 获取地址实体 * @param int $addressId * @return CommonEntity */ public function getAddressEntityByAddressId(int $addressId): CommonEntity { $addressData = []; try { /** @var model $model */ $model = $this->getModel(); $addressDataRes = $model::getDB() ->where('address_id', '=', $addressId) ->where('is_del', '=', CommonEnum::IS_DEL['No']['code']) ->find(); if (!empty($addressDataRes)) { $addressData = $addressDataRes->toArray(); } } catch (\Exception $e) { } return UserAddressEntity::newInstance($addressData); } }