| xqd
@@ -336,11 +336,14 @@ class Studyplan extends AuthController{
|
|
|
$this->failed('课程尚未购买,非法访问', Url::build('index/index'));
|
|
|
}
|
|
|
//查询是否关联证书
|
|
|
- $certinfo = CertificateRelated::where(['related' => $plan_id, 'obtain' => 3, 'is_show' => 1])->find();
|
|
|
+ $join = [
|
|
|
+ ['certificate c', 'c.id = cr.cid and c.is_del = 0'],
|
|
|
+ ];
|
|
|
+ $certinfo = CertificateRelated::alias('cr')->field('cr.*, c.xuefen')->join($join)->where(['cr.related' => $plan_id, 'cr.obtain' => 3, 'cr.is_show' => 1])->find();
|
|
|
if (!$certinfo) $this->failed('该学习计划未绑定证书');
|
|
|
//查询是否以获得证书
|
|
|
- $certinfo = CertificateRecord::where(['source_id' => $plan_id, 'obtain' => 3, 'status' => 1, 'uid' => $this->uid])->find();
|
|
|
- if ($certinfo) $this->failed('学习计划证书已获取完成');
|
|
|
+ $certinfo1 = CertificateRecord::where(['source_id' => $plan_id, 'obtain' => 3, 'status' => 1, 'uid' => $this->uid])->find();
|
|
|
+ if ($certinfo1) $this->failed('学习计划证书已获取完成');
|
|
|
|
|
|
|
|
|
$steps = PlanSteps::where('is_del', 0)->where('pid', $plan_id)->order('sort asc')->select();
|
| xqd
@@ -383,14 +386,17 @@ class Studyplan extends AuthController{
|
|
|
|
|
|
|
|
|
$nowspid = 0;
|
|
|
+ $xuefen = 0;
|
|
|
foreach ($itemsList as $v) {
|
|
|
+ $spflag = 1;
|
|
|
foreach ($v as $v1) {
|
|
|
//判断课程是否学习完成
|
|
|
if ($tasklist[$v1['id']] && is_array($tasklist[$v1['id']])) {
|
|
|
foreach ($tasklist[$v1['id']] as $v2) {
|
|
|
- if ($v2['percentage'] < 100) {
|
|
|
+ if ($v2['percentage'] < 96) {
|
|
|
$nowspid = $v1['id'];
|
|
|
$flag = 0;
|
|
|
+ $spflag = 0;
|
|
|
break;
|
|
|
}
|
|
|
}
|
| xqd
@@ -406,12 +412,17 @@ class Studyplan extends AuthController{
|
|
|
foreach ($examlist as $item) {
|
|
|
if ($item['score'] < 60) {
|
|
|
$flag = 0;
|
|
|
+ $spflag = 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if ($nowspid) break;
|
|
|
+ if ($spflag && isset($v[0])) $xuefen = $xuefen + $v[0]['xuefen'];
|
|
|
+ }
|
|
|
+ if ($xuefen >= $certinfo['xuefen']) {
|
|
|
+ $flag = 1;
|
|
|
}
|
|
|
if ($flag) {
|
|
|
return JsonService::successful('ok');
|