| 123456789101112131415161718192021222324252627282930313233343536373839 | <?phpnamespace app\api\controller\v1;use app\api\controller\Base;use app\hander\HelpHander;use think\App;use think\Db;use think\exception\Handle;class ArticleRecordAnswer extends Base{    public function __construct(App $app = null) {        parent::__construct($app);    }    public function answerSheet()    {        $recordId=input('recordId');        $ret=Db::name('article_record_answer')            ->field('article_record_id,article_question_id,answer as user_answer')            ->where('article_record_id',$recordId)           ->select();        foreach ($ret as $k=>$val){            $question=Db::name('article_question')                ->field('article_paper_id,options,score,title,type')                ->where('id',$val['article_question_id'])              ->find();            $ret[$k]['article_paper_id']=$question?$question['article_paper_id']:'';            $ret[$k]['options']=$question?$question['options']:'';            $ret[$k]['score']=$question?$question['score']:'';            $ret[$k]['title']=$question?$question['title']:'';            $ret[$k]['type']=$question?$question['type']:'';        }        if($ret){            HelpHander::success($ret);        }else{            HelpHander::error('暂无数据');        }    }}
 |