first commit
This commit is contained in:
30
application/common/model/_Init.php
Normal file
30
application/common/model/_Init.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// +------------------------------------------------+
|
||||
// |http://www.cjango.com |
|
||||
// +------------------------------------------------+
|
||||
// | 修复BUG不是一朝一夕的事情,等我喝醉了再说吧! |
|
||||
// +------------------------------------------------+
|
||||
// | Author: 小陈叔叔 <Jason.Chen> |
|
||||
// +------------------------------------------------+
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class _Init extends Model
|
||||
{
|
||||
protected function setStatusAttr($value)
|
||||
{
|
||||
return self::parseStatus($value);
|
||||
}
|
||||
|
||||
protected function parseStatus($status)
|
||||
{
|
||||
if (is_numeric($status)) {
|
||||
return $status;
|
||||
} elseif ($status == 'true' || $status == 'on') {
|
||||
return 1;
|
||||
} elseif ($status == 'false' || $status == 'off') {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user