diff --git a/app/Caches/LatestCourseList.php b/app/Caches/LatestCourseList.php index 03e5b31e..53782bc7 100644 --- a/app/Caches/LatestCourseList.php +++ b/app/Caches/LatestCourseList.php @@ -69,7 +69,7 @@ class LatestCourseList extends Cache { return CourseModel::query() ->where('deleted = 0') - ->orderBy('created_at DESC') + ->orderBy('create_time DESC') ->limit($limit) ->execute(); } diff --git a/app/Console/Tasks/CleanAuthTokenTask.php b/app/Console/Tasks/CleanAuthTokenTask.php index 5346f861..f3de4d00 100644 --- a/app/Console/Tasks/CleanAuthTokenTask.php +++ b/app/Console/Tasks/CleanAuthTokenTask.php @@ -34,7 +34,7 @@ class CleanAuthTokenTask extends Task protected function findAccessTokens() { return AccessTokenModel::query() - ->where('expired_at < :expired_at:', ['expired_at' => time()]) + ->where('expiry_time < :expiry_time:', ['expiry_time' => time()]) ->execute(); } @@ -46,7 +46,7 @@ class CleanAuthTokenTask extends Task protected function findRefreshTokens() { return RefreshTokenModel::query() - ->where('expired_at < :expired_at:', ['expired_at' => time()]) + ->where('expiry_time < :expiry_time:', ['expiry_time' => time()]) ->execute(); } diff --git a/app/Console/Tasks/CloseOrderTask.php b/app/Console/Tasks/CloseOrderTask.php index f85c3175..b6818ba7 100644 --- a/app/Console/Tasks/CloseOrderTask.php +++ b/app/Console/Tasks/CloseOrderTask.php @@ -34,11 +34,11 @@ class CloseOrderTask extends Task { $status = OrderModel::STATUS_PENDING; - $createdAt = time() - 12 * 3600; + $createTime = time() - 12 * 3600; return OrderModel::query() ->where('status = :status:', ['status' => $status]) - ->andWhere('created_at < :created_at:', ['created_at' => $createdAt]) + ->andWhere('create_time < :create_time:', ['create_time' => $createTime]) ->limit($limit) ->execute(); } diff --git a/app/Console/Tasks/CloseTradeTask.php b/app/Console/Tasks/CloseTradeTask.php index b31c0c03..0198423a 100644 --- a/app/Console/Tasks/CloseTradeTask.php +++ b/app/Console/Tasks/CloseTradeTask.php @@ -73,11 +73,11 @@ class CloseTradeTask extends Task { $status = TradeModel::STATUS_PENDING; - $createdAt = time() - 15 * 60; + $createTime = time() - 15 * 60; return TradeModel::query() ->where('status = :status:', ['status' => $status]) - ->andWhere('created_at < :created_at:', ['created_at' => $createdAt]) + ->andWhere('create_time < :create_time:', ['create_time' => $createTime]) ->limit($limit) ->execute(); } diff --git a/app/Http/Admin/Views/audit/list.volt b/app/Http/Admin/Views/audit/list.volt index f4e8277b..72c2802a 100644 --- a/app/Http/Admin/Views/audit/list.volt +++ b/app/Http/Admin/Views/audit/list.volt @@ -40,7 +40,7 @@ {{ item.user_ip }} {{ item.req_route }} {{ item.req_path }} - {{ date('Y-m-d H:i:s',item.created_at) }} + {{ date('Y-m-d H:i:s',item.create_time) }} diff --git a/app/Http/Admin/Views/comment/list.volt b/app/Http/Admin/Views/comment/list.volt index 7cd16708..329e2d42 100644 --- a/app/Http/Admin/Views/comment/list.volt +++ b/app/Http/Admin/Views/comment/list.volt @@ -49,7 +49,7 @@

昵称:{{ item.user.name }}

编号:{{ item.user.id }}

- {{ date('Y-m-d H:i',item.created_at) }} + {{ date('Y-m-d H:i',item.create_time) }} diff --git a/app/Http/Admin/Views/consult/list.volt b/app/Http/Admin/Views/consult/list.volt index 12106e61..2c9a19a2 100644 --- a/app/Http/Admin/Views/consult/list.volt +++ b/app/Http/Admin/Views/consult/list.volt @@ -46,7 +46,7 @@

昵称:{{ item.user.name }}

编号:{{ item.user.id }}

