mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-23 03:50:56 +08:00
优化代码
This commit is contained in:
parent
9c4e10ccda
commit
aa66660e47
@ -1,3 +1,4 @@
|
|||||||
|
{% if pager.total_pages > 0 %}
|
||||||
<div class="search-course-list">
|
<div class="search-course-list">
|
||||||
{% for item in pager.items %}
|
{% for item in pager.items %}
|
||||||
{% set course_url = url({'for':'desktop.course.show','id':item.id}) %}
|
{% set course_url = url({'for':'desktop.course.show','id':item.id}) %}
|
||||||
@ -23,3 +24,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{{ partial('search/empty') }}
|
||||||
|
{% endif %}
|
||||||
|
4
app/Http/Desktop/Views/search/empty.volt
Normal file
4
app/Http/Desktop/Views/search/empty.volt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<div class="search-empty">
|
||||||
|
<div class="icon"><i class="layui-icon layui-icon-face-surprised"></i></div>
|
||||||
|
<div class="text">没有找到<span class="query">{{ query }}</span>相关内容,换个关键字试试吧!</div>
|
||||||
|
</div>
|
@ -1,3 +1,4 @@
|
|||||||
|
{% if pager.total_pages > 0 %}
|
||||||
<div class="search-group-list">
|
<div class="search-group-list">
|
||||||
{% for item in pager.items %}
|
{% for item in pager.items %}
|
||||||
{% set group_url = url({'for':'desktop.group.show','id':item.id}) %}
|
{% set group_url = url({'for':'desktop.group.show','id':item.id}) %}
|
||||||
@ -6,7 +7,7 @@
|
|||||||
<div class="search-group-card clearfix">
|
<div class="search-group-card clearfix">
|
||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
<a href="{{ group_url }}">
|
<a href="{{ group_url }}">
|
||||||
<img src="{{ item.avatar }}" alt="{{ item.name }}">
|
<img src="{{ item.avatar }}!avatar_160" alt="{{ item.name }}">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
@ -22,3 +23,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{{ partial('search/empty') }}
|
||||||
|
{% endif %}
|
@ -43,14 +43,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if pager.total_pages > 0 %}
|
|
||||||
{{ partial('partials/pager') }}
|
{{ partial('partials/pager') }}
|
||||||
{% else %}
|
|
||||||
<div class="search-empty wrap">
|
|
||||||
<div class="icon"><i class="layui-icon layui-icon-face-surprised"></i></div>
|
|
||||||
<div class="text">没有找到<span class="query">{{ query }}</span>相关内容,换个关键字试试吧!</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="layout-sidebar">
|
<div class="layout-sidebar">
|
||||||
{{ partial('search/sidebar') }}
|
{{ partial('search/sidebar') }}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{% if pager.total_pages > 0 %}
|
||||||
<div class="search-user-list">
|
<div class="search-user-list">
|
||||||
{% for item in pager.items %}
|
{% for item in pager.items %}
|
||||||
{% set user_url = url({'for':'desktop.user.show','id':item.id}) %}
|
{% set user_url = url({'for':'desktop.user.show','id':item.id}) %}
|
||||||
@ -15,7 +16,7 @@
|
|||||||
<div class="search-group-card clearfix">
|
<div class="search-group-card clearfix">
|
||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
<a href="{{ user_url }}">
|
<a href="{{ user_url }}">
|
||||||
<img src="{{ item.avatar }}" alt="{{ item.name }}">
|
<img src="{{ item.avatar }}!avatar_160" alt="{{ item.name }}">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
@ -31,3 +32,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{{ partial('search/empty') }}
|
||||||
|
{% endif %}
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Library\Paginator\Adapter;
|
namespace App\Library\Paginator\Adapter;
|
||||||
|
|
||||||
use App\Library\Paginator\Query;
|
use App\Library\Paginator\Query as PaginatorQuery;
|
||||||
use Phalcon\Paginator\Adapter\QueryBuilder as BaseQueryBuilder;
|
use Phalcon\Paginator\Adapter\QueryBuilder as PhQueryBuilder;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
class QueryBuilder extends BaseQueryBuilder
|
class QueryBuilder extends PhQueryBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $baseUrl;
|
protected $baseUrl;
|
||||||
@ -17,7 +17,7 @@ class QueryBuilder extends BaseQueryBuilder
|
|||||||
{
|
{
|
||||||
$pager = parent::paginate();
|
$pager = parent::paginate();
|
||||||
|
|
||||||
$query = new Query();
|
$query = new PaginatorQuery();
|
||||||
|
|
||||||
$this->baseUrl = $query->getBaseUrl();
|
$this->baseUrl = $query->getBaseUrl();
|
||||||
$this->params = $query->getParams();
|
$this->params = $query->getParams();
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Library\Paginator\Adapter;
|
namespace App\Library\Paginator\Adapter;
|
||||||
|
|
||||||
use App\Library\Paginator\Query;
|
use App\Library\Paginator\Query as PaginatorQuery;
|
||||||
|
use App\Library\Validators\Common as CommonValidator;
|
||||||
use Phalcon\Paginator\Adapter as PaginatorAdapter;
|
use Phalcon\Paginator\Adapter as PaginatorAdapter;
|
||||||
use Phalcon\Paginator\Exception as PaginatorException;
|
use Phalcon\Paginator\Exception as PaginatorException;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
@ -44,11 +45,11 @@ class XunSearch extends PaginatorAdapter
|
|||||||
throw new PaginatorException('Invalid query parameter');
|
throw new PaginatorException('Invalid query parameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($config['page']) || $config['page'] != intval($config['page'])) {
|
if (isset($config['page']) && !CommonValidator::positiveNumber($config['page'])) {
|
||||||
throw new PaginatorException('Invalid page parameter');
|
throw new PaginatorException('Invalid page parameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($config['limit']) || $config['limit'] != intval($config['limit'])) {
|
if (isset($config['limit']) && !CommonValidator::positiveNumber($config['limit'])) {
|
||||||
throw new PaginatorException('Invalid limit parameter');
|
throw new PaginatorException('Invalid limit parameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ class XunSearch extends PaginatorAdapter
|
|||||||
$this->_page = $config['page'] ?? 1;
|
$this->_page = $config['page'] ?? 1;
|
||||||
$this->_limitRows = $config['limit'] ?? 15;
|
$this->_limitRows = $config['limit'] ?? 15;
|
||||||
|
|
||||||
$query = new Query();
|
$query = new PaginatorQuery();
|
||||||
|
|
||||||
$this->baseUrl = $query->getBaseUrl();
|
$this->baseUrl = $query->getBaseUrl();
|
||||||
$this->params = $query->getParams();
|
$this->params = $query->getParams();
|
||||||
|
@ -22,7 +22,7 @@ class Common
|
|||||||
|
|
||||||
public static function email($str)
|
public static function email($str)
|
||||||
{
|
{
|
||||||
return filter_var($str, FILTER_VALIDATE_EMAIL) ? true : false;
|
return filter_var($str, FILTER_VALIDATE_EMAIL) !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function url($str)
|
public static function url($str)
|
||||||
@ -31,32 +31,42 @@ class Common
|
|||||||
$str = 'http:' . $str;
|
$str = 'http:' . $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
return filter_var($str, FILTER_VALIDATE_URL) ? true : false;
|
return filter_var($str, FILTER_VALIDATE_URL) !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function intNumber($str)
|
public static function intNumber($value)
|
||||||
{
|
{
|
||||||
return filter_var($str, FILTER_VALIDATE_INT) ? true : false;
|
return filter_var($value, FILTER_VALIDATE_INT) !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function floatNumber($str)
|
public static function floatNumber($value)
|
||||||
{
|
{
|
||||||
return filter_var($str, FILTER_VALIDATE_FLOAT) === false;
|
if (filter_var($value, FILTER_VALIDATE_FLOAT) === false) {
|
||||||
}
|
|
||||||
|
|
||||||
public static function natureNumber($number)
|
|
||||||
{
|
|
||||||
if (preg_match('/^0$/', $number)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preg_match('/^[1-9][0-9]?/', $number)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strpos($value, '.') === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$head = strstr($value, '.', true);
|
||||||
|
|
||||||
|
if ($head[0] == '0' && strlen($head) > 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function positiveNumber($value)
|
||||||
|
{
|
||||||
|
if (!self::intNumber($value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static function idCard($str)
|
public static function idCard($str)
|
||||||
{
|
{
|
||||||
$validator = new IdCard();
|
$validator = new IdCard();
|
||||||
|
@ -70,7 +70,7 @@ class Audit extends Model
|
|||||||
{
|
{
|
||||||
$this->create_time = time();
|
$this->create_time = time();
|
||||||
|
|
||||||
if (!empty($this->req_data)) {
|
if (is_array($this->req_data) && !empty($this->req_data)) {
|
||||||
$this->req_data = kg_json_encode($this->req_data);
|
$this->req_data = kg_json_encode($this->req_data);
|
||||||
} else {
|
} else {
|
||||||
$this->req_data = '';
|
$this->req_data = '';
|
||||||
|
@ -8,14 +8,6 @@ use Phalcon\Text;
|
|||||||
class Carousel extends Model
|
class Carousel extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台类型
|
|
||||||
*/
|
|
||||||
const PLATFORM_DESKTOP = 'desktop';
|
|
||||||
const PLATFORM_MOBILE = 'mobile';
|
|
||||||
const PLATFORM_APP = 'app';
|
|
||||||
const PLATFORM_MINI = 'mini';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 目标类型
|
* 目标类型
|
||||||
*/
|
*/
|
||||||
@ -58,13 +50,6 @@ class Carousel extends Model
|
|||||||
*/
|
*/
|
||||||
public $summary;
|
public $summary;
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $platform;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 目标
|
* 目标
|
||||||
*
|
*
|
||||||
@ -79,6 +64,13 @@ class Carousel extends Model
|
|||||||
*/
|
*/
|
||||||
public $content;
|
public $content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $platform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优先级
|
* 优先级
|
||||||
*
|
*
|
||||||
@ -133,8 +125,6 @@ class Carousel extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
if (empty($this->cover)) {
|
if (empty($this->cover)) {
|
||||||
$this->cover = kg_default_cover_path();
|
$this->cover = kg_default_cover_path();
|
||||||
} elseif (Text::startsWith($this->cover, 'http')) {
|
} elseif (Text::startsWith($this->cover, 'http')) {
|
||||||
@ -144,23 +134,25 @@ class Carousel extends Model
|
|||||||
if (is_array($this->style) && !empty($this->style)) {
|
if (is_array($this->style) && !empty($this->style)) {
|
||||||
$this->style = kg_json_encode($this->style);
|
$this->style = kg_json_encode($this->style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
if (Text::startsWith($this->cover, 'http')) {
|
||||||
|
$this->cover = self::getCoverPath($this->cover);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($this->style) && !empty($this->style)) {
|
||||||
|
$this->style = kg_json_encode($this->style);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Text::startsWith($this->cover, 'http')) {
|
$this->update_time = time();
|
||||||
$this->cover = self::getCoverPath($this->cover);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->style)) {
|
|
||||||
$this->style = kg_json_encode($this->style);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterFetch()
|
public function afterFetch()
|
||||||
@ -169,7 +161,7 @@ class Carousel extends Model
|
|||||||
$this->cover = kg_ci_cover_img_url($this->cover);
|
$this->cover = kg_ci_cover_img_url($this->cover);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->style)) {
|
if (is_string($this->style) && !empty($this->style)) {
|
||||||
$this->style = json_decode($this->style, true);
|
$this->style = json_decode($this->style, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,14 +195,4 @@ class Carousel extends Model
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function platformTypes()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
self::PLATFORM_DESKTOP => 'desktop',
|
|
||||||
self::PLATFORM_MOBILE => 'mobile',
|
|
||||||
self::PLATFORM_APP => 'app',
|
|
||||||
self::PLATFORM_MINI => '小程序',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -122,11 +122,11 @@ class Category extends Model
|
|||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterCreate()
|
public function afterCreate()
|
||||||
|
@ -186,8 +186,6 @@ class Chapter extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
$course = Course::findFirst($this->course_id);
|
$course = Course::findFirst($this->course_id);
|
||||||
|
|
||||||
$this->model = $course->model;
|
$this->model = $course->model;
|
||||||
@ -210,19 +208,21 @@ class Chapter extends Model
|
|||||||
|
|
||||||
$this->attrs = kg_json_encode($attrs);
|
$this->attrs = kg_json_encode($attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
if (is_array($this->attrs) && !empty($this->attrs)) {
|
||||||
|
$this->attrs = kg_json_encode($this->attrs);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($this->attrs)) {
|
$this->update_time = time();
|
||||||
$this->attrs = kg_json_encode($this->attrs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterCreate()
|
public function afterCreate()
|
||||||
@ -234,7 +234,7 @@ class Chapter extends Model
|
|||||||
|
|
||||||
public function afterFetch()
|
public function afterFetch()
|
||||||
{
|
{
|
||||||
if (!empty($this->attrs) && is_string($this->attrs)) {
|
if (is_string($this->attrs) && !empty($this->attrs)) {
|
||||||
$this->attrs = json_decode($this->attrs, true);
|
$this->attrs = json_decode($this->attrs, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,9 @@ class ChapterRead extends Model
|
|||||||
$this->create_time = time();
|
$this->create_time = time();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* text类型不能填充默认值
|
* text类型不能自动填充默认值
|
||||||
*/
|
*/
|
||||||
if (empty($this->content)) {
|
if (is_null($this->content)) {
|
||||||
$this->content = '';
|
$this->content = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,6 @@ class ChapterUser extends Model
|
|||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 计划编号
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $plan_id;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程编号
|
* 课程编号
|
||||||
*
|
*
|
||||||
@ -42,6 +35,13 @@ class ChapterUser extends Model
|
|||||||
*/
|
*/
|
||||||
public $user_id;
|
public $user_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划编号
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $plan_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 学习时长
|
* 学习时长
|
||||||
*
|
*
|
||||||
|
@ -63,20 +63,20 @@ class ChapterVod extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
if (is_array($this->file_transcode) && !empty($this->file_transcode)) {
|
if (is_array($this->file_transcode) && !empty($this->file_transcode)) {
|
||||||
$this->file_transcode = kg_json_encode($this->file_transcode);
|
$this->file_transcode = kg_json_encode($this->file_transcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
if (is_array($this->file_transcode) && !empty($this->file_transcode)) {
|
if (is_array($this->file_transcode) && !empty($this->file_transcode)) {
|
||||||
$this->file_transcode = kg_json_encode($this->file_transcode);
|
$this->file_transcode = kg_json_encode($this->file_transcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterFetch()
|
public function afterFetch()
|
||||||
|
@ -136,11 +136,11 @@ class Consult extends Model
|
|||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -256,8 +256,6 @@ class Course extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
$attrs = [];
|
$attrs = [];
|
||||||
|
|
||||||
switch ($this->model) {
|
switch ($this->model) {
|
||||||
@ -288,6 +286,8 @@ class Course extends Model
|
|||||||
if (!empty($attrs)) {
|
if (!empty($attrs)) {
|
||||||
$this->attrs = kg_json_encode($attrs);
|
$this->attrs = kg_json_encode($attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
@ -301,7 +301,7 @@ class Course extends Model
|
|||||||
$this->cover = self::getCoverPath($this->cover);
|
$this->cover = self::getCoverPath($this->cover);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($this->attrs)) {
|
if (is_array($this->attrs) && !empty($this->attrs)) {
|
||||||
$this->attrs = kg_json_encode($this->attrs);
|
$this->attrs = kg_json_encode($this->attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ class Course extends Model
|
|||||||
public function afterUpdate()
|
public function afterUpdate()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 课程标题和群组名称保持一致
|
* 群组名称和课程标题保持一致
|
||||||
*/
|
*/
|
||||||
if ($this->hasUpdated('title')) {
|
if ($this->hasUpdated('title')) {
|
||||||
$imGroup = ImGroup::findFirst(['course_id' => $this->id]);
|
$imGroup = ImGroup::findFirst(['course_id' => $this->id]);
|
||||||
@ -341,7 +341,7 @@ class Course extends Model
|
|||||||
$this->cover = kg_ci_cover_img_url($this->cover);
|
$this->cover = kg_ci_cover_img_url($this->cover);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->attrs) && is_string($this->attrs)) {
|
if (is_string($this->attrs) && !empty($this->attrs)) {
|
||||||
$this->attrs = json_decode($this->attrs, true);
|
$this->attrs = json_decode($this->attrs, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,14 +51,14 @@ class CourseUser extends Model
|
|||||||
/**
|
/**
|
||||||
* 角色类型
|
* 角色类型
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $role_type;
|
public $role_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 来源类型
|
* 来源类型
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $source_type;
|
public $source_type;
|
||||||
|
|
||||||
@ -130,9 +130,9 @@ class CourseUser extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
$this->plan_id = (int)date('Ymd');
|
$this->plan_id = (int)date('Ymd');
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
|
@ -144,11 +144,11 @@ class Danmu extends Model
|
|||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function sizeTypes()
|
public static function sizeTypes()
|
||||||
@ -184,7 +184,6 @@ class Danmu extends Model
|
|||||||
$types = self::positionTypes();
|
$types = self::positionTypes();
|
||||||
|
|
||||||
$keys = array_keys($types);
|
$keys = array_keys($types);
|
||||||
|
|
||||||
$index = array_rand($keys);
|
$index = array_rand($keys);
|
||||||
|
|
||||||
return $keys[$index];
|
return $keys[$index];
|
||||||
@ -195,7 +194,6 @@ class Danmu extends Model
|
|||||||
$types = self::colorTypes();
|
$types = self::colorTypes();
|
||||||
|
|
||||||
$keys = array_keys($types);
|
$keys = array_keys($types);
|
||||||
|
|
||||||
$index = array_rand($keys);
|
$index = array_rand($keys);
|
||||||
|
|
||||||
return $keys[$index];
|
return $keys[$index];
|
||||||
|
@ -90,23 +90,23 @@ class Help extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* text类型不会自动填充默认值
|
* text类型不会自动填充默认值
|
||||||
*/
|
*/
|
||||||
if (is_null($this->content)) {
|
if (is_null($this->content)) {
|
||||||
$this->content = '';
|
$this->content = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterCreate()
|
public function afterCreate()
|
||||||
|
@ -126,13 +126,13 @@ class ImGroup extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
if (empty($this->avatar)) {
|
if (empty($this->avatar)) {
|
||||||
$this->avatar = kg_default_avatar_path();
|
$this->avatar = kg_default_avatar_path();
|
||||||
} elseif (Text::startsWith($this->avatar, 'http')) {
|
} elseif (Text::startsWith($this->avatar, 'http')) {
|
||||||
$this->avatar = self::getAvatarPath($this->avatar);
|
$this->avatar = self::getAvatarPath($this->avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
|
@ -102,13 +102,11 @@ class ImMessage extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
$this->chat_id = 0;
|
|
||||||
|
|
||||||
if ($this->receiver_type == self::TYPE_FRIEND) {
|
if ($this->receiver_type == self::TYPE_FRIEND) {
|
||||||
$this->chat_id = self::getChatId($this->sender_id, $this->receiver_id);
|
$this->chat_id = self::getChatId($this->sender_id, $this->receiver_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
|
@ -41,7 +41,7 @@ class ImNotice extends Model
|
|||||||
/**
|
/**
|
||||||
* 条目类型
|
* 条目类型
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $item_type;
|
public $item_type;
|
||||||
|
|
||||||
@ -106,25 +106,25 @@ class ImNotice extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
if (!empty($this->item_info)) {
|
if (!empty($this->item_info)) {
|
||||||
$this->item_info = kg_json_encode($this->item_info);
|
$this->item_info = kg_json_encode($this->item_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
if (is_array($this->item_info) && !empty($this->item_info)) {
|
||||||
|
|
||||||
if (is_array($this->item_info)) {
|
|
||||||
$this->item_info = kg_json_encode($this->item_info);
|
$this->item_info = kg_json_encode($this->item_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterFetch()
|
public function afterFetch()
|
||||||
{
|
{
|
||||||
if (!empty($this->item_info) && is_string($this->item_info)) {
|
if (is_string($this->item_info) && !empty($this->item_info)) {
|
||||||
$this->item_info = json_decode($this->item_info, true);
|
$this->item_info = json_decode($this->item_info, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,22 +112,22 @@ class ImUser extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
if (empty($this->avatar)) {
|
if (empty($this->avatar)) {
|
||||||
$this->avatar = kg_default_avatar_path();
|
$this->avatar = kg_default_avatar_path();
|
||||||
} elseif (Text::startsWith($this->avatar, 'http')) {
|
} elseif (Text::startsWith($this->avatar, 'http')) {
|
||||||
$this->avatar = self::getAvatarPath($this->avatar);
|
$this->avatar = self::getAvatarPath($this->avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
if (Text::startsWith($this->avatar, 'http')) {
|
if (Text::startsWith($this->avatar, 'http')) {
|
||||||
$this->avatar = self::getAvatarPath($this->avatar);
|
$this->avatar = self::getAvatarPath($this->avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterFetch()
|
public function afterFetch()
|
||||||
|
@ -19,13 +19,6 @@ class Learning extends Model
|
|||||||
*/
|
*/
|
||||||
public $request_id;
|
public $request_id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 计划编号
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
public $plan_id;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 课程编号
|
* 课程编号
|
||||||
*
|
*
|
||||||
@ -47,6 +40,13 @@ class Learning extends Model
|
|||||||
*/
|
*/
|
||||||
public $user_id;
|
public $user_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计划编号
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $plan_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 持续时长
|
* 持续时长
|
||||||
*
|
*
|
||||||
|
@ -141,11 +141,11 @@ class Nav extends Model
|
|||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function positionTypes()
|
public static function positionTypes()
|
||||||
|
@ -77,14 +77,14 @@ class Order extends Model
|
|||||||
/**
|
/**
|
||||||
* 条目编号
|
* 条目编号
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $item_id;
|
public $item_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 条目类型
|
* 条目类型
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $item_type;
|
public $item_type;
|
||||||
|
|
||||||
@ -144,24 +144,24 @@ class Order extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->sn = date('YmdHis') . rand(1000, 9999);
|
|
||||||
|
|
||||||
$this->status = self::STATUS_PENDING;
|
$this->status = self::STATUS_PENDING;
|
||||||
|
|
||||||
$this->create_time = time();
|
$this->sn = date('YmdHis') . rand(1000, 9999);
|
||||||
|
|
||||||
if (is_array($this->item_info)) {
|
if (is_array($this->item_info) && !empty($this->item_info)) {
|
||||||
$this->item_info = kg_json_encode($this->item_info);
|
$this->item_info = kg_json_encode($this->item_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
if (is_array($this->item_info) && !empty($this->item_info)) {
|
||||||
|
|
||||||
if (is_array($this->item_info)) {
|
|
||||||
$this->item_info = kg_json_encode($this->item_info);
|
$this->item_info = kg_json_encode($this->item_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterSave()
|
public function afterSave()
|
||||||
@ -178,7 +178,7 @@ class Order extends Model
|
|||||||
{
|
{
|
||||||
$this->amount = (float)$this->amount;
|
$this->amount = (float)$this->amount;
|
||||||
|
|
||||||
if (!empty($this->item_info) && is_string($this->item_info)) {
|
if (is_string($this->item_info) && !empty($this->item_info)) {
|
||||||
$this->item_info = json_decode($this->item_info, true);
|
$this->item_info = json_decode($this->item_info, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,6 +198,7 @@ class Order extends Model
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
self::STATUS_PENDING => '待支付',
|
self::STATUS_PENDING => '待支付',
|
||||||
|
self::STATUS_SHIPPING => '发货中',
|
||||||
self::STATUS_FINISHED => '已完成',
|
self::STATUS_FINISHED => '已完成',
|
||||||
self::STATUS_CLOSED => '已关闭',
|
self::STATUS_CLOSED => '已关闭',
|
||||||
self::STATUS_REFUNDED => '已退款',
|
self::STATUS_REFUNDED => '已退款',
|
||||||
|
@ -22,7 +22,7 @@ class OrderStatus extends Model
|
|||||||
/**
|
/**
|
||||||
* 状态类型
|
* 状态类型
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
|
@ -102,11 +102,11 @@ class Package extends Model
|
|||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterCreate()
|
public function afterCreate()
|
||||||
|
@ -76,23 +76,23 @@ class Page extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* text类型不会自动填充默认值
|
* text类型不会自动填充默认值
|
||||||
*/
|
*/
|
||||||
if (is_null($this->content)) {
|
if (is_null($this->content)) {
|
||||||
$this->content = '';
|
$this->content = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterCreate()
|
public function afterCreate()
|
||||||
|
@ -27,7 +27,7 @@ class Refund extends Model
|
|||||||
/**
|
/**
|
||||||
* 用户编号
|
* 用户编号
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $owner_id;
|
public $owner_id;
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ class Refund extends Model
|
|||||||
/**
|
/**
|
||||||
* 状态类型
|
* 状态类型
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
@ -132,13 +132,6 @@ class Refund extends Model
|
|||||||
$this->sn = date('YmdHis') . rand(1000, 9999);
|
$this->sn = date('YmdHis') . rand(1000, 9999);
|
||||||
|
|
||||||
$this->create_time = time();
|
$this->create_time = time();
|
||||||
|
|
||||||
/**
|
|
||||||
* 退款周期内无条件审批,状态为approved
|
|
||||||
*/
|
|
||||||
if (!$this->status) {
|
|
||||||
$this->status = self::STATUS_PENDING;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
|
@ -22,7 +22,7 @@ class RefundStatus extends Model
|
|||||||
/**
|
/**
|
||||||
* 状态类型
|
* 状态类型
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
|
@ -131,20 +131,20 @@ class Review extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
$this->rating = $this->getAvgRating();
|
$this->rating = $this->getAvgRating();
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
$this->rating = $this->getAvgRating();
|
$this->rating = $this->getAvgRating();
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getAvgRating()
|
protected function getAvgRating()
|
||||||
|
@ -103,25 +103,25 @@ class Role extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
if (is_array($this->routes) && !empty($this->routes)) {
|
||||||
|
|
||||||
if (!empty($this->routes)) {
|
|
||||||
$this->routes = kg_json_encode($this->routes);
|
$this->routes = kg_json_encode($this->routes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
if (is_array($this->routes) && !empty($this->routes)) {
|
||||||
|
|
||||||
if (is_array($this->routes)) {
|
|
||||||
$this->routes = kg_json_encode($this->routes);
|
$this->routes = kg_json_encode($this->routes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterFetch()
|
public function afterFetch()
|
||||||
{
|
{
|
||||||
if (!empty($this->routes) && is_string($this->routes)) {
|
if (is_string($this->routes) && !empty($this->routes)) {
|
||||||
$this->routes = json_decode($this->routes, true);
|
$this->routes = json_decode($this->routes, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class Task extends Model
|
|||||||
/**
|
/**
|
||||||
* 状态标识
|
* 状态标识
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
@ -98,25 +98,25 @@ class Task extends Model
|
|||||||
{
|
{
|
||||||
$this->status = self::STATUS_PENDING;
|
$this->status = self::STATUS_PENDING;
|
||||||
|
|
||||||
$this->create_time = time();
|
if (is_array($this->item_info) && !empty($this->item_info)) {
|
||||||
|
|
||||||
if (!empty($this->item_info)) {
|
|
||||||
$this->item_info = kg_json_encode($this->item_info);
|
$this->item_info = kg_json_encode($this->item_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
if (is_array($this->item_info) && !empty($this->item_info)) {
|
||||||
|
|
||||||
if (is_array($this->item_info)) {
|
|
||||||
$this->item_info = kg_json_encode($this->item_info);
|
$this->item_info = kg_json_encode($this->item_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterFetch()
|
public function afterFetch()
|
||||||
{
|
{
|
||||||
if (!empty($this->item_info) && is_string($this->item_info)) {
|
if (is_string($this->item_info) && !empty($this->item_info)) {
|
||||||
$this->item_info = json_decode($this->item_info, true);
|
$this->item_info = json_decode($this->item_info, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,11 +88,11 @@ class Topic extends Model
|
|||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
{
|
{
|
||||||
$this->update_time = time();
|
|
||||||
|
|
||||||
if ($this->deleted == 1) {
|
if ($this->deleted == 1) {
|
||||||
$this->published = 0;
|
$this->published = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->update_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterCreate()
|
public function afterCreate()
|
||||||
|
@ -66,7 +66,7 @@ class Trade extends Model
|
|||||||
/**
|
/**
|
||||||
* 平台类型
|
* 平台类型
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $channel;
|
public $channel;
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class Trade extends Model
|
|||||||
/**
|
/**
|
||||||
* 状态类型
|
* 状态类型
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
@ -126,11 +126,11 @@ class Trade extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
$this->status = self::STATUS_PENDING;
|
$this->status = self::STATUS_PENDING;
|
||||||
|
|
||||||
$this->sn = date('YmdHis') . rand(1000, 9999);
|
$this->sn = date('YmdHis') . rand(1000, 9999);
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
|
@ -22,7 +22,7 @@ class TradeStatus extends Model
|
|||||||
/**
|
/**
|
||||||
* 状态类型
|
* 状态类型
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $status;
|
public $status;
|
||||||
|
|
||||||
|
@ -177,13 +177,13 @@ class User extends Model
|
|||||||
|
|
||||||
public function beforeCreate()
|
public function beforeCreate()
|
||||||
{
|
{
|
||||||
$this->create_time = time();
|
|
||||||
|
|
||||||
if (empty($this->avatar)) {
|
if (empty($this->avatar)) {
|
||||||
$this->avatar = kg_default_avatar_path();
|
$this->avatar = kg_default_avatar_path();
|
||||||
} elseif (Text::startsWith($this->avatar, 'http')) {
|
} elseif (Text::startsWith($this->avatar, 'http')) {
|
||||||
$this->avatar = self::getAvatarPath($this->avatar);
|
$this->avatar = self::getAvatarPath($this->avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->create_time = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeUpdate()
|
public function beforeUpdate()
|
||||||
|
@ -19,7 +19,7 @@ type = string
|
|||||||
[about]
|
[about]
|
||||||
type = body
|
type = body
|
||||||
|
|
||||||
[location]
|
[area]
|
||||||
type = string
|
type = string
|
||||||
index = self
|
index = self
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user