LogDetail.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for collection "log_detail".
  6. *
  7. * @property \MongoId|string $_id
  8. */
  9. class LogDetail extends \yii\mongodb\ActiveRecord
  10. {
  11. /**
  12. * @inheritdoc
  13. */
  14. public static function collectionName()
  15. {
  16. return ['local', 'log_detail'];
  17. }
  18. /**
  19. * @inheritdoc
  20. */
  21. public function attributes()
  22. {
  23. return [
  24. '_id', 'name',
  25. ];
  26. }
  27. /**
  28. * @inheritdoc
  29. */
  30. public function rules()
  31. {
  32. return [
  33. ];
  34. }
  35. /**
  36. * @inheritdoc
  37. */
  38. public function attributeLabels()
  39. {
  40. return [
  41. '_id' => 'ID',
  42. ];
  43. }
  44. public static function formatChildDetail($detail, $name = null) {
  45. $name = $name ? $name . '.' . $detail['name'] : $detail['name'];
  46. $list[$name] = [
  47. 'name' => $detail['name'],
  48. 'error' => $detail['error'],
  49. 'warning' => $detail['warning'],
  50. 'notice' => $detail['notice'],
  51. ];
  52. if (!empty($detail['child'])) {
  53. foreach ($detail['child'] as $child) {
  54. $list = array_merge($list, static::formatChildDetail($child, $name));
  55. }
  56. }
  57. return $list;
  58. }
  59. public static function incrCount() {
  60. }
  61. }