<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Util; use ModStart\Core\Dao\ModelUtil; class MemberAddressUtil { public static function getUserAddress($shbIl, $gZ39D) { goto HT9Gt; C_snf: return $lLaeU; goto A0d4m; HT9Gt: $lLaeU = ModelUtil::get('member_address', array('id' => $gZ39D, 'memberUserId' => $shbIl)); goto Ujgng; Ujgng: ModelUtil::decodeRecordBoolean($lLaeU, array('isDefault')); goto C_snf; A0d4m: } public static function listUserAddresses($shbIl) { goto iP3xA; Unaah: ModelUtil::decodeRecordsBoolean($MCyeh, array('isDefault')); goto DDPb1; DDPb1: return $MCyeh; goto eJ5Lw; iP3xA: $MCyeh = ModelUtil::model('member_address')->where(array('memberUserId' => $shbIl))->orderBy('id', 'desc')->orderBy('isDefault', 'desc')->get()->toArray(); goto Unaah; eJ5Lw: } public static function delete($gZ39D) { ModelUtil::delete('member_address', array('id' => $gZ39D)); } public static function resetDefault($shbIl) { ModelUtil::update('member_address', array('memberUserId' => $shbIl), array('isDefault' => false)); } public static function update($gZ39D, $avcnU) { return ModelUtil::update('member_address', array('id' => $gZ39D), $avcnU); } public static function insert($avcnU) { return ModelUtil::insert('member_address', $avcnU); } public static function getDefault($shbIl) { goto h2rS2; rQNnt: if (empty($BO33W)) { $BO33W = ModelUtil::get('member_address', array('memberUserId' => $shbIl)); } goto VHxoW; VHxoW: return $BO33W; goto dryWk; h2rS2: $BO33W = ModelUtil::get('member_address', array('memberUserId' => $shbIl, 'isDefault' => true)); goto rQNnt; dryWk: } public static function clearDefault($shbIl) { ModelUtil::update('member_address', array('memberUserId' => $shbIl), array('isDefault' => false)); } public static function truncate($shbIl) { ModelUtil::delete('member_address', array('memberUserId' => $shbIl)); } }