- {{ date('Y-m-d H:i',item.created_at) }} + {{ date('Y-m-d H:i',item.create_time) }} diff --git a/app/Http/Admin/Views/help/list.volt b/app/Http/Admin/Views/help/list.volt index 5bf2cefc..3f36455a 100644 --- a/app/Http/Admin/Views/help/list.volt +++ b/app/Http/Admin/Views/help/list.volt @@ -35,7 +35,7 @@ {{ item.id }} {{ item.title }} - {{ date('Y-m-d H:i',item.updated_at) }} + {{ date('Y-m-d H:i',item.update_time) }} diff --git a/app/Http/Admin/Views/order/list.volt b/app/Http/Admin/Views/order/list.volt index 6fc21169..d6335c04 100644 --- a/app/Http/Admin/Views/order/list.volt +++ b/app/Http/Admin/Views/order/list.volt @@ -45,7 +45,7 @@ ¥{{ item.amount }} {{ order_status(item.status) }} - {{ date('Y-m-d H:i',item.created_at) }} + {{ date('Y-m-d H:i',item.create_time) }} 详情 diff --git a/app/Http/Admin/Views/order/show.volt b/app/Http/Admin/Views/order/show.volt index 9adcc757..38b2a044 100644 --- a/app/Http/Admin/Views/order/show.volt +++ b/app/Http/Admin/Views/order/show.volt @@ -23,7 +23,7 @@ ¥{{ order.amount }} {{ item_type(order.item_type) }} {{ order_status(order.status) }} - {{ date('Y-m-d H:i',order.created_at) }} + {{ date('Y-m-d H:i',order.create_time) }} @@ -54,7 +54,7 @@ ¥{{ item.amount }} {{ substr(item.apply_note,0,15) }} {{ refund_status(item) }} - {{ date('Y-m-d H:i',item.created_at) }} + {{ date('Y-m-d H:i',item.create_time) }} {% endfor %} @@ -80,7 +80,7 @@ ¥{{ item.amount }} {{ channel_type(item.channel) }} {{ trade_status(item.status) }} - {{ date('Y-m-d H:i',item.created_at) }} + {{ date('Y-m-d H:i',item.create_time) }} {% endfor %} diff --git a/app/Http/Admin/Views/page/list.volt b/app/Http/Admin/Views/page/list.volt index 37c1202c..20306d53 100644 --- a/app/Http/Admin/Views/page/list.volt +++ b/app/Http/Admin/Views/page/list.volt @@ -35,8 +35,8 @@ {{ item.id }} {{ item.title }} - {{ date('Y-m-d H:i',item.created_at) }} - {{ date('Y-m-d H:i',item.updated_at) }} + {{ date('Y-m-d H:i',item.create_time) }} + {{ date('Y-m-d H:i',item.update_time) }} diff --git a/app/Http/Admin/Views/refund/list.volt b/app/Http/Admin/Views/refund/list.volt index 9cf88802..cd7f05d3 100644 --- a/app/Http/Admin/Views/refund/list.volt +++ b/app/Http/Admin/Views/refund/list.volt @@ -45,7 +45,7 @@ ¥{{ item.amount }} {{ refund_status(item) }} - {{ date('Y-m-d H:i',item.created_at) }} + {{ date('Y-m-d H:i',item.create_time) }} 详情 diff --git a/app/Http/Admin/Views/refund/show.volt b/app/Http/Admin/Views/refund/show.volt index 5e302d3b..791139d1 100644 --- a/app/Http/Admin/Views/refund/show.volt +++ b/app/Http/Admin/Views/refund/show.volt @@ -19,7 +19,7 @@ ¥{{ refund.amount }} {{ substr(refund.apply_note,0,15) }} {{ refund_status(refund) }} - {{ date('Y-m-d H:i',refund.created_at) }} + {{ date('Y-m-d H:i',refund.create_time) }} @@ -74,7 +74,7 @@ ¥{{ trade.amount }} {{ channel_type(trade.channel) }} {{ trade_status(trade.status) }} - {{ date('Y-m-d H:i',trade.created_at) }} + {{ date('Y-m-d H:i',trade.create_time) }} @@ -97,7 +97,7 @@ {{ order.subject }} ¥{{ order.amount }} {{ order_status(order.status) }} - {{ date('Y-m-d H:i',order.created_at) }} + {{ date('Y-m-d H:i',order.create_time) }} diff --git a/app/Http/Admin/Views/review/list.volt b/app/Http/Admin/Views/review/list.volt index 217dfc6d..8f9a9cc3 100644 --- a/app/Http/Admin/Views/review/list.volt +++ b/app/Http/Admin/Views/review/list.volt @@ -44,7 +44,7 @@

昵称:{{ item.user.name }}

编号:{{ item.user.id }}

