1
0

QuestionLogic.php 859 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\logics;
  3. use app\model\QuestionCompany;
  4. use app\model\QuestionBank;
  5. class QuestionLogic
  6. {
  7. public function list($where , $page , $limit)
  8. {
  9. return QuestionCompany::where($where)->page($page , $limit)->order('addtime desc')->select();
  10. }
  11. public function count($where)
  12. {
  13. return QuestionCompany::where($where)->count();
  14. }
  15. //创建考卷
  16. public function create_question($title)
  17. {
  18. $QuestionId = QuestionBank::column('id');
  19. dump(array_rand($QuestionId , 2));exit;
  20. $data = [
  21. 'title' => $title,
  22. 'cmid' =>2,
  23. 'question_id' => '',
  24. 'score' => 100,
  25. ];
  26. return QuestionCompany::insert($data);
  27. }
  28. public function del($id)
  29. {
  30. return QuestionCompany::where('id',$id)->setField('del',1);
  31. }
  32. }