find($agent_id); } /** * 从缓存中获取app信息 */ public static function getAgentCache($agent_id = null) { if (is_null($agent_id)) { $self = new static(); $agent_id = $self::$agent_id; } if (!$data = Cache::get('agent_' . $agent_id)) { $data = self::detail($agent_id); if (empty($data)) throw new BaseException(['msg' => '未找到当前应用信息']); Cache::tag('cache')->set('agent_' . $agent_id, $data); } return $data; } /** * 启用商城 * @return bool */ public function updateStatus() { return $this->save([ 'status' => !$this['status'], ]); } /** * 所有商城 */ public static function getAll(){ return (new self())->where('is_delete', '=', 0) ->where('is_recycle', '=', 0) ->select(); } public function loginLog() { return $this->hasMany('app\\common\\model\\agent\\LoginLog', 'agent_id', 'agent_id'); } }