BehaviorRepositories.php 814 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: edz
  5. * Date: 2019-06-10
  6. * Time: 17:53
  7. */
  8. namespace App\Repositories;
  9. use App\Models\Behavior;
  10. use Illuminate\Support\Facades\Log;
  11. class BehaviorRepositories
  12. {
  13. public function __construct()
  14. {
  15. }
  16. /**
  17. * 获取行为绑定规则
  18. * @param $info
  19. * @return array
  20. */
  21. public function getBehavior($identify)
  22. {
  23. $info = Behavior::where([['is_open', '=', 1], ['behavior_identification', '=', $identify]])->first();
  24. Log::debug('behavior:' . json_encode($info));
  25. if ($info) {
  26. return $info;
  27. }
  28. return [];
  29. }
  30. /**
  31. * 获取所有行为
  32. */
  33. public function getAllBehavior()
  34. {
  35. return Behavior::pluck('virus_behavior_id', 'behavior_identification');
  36. }
  37. }