PraiseModel.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Models;
  3. /**
  4. * App\Models\PraiseModel
  5. *
  6. * @property int $id 主键
  7. * @property int $partner_id 对象ID
  8. * @property int $uid 用户ID
  9. * @property int $create_at 创建时间
  10. * @property int $created_at
  11. * @property int $updated_at 更新时间
  12. * @property int $type 1喜欢/0无感
  13. * @property int $lock 解锁进度
  14. * @property int $read 是否已读
  15. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel newModelQuery()
  16. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel newQuery()
  17. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel query()
  18. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereCreateAt($value)
  19. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereCreatedAt($value)
  20. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereId($value)
  21. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereLock($value)
  22. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel wherePartnerId($value)
  23. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereRead($value)
  24. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereType($value)
  25. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereUid($value)
  26. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PraiseModel whereUpdatedAt($value)
  27. * @mixin \Eloquent
  28. */
  29. class PraiseModel extends Model
  30. {
  31. protected $table = 'kdgx_partner_charge_praise';
  32. protected $dateFormat = 'U';
  33. public $timestamps = false;
  34. protected $fillable = ['id', 'partner_id', 'uid', 'create_at', 'type', 'created_at', 'updated_at', 'lock', 'read'];
  35. public function isLike(int $uid, int $partnerId): bool
  36. {
  37. $praise = $this->where([
  38. array('uid', $uid), array('partner_id', $partnerId)
  39. ])->first();
  40. if ($praise && 1 == $praise->type) {
  41. return true;
  42. } else {
  43. return false;
  44. }
  45. }
  46. }