-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
111 changed files
with
8,225 additions
and
519 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace common\behaviors; | ||
|
||
use yii\base\Behavior; | ||
|
||
class BaseAttachAttribute extends Behavior | ||
{ | ||
|
||
/** | ||
* | ||
* @var \yii\db\ActiveRecord | ||
*/ | ||
public $owner; | ||
|
||
|
||
/** | ||
* @var string | ||
*/ | ||
public $attribute; | ||
|
||
/** | ||
* | ||
* @var mixed | ||
*/ | ||
protected $value; | ||
|
||
|
||
public function canGetProperty($name, $checkVars = true) | ||
{ | ||
return parent::canGetProperty($name, $checkVars) || $this->attribute == $name; | ||
} | ||
|
||
// 根据特性返回这个值 | ||
public function __get($name) | ||
{ | ||
if ($name != $this->attribute) { | ||
return parent::__get($name); | ||
} | ||
if ($this->value == null) { | ||
$this->value = $this->getValue(); | ||
} | ||
return $this->value; | ||
} | ||
|
||
protected function getValue() | ||
{ | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* Author: ljt | ||
* DateTime: 2016/11/9 9:46 | ||
* Description: | ||
*/ | ||
|
||
namespace common\components; | ||
|
||
use Yii; | ||
|
||
class Controller extends \yii\web\Controller | ||
{ | ||
public function renderJson($status = 1, $message = '', $data = []) | ||
{ | ||
\Yii::$app->response->format = 'json'; | ||
return array_merge(['status' => $status, 'message' => $message], $data); | ||
} | ||
|
||
public function goReferrer() | ||
{ | ||
return Yii::$app->controller->redirect(Yii::$app->request->getReferrer()); | ||
} | ||
|
||
public function flash($key, $value) | ||
{ | ||
Yii::$app->session->setFlash($key, $value); | ||
} | ||
} |
Oops, something went wrong.