123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace App\Models\Fpdx;
- use Illuminate\Database\Eloquent\Model;
- /**
- * App\Models\Fpdx\RoomProfileModel
- *
- * @property int $id 主键
- * @property int $uid 用户id
- * @property int $room_id 房间id
- * @property int $is_into_notive 进房提醒
- * @property int $is_receive_msg 接收消息
- * @property int|null $last_pull_msg 上一条拉取的msg_id
- * @property int|null $last_clear_msg 清空的最近的msg_id
- * @property int|null $created_at 创建时间
- * @property int|null $forbid 禁止发言
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel newModelQuery()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel newQuery()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel query()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel whereCreatedAt($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel whereForbid($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel whereId($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel whereIsIntoNotive($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel whereIsReceiveMsg($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel whereLastClearMsg($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel whereLastPullMsg($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel whereRoomId($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Fpdx\RoomProfileModel whereUid($value)
- * @mixin \Eloquent
- */
- class RoomProfileModel extends Model
- {
- protected $table = 'fpdx_user_profile';
- public $timestamps = false;
- protected $primaryKey = 'id';
- protected $fillable = [
- 'id',
- 'uid',
- 'room_id',
- 'is_into_notive',
- 'is_receive_msg',
- 'last_pull_msg',
- 'last_clear_msg',
- 'forbid',
- 'created_at'
- ];
- /**
- * 获取某人某房间的设置
- * @param int $room_id
- * @param int $uid
- * @return Model
- * @deprecated
- */
- public function profile(int $room_id, int $uid)
- {
- try {
- $profile = RoomProfileModel::firstOrCreate([
- 'uid' => $uid,
- 'room_id' => $room_id
- ], ['created_at' => time()]);
- return $profile;
- } catch (\Exception $e) {
- $model = new RoomProfileModel();
- $model->fill(array(
- 'uid' => $uid,
- 'room_id' => $room_id,
- 'created_at' => time(),
- 'is_into_notive' => 1,
- 'is_receive_msg' => 1,
- 'last_pull_msg' => 0,
- 'last_clear_msg' => 0,
- 'forbid' => 0
- ));
- return $model;
- }
- }
- }
|