<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Model; use Illuminate\Database\Eloquent\Model; class MemberDataStatistic extends Model { protected $table = 'member_data_statistic'; public static function getCreateMemberUser($StE5h) { goto TofBy; OMlFl: if (empty($Xtdrg)) { goto lEXYy; hGHjr: $a_yFh->id = $StE5h; goto nQLyd; lEXYy: $a_yFh = new self(); goto hGHjr; nQLyd: $a_yFh->sizeLimit = modstart_config('Member_DataStatisticDefaultLimit', 1024); goto n3Vi9; aXMcj: self::updateMemberUserUsedSize($StE5h); goto M20WS; n3Vi9: $a_yFh->save(); goto aXMcj; M20WS: return self::getCreateMemberUser($StE5h); goto G7tx3; G7tx3: } goto pn81W; TofBy: $Xtdrg = self::where('id', $StE5h)->first(); goto OMlFl; pn81W: return $Xtdrg->toArray(); goto J6l58; J6l58: } public static function updateMemberUser($StE5h, $cwaKT) { goto uU6a8; uU6a8: $a_yFh = self::where('id', $StE5h)->first(); goto rSVnt; etY42: if (empty($a_yFh)) { goto eKHQE; v5lXy: $a_yFh->id = $StE5h; goto jnyN3; eKHQE: $a_yFh = new self(); goto v5lXy; jnyN3: $c373Q = true; goto V3wui; V3wui: } goto jvCP0; V5oUX: if ($c373Q) { self::updateMemberUserUsedSize($StE5h); } goto xZrlH; QJmEX: $a_yFh->save(); goto V5oUX; jvCP0: foreach ($cwaKT as $D5qRP => $qGgGl) { $a_yFh->{$D5qRP} = $qGgGl; } goto QJmEX; rSVnt: $c373Q = false; goto etY42; xZrlH: } public static function calcMemberUserUsedSize($StE5h) { $t5RO9 = MemberUpload::where(array('userId' => $StE5h))->leftJoin('data', 'data.id', '=', 'member_upload.dataId')->sum('data.size'); return intval($t5RO9); } public static function updateMemberUserUsedSize($StE5h) { $jNwg7 = array('sizeUsed' => self::calcMemberUserUsedSize($StE5h)); self::where('id', $StE5h)->update($jNwg7); } }