ExaminationTestRecord.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\merchant\model\questions;
  12. use traits\ModelTrait;
  13. use basic\ModelBasic;
  14. /**
  15. * 考试试题记录 Model
  16. * Class ExaminationTestRecord
  17. */
  18. class ExaminationTestRecord extends ModelBasic
  19. {
  20. use ModelTrait;
  21. /**获取答题情况
  22. * @param $questions_id
  23. */
  24. public static function testRecord($questions_id)
  25. {
  26. $data['wrong'] = self::where(['questions_id' => $questions_id, 'is_correct' => 1])->count();
  27. $data['yes'] = self::where(['questions_id' => $questions_id, 'is_correct' => 2])->count();
  28. $data['total'] = bcadd($data['wrong'], $data['yes'], 0);
  29. return $data;
  30. }
  31. }