- {{ date('Y-m-d H:i',item.created_at) }} + {{ date('Y-m-d H:i',item.create_time) }} diff --git a/app/Http/Admin/Views/student/learning.volt b/app/Http/Admin/Views/student/learning.volt index 78cc047d..53df0192 100644 --- a/app/Http/Admin/Views/student/learning.volt +++ b/app/Http/Admin/Views/student/learning.volt @@ -6,11 +6,11 @@ {% endif %} {%- endmacro %} -{%- macro last_active(created_at, updated_at) %} - {% if updated_at > 0 %} - {{ date('Y-m-d H:i', updated_at) }} +{%- macro last_active(create_time, update_time) %} + {% if update_time > 0 %} + {{ date('Y-m-d H:i', update_time) }} {% else %} - {{ date('Y-m-d H:i', created_at) }} + {{ date('Y-m-d H:i', create_time) }} {% endif %} {%- endmacro %} @@ -41,7 +41,7 @@ {{ item.duration|play_duration }} {{ client_type(item.client_type) }} {{ item.client_ip }} - {{ last_active(item.created_at, item.updated_at) }} + {{ last_active(item.create_time, item.update_time) }} {% endfor %} diff --git a/app/Http/Admin/Views/trade/list.volt b/app/Http/Admin/Views/trade/list.volt index 0de73f12..fbca7d1a 100644 --- a/app/Http/Admin/Views/trade/list.volt +++ b/app/Http/Admin/Views/trade/list.volt @@ -48,7 +48,7 @@ ¥{{ item.amount }} {{ channel_type(item.channel) }} {{ trade_status(item.status) }} - {{ date('Y-m-d H:i',item.created_at) }} + {{ date('Y-m-d H:i',item.create_time) }} 详情 diff --git a/app/Http/Admin/Views/trade/show.volt b/app/Http/Admin/Views/trade/show.volt index b9a84661..22fe887b 100644 --- a/app/Http/Admin/Views/trade/show.volt +++ b/app/Http/Admin/Views/trade/show.volt @@ -19,7 +19,7 @@ ¥{{ trade.amount }} {{ channel_type(trade.channel) }} {{ trade_status(trade.status) }} - {{ date('Y-m-d H:i',trade.created_at) }} + {{ date('Y-m-d H:i',trade.create_time) }} @@ -53,7 +53,7 @@ ¥{{ item.amount }} {{ substr(item.apply_note,0,15) }} {{ refund_status(item) }} - {{ date('Y-m-d H:i',item.created_at) }} + {{ date('Y-m-d H:i',item.create_time) }} {% endfor %} @@ -78,7 +78,7 @@ {{ order.subject }} ¥{{ order.amount }} {{ order_status(order.status) }} - {{ date('Y-m-d H:i',order.created_at) }} + {{ date('Y-m-d H:i',order.create_time) }} diff --git a/app/Models/AccessToken.php b/app/Models/AccessToken.php index 60b02e98..c6b926d8 100644 --- a/app/Models/AccessToken.php +++ b/app/Models/AccessToken.php @@ -33,7 +33,21 @@ class AccessToken extends Model * * @var int */ - public $expired_at; + public $expiry_time; + + /** + * 创建时间 + * + * @var int + */ + public $create_time; + + /** + * 更新时间 + * + * @var int + */ + public $update_time; public function getSource() { @@ -44,7 +58,14 @@ class AccessToken extends Model { $this->id = $this->getRandId($this->user_id); - $this->expired_at = strtotime('+2 hours'); + $this->expiry_time = strtotime('+2 hours'); + + $this->create_time = time(); + } + + public function beforeUpdate() + { + $this->update_time = time(); } public function afterCreate() diff --git a/app/Models/Account.php b/app/Models/Account.php index e490f818..0d3a8f6e 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -55,14 +55,14 @@ class Account extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -87,7 +87,7 @@ class Account extends Model $this->password = Password::hash($this->password, $this->salt); - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() @@ -99,7 +99,7 @@ class Account extends Model $this->password = Password::hash($this->password, $this->salt); } - $this->updated_at = time(); + $this->update_time = time(); } public function afterCreate() diff --git a/app/Models/Audit.php b/app/Models/Audit.php index 0861a59e..91a48c87 100644 --- a/app/Models/Audit.php +++ b/app/Models/Audit.php @@ -59,7 +59,7 @@ class Audit extends Model * * @var int */ - public $created_at; + public $create_time; public function getSource() { @@ -68,7 +68,7 @@ class Audit extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); if (!empty($this->req_data)) { $this->req_data = kg_json_encode($this->req_data); diff --git a/app/Models/Category.php b/app/Models/Category.php index 514876fc..426c36d6 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -85,14 +85,14 @@ class Category extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -113,12 +113,12 @@ class Category extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } public function afterCreate() diff --git a/app/Models/Chapter.php b/app/Models/Chapter.php index 20f9b346..a8c18704 100644 --- a/app/Models/Chapter.php +++ b/app/Models/Chapter.php @@ -160,14 +160,14 @@ class Chapter extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -188,7 +188,7 @@ class Chapter extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); if ($this->parent_id > 0) { @@ -216,7 +216,7 @@ class Chapter extends Model public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); if (!empty($this->attrs)) { $this->attrs = kg_json_encode($this->attrs); diff --git a/app/Models/ChapterLive.php b/app/Models/ChapterLive.php index 527b5a43..be9c8faa 100644 --- a/app/Models/ChapterLive.php +++ b/app/Models/ChapterLive.php @@ -52,14 +52,14 @@ class ChapterLive extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -68,12 +68,12 @@ class ChapterLive extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/ChapterRead.php b/app/Models/ChapterRead.php index 1df9e485..ab854765 100644 --- a/app/Models/ChapterRead.php +++ b/app/Models/ChapterRead.php @@ -51,14 +51,14 @@ class ChapterRead extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -67,12 +67,12 @@ class ChapterRead extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } public static function formatTypes() diff --git a/app/Models/ChapterUser.php b/app/Models/ChapterUser.php index 036b4749..5f832558 100644 --- a/app/Models/ChapterUser.php +++ b/app/Models/ChapterUser.php @@ -75,14 +75,14 @@ class ChapterUser extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -103,12 +103,12 @@ class ChapterUser extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/ChapterVod.php b/app/Models/ChapterVod.php index bf8fcb78..e3bbf660 100644 --- a/app/Models/ChapterVod.php +++ b/app/Models/ChapterVod.php @@ -47,14 +47,14 @@ class ChapterVod extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -63,7 +63,7 @@ class ChapterVod extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); if (!empty($this->file_transcode)) { $this->file_transcode = kg_json_encode($this->file_transcode); @@ -72,7 +72,7 @@ class ChapterVod extends Model public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); if (!empty($this->file_transcode)) { $this->file_transcode = kg_json_encode($this->file_transcode); diff --git a/app/Models/ChapterVote.php b/app/Models/ChapterVote.php index e4669562..6365932a 100644 --- a/app/Models/ChapterVote.php +++ b/app/Models/ChapterVote.php @@ -54,14 +54,14 @@ class ChapterVote extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -82,12 +82,12 @@ class ChapterVote extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/Comment.php b/app/Models/Comment.php index 7f4fa91a..277e9bda 100644 --- a/app/Models/Comment.php +++ b/app/Models/Comment.php @@ -10,35 +10,35 @@ class Comment extends Model /** * 主键编号 * - * @var integer + * @var int */ public $id; /** * 父级编号 * - * @var integer + * @var int */ public $parent_id; /** * 课程编号 * - * @var integer + * @var int */ public $course_id; /** * 章节编号 * - * @var integer + * @var int */ public $chapter_id; /** * 用户编号 * - * @var integer + * @var int */ public $user_id; @@ -61,7 +61,7 @@ class Comment extends Model /** * 回复数 * - * @var integer + * @var int */ public $reply_count; @@ -96,16 +96,16 @@ class Comment extends Model /** * 创建时间 * - * @var integer + * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * - * @var integer + * @var int */ - public $updated_at; + public $update_time; public function getSource() { diff --git a/app/Models/CommentVote.php b/app/Models/CommentVote.php index e8128115..635c57e9 100644 --- a/app/Models/CommentVote.php +++ b/app/Models/CommentVote.php @@ -54,14 +54,14 @@ class CommentVote extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -82,12 +82,12 @@ class CommentVote extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/Consult.php b/app/Models/Consult.php index 17457280..089826a7 100644 --- a/app/Models/Consult.php +++ b/app/Models/Consult.php @@ -10,21 +10,21 @@ class Consult extends Model /** * 主键编号 * - * @var integer + * @var int */ public $id; /** * 课程编号 * - * @var integer + * @var int */ public $course_id; /** * 用户编号 * - * @var integer + * @var int */ public $user_id; @@ -73,16 +73,16 @@ class Consult extends Model /** * 创建时间 * - * @var integer + * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * - * @var integer + * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -103,12 +103,12 @@ class Consult extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/ConsultVote.php b/app/Models/ConsultVote.php index ed7fb2e8..2d32cc6a 100644 --- a/app/Models/ConsultVote.php +++ b/app/Models/ConsultVote.php @@ -17,21 +17,21 @@ class ConsultVote extends Model /** * 主键编号 * - * @var integer + * @var int */ public $id; /** * 咨询编号 * - * @var integer + * @var int */ public $consult_id; /** * 用户编号 * - * @var integer + * @var int */ public $user_id; @@ -52,9 +52,9 @@ class ConsultVote extends Model /** * 创建时间 * - * @var integer + * @var int */ - public $created_at; + public $create_time; public function getSource() { @@ -75,12 +75,12 @@ class ConsultVote extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/ContentImage.php b/app/Models/ContentImage.php index f28f3e8e..50598c60 100644 --- a/app/Models/ContentImage.php +++ b/app/Models/ContentImage.php @@ -33,14 +33,14 @@ class ContentImage extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -61,7 +61,7 @@ class ContentImage extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() diff --git a/app/Models/Course.php b/app/Models/Course.php index 4a38cb9b..4286c0a6 100644 --- a/app/Models/Course.php +++ b/app/Models/Course.php @@ -50,13 +50,6 @@ class Course extends Model */ public $id; - /** - * 类型 - * - * @var string - */ - public $class_id; - /** * 标题 * @@ -209,14 +202,14 @@ class Course extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -237,7 +230,7 @@ class Course extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); $attrs = []; @@ -256,12 +249,11 @@ class Course extends Model if (!empty($attrs)) { $this->attrs = kg_json_encode($attrs); } - } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); if (!empty($this->attrs)) { $this->attrs = kg_json_encode($this->attrs); @@ -281,51 +273,43 @@ class Course extends Model public static function modelTypes() { - $types = [ + return [ self::MODEL_VOD => '点播', self::MODEL_LIVE => '直播', self::MODEL_READ => '图文', ]; - - return $types; } public static function levelTypes() { - $types = [ + return [ self::LEVEL_ENTRY => '入门', self::LEVEL_JUNIOR => '初级', self::LEVEL_MEDIUM => '中级', self::LEVEL_SENIOR => '高级', ]; - - return $types; } public static function studyExpiryOptions() { - $options = [ + return [ 1 => '1个月', 3 => '3个月', 6 => '6个月', 12 => '12个月', 36 => '36个月', ]; - - return $options; } public static function refundExpiryOptions() { - $options = [ + return [ 7 => '7天', 14 => '14天', 30 => '30天', 90 => '90天', 180 => '180天', ]; - - return $options; } } diff --git a/app/Models/CourseCategory.php b/app/Models/CourseCategory.php index 9d6168db..4d821002 100644 --- a/app/Models/CourseCategory.php +++ b/app/Models/CourseCategory.php @@ -31,7 +31,7 @@ class CourseCategory extends Model * * @var int */ - public $created_at; + public $create_time; public function getSource() { @@ -40,7 +40,7 @@ class CourseCategory extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } } diff --git a/app/Models/CourseFavorite.php b/app/Models/CourseFavorite.php index 29eb61a6..e1a87301 100644 --- a/app/Models/CourseFavorite.php +++ b/app/Models/CourseFavorite.php @@ -40,14 +40,14 @@ class CourseFavorite extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -68,12 +68,12 @@ class CourseFavorite extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/CoursePackage.php b/app/Models/CoursePackage.php index 08abe990..4bdb81ef 100644 --- a/app/Models/CoursePackage.php +++ b/app/Models/CoursePackage.php @@ -31,7 +31,7 @@ class CoursePackage extends Model * * @var int */ - public $created_at; + public $create_time; public function getSource() { @@ -40,7 +40,7 @@ class CoursePackage extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } } diff --git a/app/Models/CourseRelated.php b/app/Models/CourseRelated.php index a5f60636..8a06806c 100644 --- a/app/Models/CourseRelated.php +++ b/app/Models/CourseRelated.php @@ -31,7 +31,7 @@ class CourseRelated extends Model * * @var int */ - public $created_at; + public $create_time; public function getSource() { @@ -40,7 +40,7 @@ class CourseRelated extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } } diff --git a/app/Models/CourseTopic.php b/app/Models/CourseTopic.php index 4b4cab13..4bd72f62 100644 --- a/app/Models/CourseTopic.php +++ b/app/Models/CourseTopic.php @@ -31,7 +31,7 @@ class CourseTopic extends Model * * @var int */ - public $created_at; + public $create_time; public function getSource() { @@ -40,7 +40,7 @@ class CourseTopic extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } } diff --git a/app/Models/CourseUser.php b/app/Models/CourseUser.php index ce5735cb..2883e456 100644 --- a/app/Models/CourseUser.php +++ b/app/Models/CourseUser.php @@ -95,14 +95,14 @@ class CourseUser extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -123,12 +123,12 @@ class CourseUser extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } public static function roleTypes() diff --git a/app/Models/Help.php b/app/Models/Help.php index a89f966d..567caa16 100644 --- a/app/Models/Help.php +++ b/app/Models/Help.php @@ -52,14 +52,14 @@ class Help extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -68,12 +68,12 @@ class Help extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/Learning.php b/app/Models/Learning.php index a674e350..936cb753 100644 --- a/app/Models/Learning.php +++ b/app/Models/Learning.php @@ -79,14 +79,14 @@ class Learning extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -95,12 +95,12 @@ class Learning extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/Nav.php b/app/Models/Nav.php index 78cacb34..ea6d0e2b 100644 --- a/app/Models/Nav.php +++ b/app/Models/Nav.php @@ -109,14 +109,14 @@ class Nav extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -137,12 +137,12 @@ class Nav extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } public function afterCreate() diff --git a/app/Models/Order.php b/app/Models/Order.php index 429d7dfe..838f0d89 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -120,14 +120,14 @@ class Order extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -152,7 +152,7 @@ class Order extends Model $this->sn = date('YmdHis') . rand(1000, 9999); - $this->created_at = time(); + $this->create_time = time(); if (!empty($this->item_info)) { $this->item_info = kg_json_encode($this->item_info); @@ -163,7 +163,7 @@ class Order extends Model public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); if (!empty($this->item_info)) { $this->item_info = kg_json_encode($this->item_info); diff --git a/app/Models/Package.php b/app/Models/Package.php index fd67ad7d..f20904fe 100644 --- a/app/Models/Package.php +++ b/app/Models/Package.php @@ -68,14 +68,14 @@ class Package extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -96,12 +96,12 @@ class Package extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } public function afterFetch() diff --git a/app/Models/Page.php b/app/Models/Page.php index fa62592d..9c87e1cf 100644 --- a/app/Models/Page.php +++ b/app/Models/Page.php @@ -40,14 +40,14 @@ class Page extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -68,12 +68,12 @@ class Page extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/RefreshToken.php b/app/Models/RefreshToken.php index 0234c9ec..295db4ff 100644 --- a/app/Models/RefreshToken.php +++ b/app/Models/RefreshToken.php @@ -31,7 +31,21 @@ class RefreshToken extends Model * * @var int */ - public $expired_at; + public $expiry_time; + + /** + * 创建时间 + * + * @var int + */ + public $create_time; + + /** + * 更新时间 + * + * @var int + */ + public $update_time; public function getSource() { @@ -42,7 +56,14 @@ class RefreshToken extends Model { $this->id = $this->getRandId($this->user_id); - $this->expired_at = strtotime('+30 days'); + $this->expiry_time = strtotime('+30 days'); + + $this->create_time = time(); + } + + public function beforeUpdate() + { + $this->update_time = time(); } protected function getRandId($userId, $prefix = 'RT') diff --git a/app/Models/Refund.php b/app/Models/Refund.php index b5e4ae49..dae692d1 100644 --- a/app/Models/Refund.php +++ b/app/Models/Refund.php @@ -99,14 +99,14 @@ class Refund extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -131,12 +131,12 @@ class Refund extends Model $this->sn = date('YmdHis') . rand(1000, 9999); - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } public function afterFetch() diff --git a/app/Models/Review.php b/app/Models/Review.php index 927c8129..f2d6a811 100644 --- a/app/Models/Review.php +++ b/app/Models/Review.php @@ -61,14 +61,14 @@ class Review extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -89,12 +89,12 @@ class Review extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/ReviewVote.php b/app/Models/ReviewVote.php index 51d9a825..0ece47f5 100644 --- a/app/Models/ReviewVote.php +++ b/app/Models/ReviewVote.php @@ -54,7 +54,7 @@ class ReviewVote extends Model * * @var int */ - public $created_at; + public $create_time; public function getSource() { @@ -75,12 +75,12 @@ class ReviewVote extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/Role.php b/app/Models/Role.php index 50301358..6bc30885 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -75,14 +75,14 @@ class Role extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -103,7 +103,7 @@ class Role extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); if (!empty($this->routes)) { $this->routes = kg_json_encode($this->routes); @@ -112,7 +112,7 @@ class Role extends Model public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); if (!empty($this->routes)) { $this->routes = kg_json_encode($this->routes); diff --git a/app/Models/Slide.php b/app/Models/Slide.php index 1041b6b6..26d12515 100644 --- a/app/Models/Slide.php +++ b/app/Models/Slide.php @@ -83,14 +83,14 @@ class Slide extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -111,12 +111,12 @@ class Slide extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } public function afterCreate() diff --git a/app/Models/Task.php b/app/Models/Task.php index bd1bb4e6..9f89d694 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -80,14 +80,14 @@ class Task extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -98,7 +98,7 @@ class Task extends Model { $this->status = self::STATUS_PENDING; - $this->created_at = time(); + $this->create_time = time(); if (!empty($this->item_info)) { $this->item_info = kg_json_encode($this->item_info); @@ -109,7 +109,7 @@ class Task extends Model public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); if (!empty($this->item_info)) { $this->item_info = kg_json_encode($this->item_info); diff --git a/app/Models/Topic.php b/app/Models/Topic.php index 118b2f44..dab754b2 100644 --- a/app/Models/Topic.php +++ b/app/Models/Topic.php @@ -61,14 +61,14 @@ class Topic extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -89,12 +89,12 @@ class Topic extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } } diff --git a/app/Models/Trade.php b/app/Models/Trade.php index 2b3da8ba..6db424d8 100644 --- a/app/Models/Trade.php +++ b/app/Models/Trade.php @@ -96,14 +96,14 @@ class Trade extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -128,12 +128,12 @@ class Trade extends Model $this->sn = date('YmdHis') . rand(1000, 9999); - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } public function afterFetch() diff --git a/app/Models/User.php b/app/Models/User.php index 90bd40e4..095ce3f1 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -138,14 +138,14 @@ class User extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -166,12 +166,12 @@ class User extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } public function afterCreate() diff --git a/app/Models/Vip.php b/app/Models/Vip.php index 4b55db11..63555cae 100644 --- a/app/Models/Vip.php +++ b/app/Models/Vip.php @@ -47,14 +47,14 @@ class Vip extends Model * * @var int */ - public $created_at; + public $create_time; /** * 更新时间 * * @var int */ - public $updated_at; + public $update_time; public function getSource() { @@ -75,12 +75,12 @@ class Vip extends Model public function beforeCreate() { - $this->created_at = time(); + $this->create_time = time(); } public function beforeUpdate() { - $this->updated_at = time(); + $this->update_time = time(); } public function afterFetch() diff --git a/app/Repos/Audit.php b/app/Repos/Audit.php index 3c3b8cb1..8ca1d1c7 100644 --- a/app/Repos/Audit.php +++ b/app/Repos/Audit.php @@ -38,7 +38,7 @@ class Audit extends Repository if (!empty($where['start_time']) && !empty($where['end_time'])) { $startTime = strtotime($where['start_time']); $endTime = strtotime($where['end_time']); - $builder->betweenWhere('created_at', $startTime, $endTime); + $builder->betweenWhere('create_time', $startTime, $endTime); } switch ($sort) { diff --git a/app/Repos/Order.php b/app/Repos/Order.php index 49fd663b..129486a3 100644 --- a/app/Repos/Order.php +++ b/app/Repos/Order.php @@ -48,7 +48,7 @@ class Order extends Repository if (!empty($where['start_time']) && !empty($where['end_time'])) { $startTime = strtotime($where['start_time']); $endTime = strtotime($where['end_time']); - $builder->betweenWhere('created_at', $startTime, $endTime); + $builder->betweenWhere('create_time', $startTime, $endTime); } switch ($sort) { diff --git a/app/Repos/Refund.php b/app/Repos/Refund.php index 85ec6495..6edcf017 100644 --- a/app/Repos/Refund.php +++ b/app/Repos/Refund.php @@ -34,7 +34,7 @@ class Refund extends Repository if (!empty($where['start_time']) && !empty($where['end_time'])) { $startTime = strtotime($where['start_time']); $endTime = strtotime($where['end_time']); - $builder->betweenWhere('created_at', $startTime, $endTime); + $builder->betweenWhere('create_time', $startTime, $endTime); } switch ($sort) { diff --git a/app/Searchers/CourseDocument.php b/app/Searchers/CourseDocument.php index dc2dd57c..753cc019 100644 --- a/app/Searchers/CourseDocument.php +++ b/app/Searchers/CourseDocument.php @@ -53,7 +53,7 @@ class CourseDocument extends Component 'attrs' => $course->attrs, 'user_count' => $course->user_count, 'lesson_count' => $course->lesson_count, - 'created_at' => $course->created_at, + 'create_time' => $course->create_time, ]; } diff --git a/app/Services/Frontend/Chapter/CommentList.php b/app/Services/Frontend/Chapter/CommentList.php index 2d5d483d..af7d1ee8 100644 --- a/app/Services/Frontend/Chapter/CommentList.php +++ b/app/Services/Frontend/Chapter/CommentList.php @@ -86,7 +86,7 @@ class CommentList extends Service 'agree_count' => $comment['agree_count'], 'oppose_count' => $comment['oppose_count'], 'reply_count' => $comment['reply_count'], - 'created_at' => $comment['created_at'], + 'create_time' => $comment['create_time'], 'user' => $user, 'me' => $me, ]; diff --git a/app/Services/Frontend/Course/ConsultList.php b/app/Services/Frontend/Course/ConsultList.php index 3230caa2..1217fc34 100644 --- a/app/Services/Frontend/Course/ConsultList.php +++ b/app/Services/Frontend/Course/ConsultList.php @@ -84,7 +84,7 @@ class ConsultList extends Service 'answer' => $consult['answer'], 'agree_count' => $consult['agree_count'], 'oppose_count' => $consult['oppose_count'], - 'created_at' => $consult['created_at'], + 'create_time' => $consult['create_time'], 'user' => $user, 'me' => $me, ]; diff --git a/app/Services/Frontend/Course/ReviewList.php b/app/Services/Frontend/Course/ReviewList.php index cb8ba96d..e735e389 100644 --- a/app/Services/Frontend/Course/ReviewList.php +++ b/app/Services/Frontend/Course/ReviewList.php @@ -83,7 +83,7 @@ class ReviewList extends Service 'content' => $review['content'], 'agree_count' => $review['agree_count'], 'oppose_count' => $review['oppose_count'], - 'created_at' => $review['created_at'], + 'create_time' => $review['create_time'], 'user' => $user, 'me' => $me, ]; diff --git a/app/Services/Frontend/My/ConsultList.php b/app/Services/Frontend/My/ConsultList.php index 307d4ba4..e960d60a 100644 --- a/app/Services/Frontend/My/ConsultList.php +++ b/app/Services/Frontend/My/ConsultList.php @@ -59,7 +59,7 @@ class ConsultList extends Service 'answer' => $consult['answer'], 'agree_count' => $consult['agree_count'], 'oppose_count' => $consult['oppose_count'], - 'created_at' => $consult['created_at'], + 'create_time' => $consult['create_time'], 'course' => $course, ]; } diff --git a/app/Services/Frontend/My/OrderList.php b/app/Services/Frontend/My/OrderList.php index 60b9ce79..d46baf4c 100644 --- a/app/Services/Frontend/My/OrderList.php +++ b/app/Services/Frontend/My/OrderList.php @@ -60,7 +60,7 @@ class OrderList extends Service 'item_info' => $order['item_info'], 'source_type' => $order['source_type'], 'status' => $order['status'], - 'created_at' => $order['created_at'], + 'create_time' => $order['create_time'], ]; } diff --git a/app/Services/Frontend/My/RefundList.php b/app/Services/Frontend/My/RefundList.php index aac59951..9d427733 100644 --- a/app/Services/Frontend/My/RefundList.php +++ b/app/Services/Frontend/My/RefundList.php @@ -60,7 +60,7 @@ class RefundList extends Service 'status' => $refund['status'], 'apply_note' => $refund['apply_note'], 'review_note' => $refund['review_note'], - 'created_at' => (int)$refund['created_at'], + 'create_time' => (int)$refund['create_time'], ]; } diff --git a/app/Services/Frontend/Order/OrderCreate.php b/app/Services/Frontend/Order/OrderCreate.php index 3b7d4aa4..d1a1da36 100644 --- a/app/Services/Frontend/Order/OrderCreate.php +++ b/app/Services/Frontend/Order/OrderCreate.php @@ -42,7 +42,7 @@ class OrderCreate extends Service if ($order) { $caseA = $order->status == OrderModel::STATUS_PENDING; - $caseB = time() - $order->created_at < 6 * 3600; + $caseB = time() - $order->create_time < 6 * 3600; if ($caseA && $caseB) { return $order; diff --git a/app/Services/Frontend/Order/OrderInfo.php b/app/Services/Frontend/Order/OrderInfo.php index 89e670fe..1ddb6b39 100644 --- a/app/Services/Frontend/Order/OrderInfo.php +++ b/app/Services/Frontend/Order/OrderInfo.php @@ -36,7 +36,7 @@ class OrderInfo extends Service 'item_id' => $order->item_id, 'item_type' => $order->item_type, 'item_info' => $order->item_info, - 'created_at' => $order->created_at, + 'create_time' => $order->create_time, ]; return $result; diff --git a/app/Services/Refund.php b/app/Services/Refund.php index 54889bae..ac16fd0c 100644 --- a/app/Services/Refund.php +++ b/app/Services/Refund.php @@ -46,7 +46,7 @@ class Refund extends Service $userId = $order->user_id; $amount = $order->amount; - $expireTime = strtotime("+{$course['expiry']} days", $order->created_at); + $expireTime = strtotime("+{$course['expiry']} days", $order->create_time); $refundAmount = 0.00; @@ -87,7 +87,7 @@ class Refund extends Service */ foreach ($courses as $course) { - $expireTime = strtotime("+{$course['expiry']} days", $order->created_at); + $expireTime = strtotime("+{$course['expiry']} days", $order->create_time); if ($expireTime > time()) { $pricePercent = round($course['market_price'] / $totalMarketPrice, 4);