作者 何书鹏
1 个管道 的构建 通过 耗费 4 秒

bug修改

... ... @@ -97,7 +97,15 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Analysis_video')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-analysis_video" class="form-control" name="row[analysis_video]" type="text" value="">
<div class="input-group">
<input id="c-analysis_video" class="form-control" size="50" name="row[analysis_video]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-analysis_video" class="btn btn-danger plupload" data-input-id="c-analysis_video" data-mimetype="video/mp4,video/flv,video/mp3,video/wma" data-multiple="false" data-preview-id="p-analysis_video"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-analysis_video" class="btn btn-primary fachoose" data-input-id="c-analysis_video" data-mimetype="video/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-analysis_video"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-analysis_video"></ul>
</div>
</div>
<div class="form-group">
... ...
... ... @@ -109,7 +109,15 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Analysis_video')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-analysis_video" class="form-control" name="row[analysis_video]" type="text" value="{$row.analysis_video|htmlentities}">
<div class="input-group">
<input id="c-analysis_video" class="form-control" size="50" name="row[analysis_video]" type="text" value="{$row.analysis_video|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-analysis_video" class="btn btn-danger plupload" data-input-id="c-analysis_video" data-multiple="false" data-mimetype="video/mp4,video/flv,video/mp3,video/wma" data-preview-id="p-analysis_video"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-analysis_video" class="btn btn-primary fachoose" data-input-id="c-analysis_video" data-mimetype="video/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-analysis_video"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-analysis_video"></ul>
</div>
</div>
<div class="form-group">
... ...
... ... @@ -61,6 +61,20 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">错题训练广告图:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-wrong_adver" class="form-control" size="35" name="row[wrong_adver]" type="text" value="{$row.wrong_adver}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-wrong_adver" class="btn btn-danger plupload" data-input-id="c-wrong_adver" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-wrong_adver"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-wrong_adver" class="btn btn-primary fachoose" data-input-id="c-wrong_adver" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-wrong_adver"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">通关密卷套餐说明:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-secret_spec_intro" class="form-control editor" rows="5" name="row[secret_spec_intro]" cols="50">{$row.secret_spec_intro|htmlentities}</textarea>
... ...
... ... @@ -97,7 +97,15 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Analysis_video')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-analysis_video" class="form-control" name="row[analysis_video]" type="text" value="">
<div class="input-group">
<input id="c-analysis_video" class="form-control" size="50" name="row[analysis_video]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-analysis_video" class="btn btn-danger plupload" data-input-id="c-analysis_video" data-mimetype="video/mp4,video/flv,video/mp3,video/wma" data-multiple="false" data-preview-id="p-analysis_video"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-analysis_video" class="btn btn-primary fachoose" data-input-id="c-analysis_video" data-mimetype="video/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-analysis_video"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-analysis_video"></ul>
</div>
</div>
<div class="form-group">
... ...
... ... @@ -109,7 +109,15 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Analysis_video')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-analysis_video" class="form-control" name="row[analysis_video]" type="text" value="{$row.analysis_video|htmlentities}">
<div class="input-group">
<input id="c-analysis_video" class="form-control" size="50" name="row[analysis_video]" type="text" value="{$row.analysis_video|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-analysis_video" class="btn btn-danger plupload" data-input-id="c-analysis_video" data-multiple="false" data-mimetype="video/mp4,video/flv,video/mp3,video/wma" data-preview-id="p-analysis_video"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-analysis_video" class="btn btn-primary fachoose" data-input-id="c-analysis_video" data-mimetype="video/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-analysis_video"></span>
</div>
<ul class="row list-inline plupload-preview" id="p-analysis_video"></ul>
</div>
</div>
<div class="form-group">
... ...
... ... @@ -6,7 +6,9 @@ use think\Db;
use app\common\controller\Api;
use app\mobile\model\Question;
use app\mobile\model\Simulation;
use app\mobile\model\Old;
use app\mobile\model\Everyday;
use app\mobile\model\Secret;
use app\mobile\model\QuestionAnswer;
use app\mobile\model\QuestionNote;
use app\mobile\model\QuestionWrong;
... ... @@ -211,16 +213,13 @@ class Almighty extends Api
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599032660",
"time": "1600675472",
"data": {
"total": 1, //题目总数
"list": [{ //题目列表
"id": 1, //题目ID
"title": "测定混凝土立方体抗压强度时,标准试件的尺寸是( )㎜。", //题目
"option": "[{\"name\":\"A\",\"gender\":\"100\\u00d7100\\u00d7100\"},{\"name\":\"B\",\"gender\":\"150\\u00d7150\\u00d7150\"},{\"name\":\"C\",\"gender\":\"200\\u00d7200\\u00d7200\"},{\"name\":\"D\",\"gender\":\"70.7\\u00d770.7\\u00d770.7\"}]", //题目选项
"type": "1", //题目类型:1=单选题,2=多选题,3=判断题,4=简答题
"answer": "A" //答案
}]
"analysis_video": { //解析视频
"cover": "http://qizhibang.brotop.cn/uploads/20200921/Fkp1Dv0c4dyYfVzAFBjhTuv25BNv.mp4?vframe/jpg/offset/1/w/1280/h/720", //封面图
"video": "http://qizhibang.brotop.cn/uploads/20200921/Fkp1Dv0c4dyYfVzAFBjhTuv25BNv.mp4" //视频
},
"analysis_text": "" //解析文字
}
})
*/
... ... @@ -387,23 +386,32 @@ class Almighty extends Api
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599136054",
"time": "1600678092",
"data": {
"1": {
"pan": 0, //判断题数
"banner": "http://www.enterprise.top/uploads/20200911/8894d62100f2f920ffb2f38063b63f2d.jpg", //广告图
"list": [{ // 试卷列表
"0": {
"id": 11,
"target_type": "1",
"target_id": 0,
"type": "3"
},
"pan": 1, //判断题数
"duo": 0, //多选题数
"dan": 2, //单选题数
"title": "测试每日一练", //试卷标题
"id": 1 //试卷ID(全能题库为0)
}
"dan": 0, //单选题数
"title": "《全能题库》", //试卷标题
"type": "1", //题目归属类型:1=全能题库,2=模拟试题,3=历年真题,4=每日一练,5=通关密卷
"id": 0 //试卷ID(全能题库为0)
}]
}
})
*/
public function wrongQuestion()
{
$user_id = $this->auth->id;
$banner = Db::name('mobile_config')->where('id',1)->value('wrong_adver');
$banner = !empty($banner) ? cdnurl($banner,true) : '';
$question_list = Question::alias('q')
->join('mobile_question_answer qa','q.id = qa.question_id and user_id='.$user_id,'left')
->join('mobile_question_answer qa','q.id = qa.question_id and user_id='.$this->auth->id,'left')
->where('qa.is_wrong','1')
->field('q.id,q.target_type,q.target_id,q.type')
->select();
... ... @@ -432,15 +440,21 @@ class Almighty extends Api
$v['title'] = '《全能题库》';
break;
case '2':
case '3':
$v['title'] = Simulation::where('id',$v[0]['target_id'])->value('title');
break;
case '3':
$v['title'] = Old::where('id',$v[0]['target_id'])->value('title');
break;
case '4':
$v['title'] = Everyday::where('id',$v[0]['target_id'])->value('title');
break;
case '5':
$v['title'] = Secret::where('id',$v[0]['target_id'])->value('title');
break;
}
$v['type'] = $v[0]['target_type'];
$v['id'] = $v[0]['target_id'];
}
$this->success('成功',$list);
$this->success('成功',compact('banner','list'));
}
}
\ No newline at end of file
... ...
... ... @@ -71,6 +71,7 @@ class Old extends Api
"year": 2015, //年费(单位:年)
"time": 100, //答题时间(单位:分)
"pass_score": 80, //合格分数
"satisfaction": 0, //满意度
"description": "这个还行", //试卷描述
"do_num": 10, //回答人数
"full_score": 100 //试卷分数(单位:分)
... ... @@ -84,7 +85,7 @@ class Old extends Api
$info = $this->model->get($old_id);
empty($info) && $this->error('试卷信息不存在');
$info['full_score'] = Question::where('target_id',$old_id)->sum('score');
$info = $info->visible(['id','title','year','time','pass_score','goods_degree','description','do_num'])->append(['full_score']);
$info = $info->visible(['id','title','year','time','pass_score','satisfaction','description','do_num'])->append(['full_score']);
$this->success('成功',$info);
}
... ...
... ... @@ -71,6 +71,7 @@ class Simulation extends Api
"year": 2015, //年费(单位:年)
"time": 100, //答题时间(单位:分)
"pass_score": 80, //合格分数
"satisfaction": 0, //满意度
"description": "这个还行", //试卷描述
"do_num": 10, //回答人数
"full_score": 100 //试卷分数(单位:分)
... ... @@ -84,7 +85,7 @@ class Simulation extends Api
$info = $this->model->get($simulation_id);
empty($info) && $this->error('试卷信息不存在');
$info['full_score'] = Question::where('target_id',$simulation_id)->sum('score');
$info = $info->visible(['id','title','year','time','pass_score','goods_degree','description','do_num'])->append(['full_score']);
$info = $info->visible(['id','title','year','time','pass_score','satisfaction','description','do_num'])->append(['full_score']);
$this->success('成功',$info);
}
... ...
... ... @@ -12,4 +12,37 @@ class Question extends Model
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 获取视频解析封面和地址
public function getAnalysisVideoAttr($value,$data){
if(empty($value)){
return [];
}
// 获取网络视频信息
if(preg_match("/^http(s)?:\\/\\/.+/",$value)){
return [
'cover' => request()->domain().'/assets/img/bg-middle.jpg',
'video' => $value
];
}
// 获取七牛云视频信息
$analysis_video = cdnurl($value,true);
$analysis_video_info = json_decode(file_get_contents($analysis_video.'?avinfo'),true);
return [
'cover' => $this->getCoverImagesQiniu($analysis_video,$analysis_video_info),
'video' => $analysis_video
];
}
// 获取七牛云视频的封面图
public function getCoverImagesQiniu($video_url,$video_info){
if(empty($video_info['streams'][0]['width'])) {
$width = $video_info['streams'][1]['width'];
$height = $video_info['streams'][1]['height'];
} else {
$width = $video_info['streams'][0]['width'];
$height = $video_info['streams'][0]['height'];
}
return $video_url.'?vframe/jpg/offset/1/w/'.$width.'/h/'.$height;
}
}
\ No newline at end of file
... ...
... ... @@ -1264,16 +1264,13 @@
<pre id="sample_response3">{
"code": 1,
"msg": "成功",
"time": "1599032660",
"time": "1600675472",
"data": {
"total": 1, //题目总数
"list": [{ //题目列表
"id": 1, //题目ID
"title": "测定混凝土立方体抗压强度时,标准试件的尺寸是( )㎜。", //题目
"option": "[{\"name\":\"A\",\"gender\":\"100\\u00d7100\\u00d7100\"},{\"name\":\"B\",\"gender\":\"150\\u00d7150\\u00d7150\"},{\"name\":\"C\",\"gender\":\"200\\u00d7200\\u00d7200\"},{\"name\":\"D\",\"gender\":\"70.7\\u00d770.7\\u00d770.7\"}]", //题目选项
"type": "1", //题目类型:1=单选题,2=多选题,3=判断题,4=简答题
"answer": "A" //答案
}]
"analysis_video": { //解析视频
"cover": "http://qizhibang.brotop.cn/uploads/20200921/Fkp1Dv0c4dyYfVzAFBjhTuv25BNv.mp4?vframe/jpg/offset/1/w/1280/h/720", //封面图
"video": "http://qizhibang.brotop.cn/uploads/20200921/Fkp1Dv0c4dyYfVzAFBjhTuv25BNv.mp4" //视频
},
"analysis_text": "" //解析文字
}
}</pre>
</div>
... ... @@ -2025,15 +2022,23 @@
<pre id="sample_response8">{
"code": 1,
"msg": "成功",
"time": "1599136054",
"time": "1600678092",
"data": {
"1": {
"pan": 0, //判断题数
"banner": "http://www.enterprise.top/uploads/20200911/8894d62100f2f920ffb2f38063b63f2d.jpg", //广告图
"list": [{ // 试卷列表
"0": {
"id": 11,
"target_type": "1",
"target_id": 0,
"type": "3"
},
"pan": 1, //判断题数
"duo": 0, //多选题数
"dan": 2, //单选题数
"title": "测试每日一练", //试卷标题
"id": 1 //试卷ID(全能题库为0)
}
"dan": 0, //单选题数
"title": "《全能题库》", //试卷标题
"type": "1", //题目归属类型:1=全能题库,2=模拟试题,3=历年真题,4=每日一练,5=通关密卷
"id": 0 //试卷ID(全能题库为0)
}]
}
}</pre>
</div>
... ... @@ -2261,6 +2266,7 @@
"year": 2015, //年费(单位:年)
"time": 100, //答题时间(单位:分)
"pass_score": 80, //合格分数
"satisfaction": 0, //满意度
"description": "这个还行", //试卷描述
"do_num": 10, //回答人数
"full_score": 100 //试卷分数(单位:分)
... ... @@ -3079,6 +3085,7 @@
"year": 2015, //年费(单位:年)
"time": 100, //答题时间(单位:分)
"pass_score": 80, //合格分数
"satisfaction": 0, //满意度
"description": "这个还行", //试卷描述
"do_num": 10, //回答人数
"full_score": 100 //试卷分数(单位:分)
... ... @@ -13456,7 +13463,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-09-19 19:38:02 </div>
Generated on 2020-09-21 18:05:32 </div>
<div class="col-md-6" align="right">
<a href="./" target="_blank">企智帮</a>
</div>
... ...