<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Util; use ModStart\Core\Dao\ModelUtil; class MemberAddressUtil { public static function getUserAddress($KJqKC, $ULYbu) { goto YKngT; Sdoyw: return $lpVAI; goto lL8Ue; YKngT: $lpVAI = ModelUtil::get('member_address', array('id' => $ULYbu, 'memberUserId' => $KJqKC)); goto V4jfF; V4jfF: ModelUtil::decodeRecordBoolean($lpVAI, array('isDefault')); goto Sdoyw; lL8Ue: } public static function listUserAddresses($KJqKC) { goto E9mAG; YT8nf: ModelUtil::decodeRecordsBoolean($sX2oK, array('isDefault')); goto sqikz; E9mAG: $sX2oK = ModelUtil::model('member_address')->where(array('memberUserId' => $KJqKC))->orderBy('id', 'desc')->orderBy('isDefault', 'desc')->get()->toArray(); goto YT8nf; sqikz: return $sX2oK; goto le2rC; le2rC: } public static function delete($ULYbu) { ModelUtil::delete('member_address', array('id' => $ULYbu)); } public static function resetDefault($KJqKC) { ModelUtil::update('member_address', array('memberUserId' => $KJqKC), array('isDefault' => false)); } public static function update($ULYbu, $U8wjN) { return ModelUtil::update('member_address', array('id' => $ULYbu), $U8wjN); } public static function insert($U8wjN) { return ModelUtil::insert('member_address', $U8wjN); } public static function getDefault($KJqKC) { goto Sqeco; L3W57: return $uOfaH; goto ctA8_; Sqeco: $uOfaH = ModelUtil::get('member_address', array('memberUserId' => $KJqKC, 'isDefault' => true)); goto NB0df; NB0df: if (empty($uOfaH)) { $uOfaH = ModelUtil::get('member_address', array('memberUserId' => $KJqKC)); } goto L3W57; ctA8_: } public static function clearDefault($KJqKC) { ModelUtil::update('member_address', array('memberUserId' => $KJqKC), array('isDefault' => false)); } public static function truncate($KJqKC) { ModelUtil::delete('member_address', array('memberUserId' => $KJqKC)); } }