<?php

namespace App\Models\Friends;

use App\Models\Model;

/**
 * App\Models\Friends\LogModel
 *
 * @property int $id
 * @property \Illuminate\Support\Carbon $created_at 创建时间
 * @property int $updated_at 更新时间
 * @property int $uid 用户
 * @property int $tuid 对某个用户
 * @property int $do 做了什么|0:相互心动;1取消心动;2=72小时活动;3好友申请;4同意好友申请;5开黑-王者荣耀;6开黑-吃鸡;7晚安
 * @property string $log 日志
 * @property int $read_at 阅读时间
 * @property array $attach 交互日志数据
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel whereAttach($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel whereDo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel whereLog($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel whereReadAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel whereTuid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel whereUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Friends\LogModel whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class LogModel extends Model
{


    protected $table = "kdgx_fpdx_friends_log_v2_17_3";

    protected $dateFormat = "U";


    protected $fillable = [
        'id',
        'uid',
        'tuid',
        'do',
        'log',
        'read_at',
        'attach',
        'recall_at'
    ];

    protected $casts = array(
        'attach' => 'array'
    );


    /**
     * 撤回消息
     */
    public function recall()
    {
        $this->recall_at = time();
        $this->save();
    }
}
