QappPushTask.php 892 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Modules\Push\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class QappPushTask extends Model
  5. {
  6. protected $table = 'qapp_push_task';
  7. protected $fillable = ['uid', 'package_id', 'type', 'title', 'content', 'url', 'num',
  8. 'status', 'providers', 'push_time', 'push_filter', 'push_result'];
  9. /**
  10. * @param $id
  11. * @return array
  12. */
  13. public static function getPushTaskById($id): array
  14. {
  15. if (empty($id)) {
  16. return [];
  17. }
  18. $result = self::where('id', $id)->first();
  19. return $result ? $result->toArray() : [];
  20. }
  21. /**
  22. * @param $id
  23. * @param $data
  24. * @return bool
  25. */
  26. public static function updatePushTask($id, $data): bool
  27. {
  28. if (empty($id) || empty($data)) {
  29. return false;
  30. }
  31. return self::where('id', $id)->update($data);
  32. }
  33. }