123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\App;
- use think\Db;
- use think\exception\Handle;
- class ArticleRecord extends Base
- {
- public function __construct(App $app = null) {
- parent::__construct($app);
- $this->model = new \app\common\model\ArticleRecord();
- }
- //员工学习考试记录列表
- public function list(){
- $userId=$this->userId;
- $page=input("page/d",1);
- $size=input("size/d",10);
- $ret=$this->model->lists($userId,$page,$size);
- if($ret){
- HelpHander::success($ret);
- }else{
- HelpHander::error('暂无数据');
- }
- }
- //员工学习剩余考试次数
- public function paperRecordLimit(){
- $userId=$this->userId;
- $paperId=input('paperId');
- $ret=$this->model->limits($userId,$paperId);
- HelpHander::success($ret);
- }
- //员工学习提交考试答案
- public function commit(){
- $userId=$this->userId;
- $orgId=$this->orgId;
- $paperId=input('paperId');
- $json=input('json');
- if(!$json){
- HelpHander::error('参数错误');
- }
- $jsonArray=json_decode($json,true);
- $ret=$this->model->saveData($userId,$orgId,$paperId,$jsonArray);
- if($ret){
- HelpHander::success([],'添加成功');
- }else{
- HelpHander::error($this->model->getError());
- }
- }
- }
|