NoticeModel.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. /**
  5. * App\Models\NoticeModel
  6. *
  7. * @property int $id 主键
  8. * @property int $uid 用户id
  9. * @property string $title 标题
  10. * @property string|null $content 通知内容
  11. * @property int $type 通知类型
  12. * 1:要联系方式;
  13. * 2:投诉操作;
  14. * 3:投诉结果;
  15. * 4:被索要联系方式;
  16. * 5:系统通知;
  17. * 6:被表白;
  18. * 7:接收表白;
  19. * 8:拒绝表白
  20. * 9:审核不通过
  21. * 10:发送表白
  22. * 11:赠送小fa;
  23. * 12:被赠送小fa
  24. * @property int $type_id 通知连接对象
  25. * 1:卡片id;
  26. * 2:无;
  27. * 3:投诉记录id;
  28. * 4:索要联系方式用户的id;
  29. * 6:表白记录id;
  30. * 7:卡片id;
  31. * 8:表白记录id;
  32. * 9:卡片id;
  33. * 10:卡片id
  34. * @property \Illuminate\Support\Carbon $create_at 创建时间
  35. * @property string $cdate 创建时间
  36. * @property int $is_read 是否查看
  37. * @property \Illuminate\Support\Carbon $update_at 修改时间
  38. * @property string $tab_content 按钮文字
  39. * @property string $tab_url 按钮地址
  40. * @property string $tab_action 动作
  41. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel newModelQuery()
  42. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel newQuery()
  43. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel query()
  44. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereCdate($value)
  45. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereContent($value)
  46. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereCreateAt($value)
  47. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereId($value)
  48. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereIsRead($value)
  49. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereTabAction($value)
  50. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereTabContent($value)
  51. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereTabUrl($value)
  52. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereTitle($value)
  53. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereType($value)
  54. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereTypeId($value)
  55. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereUid($value)
  56. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\NoticeModel whereUpdateAt($value)
  57. * @mixin \Eloquent
  58. */
  59. class NoticeModel extends Model
  60. {
  61. protected $connection = "mysql_fenpeiduixiang";
  62. protected $table = "kdgx_partner_charge_notive";
  63. protected $dateFormat = 'U';
  64. public const CREATED_AT = 'create_at';
  65. public const UPDATED_AT = 'update_at';
  66. public $fillable = [
  67. 'uid',
  68. 'title',
  69. 'content',
  70. 'type',
  71. 'cdate',
  72. 'type_id',
  73. 'is_read',
  74. 'tab_content',
  75. 'tab_url',
  76. 'tab_action'
  77. ];
  78. /**
  79. * 加入系统通知
  80. * @param $uid 通知用户
  81. * @param $type 通知类型
  82. * @param $title 通知标题
  83. * @param $content 通知内容
  84. * @param $type_data 附加数据
  85. */
  86. public function joinSysNotice($uid, $type, $title, $content, $type_data)
  87. {
  88. $this->fill([
  89. 'uid' => $uid,
  90. 'type' => $type,
  91. 'title' => $title,
  92. 'content' => $content,
  93. 'type_id' => $type_data,
  94. ]);
  95. $this->save();
  96. }
  97. public static function boot()
  98. {
  99. parent::boot();
  100. self::saving(function ($model) {
  101. $model->cdate = date('Y-m-d');
  102. });
  103. }
  104. }