SmmPost.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Distributor\Repositories;
  3. use App\Models\SmmPost as Model;
  4. use Dcat\Admin\Repositories\EloquentRepository;
  5. class SmmPost extends EloquentRepository
  6. {
  7. /**
  8. * Model.
  9. *
  10. * @var string
  11. */
  12. protected $eloquentClass = Model::class;
  13. /*
  14. * 插入数据
  15. */
  16. public static function create($post,$sendTime,$imageVideoUrl)
  17. {
  18. $model = new Model();
  19. $model->send_type = $post['send_type'];
  20. $model->send_time = $sendTime;
  21. $model->message = $post['message'];
  22. $model->post_type = $post['post_type'];
  23. $model->account_ids = implode(',',$post['account_ids']);
  24. $model->image_video_url = $imageVideoUrl;
  25. $model->status = 0;
  26. $model->dist_id = getDistributorId();
  27. $model->save();
  28. return $model->id;
  29. }
  30. /*
  31. * 找出状态 0 的数据
  32. */
  33. public static function getWaitPost()
  34. {
  35. $model = new Model();
  36. $model = $model->where('status',0)->get();
  37. return $model;
  38. }
  39. public static function getPostById($id)
  40. {
  41. $model = new Model();
  42. $model = $model->where('id',$id)->first();
  43. return $model;
  44. }
  45. }