Commit 0cd0f550 by 冷斌

fix bug

parent 43986753
......@@ -73,6 +73,7 @@ class ExamsPaperModel extends Model
$data[$key]['exams_module_title'] = $this->getModuleTitleAttr($v['exams_module_id']);
$data[$key]['level_title'] = $this->getLevelTitle($v['level']);
$data[$key]['is_buy'] = $this->isBuy($v['exams_paper_id'], $this->mid);
$data[$key]['attach'] = '';
if ($data[$key]['is_buy'] || $v['price'] == 0) {
$data[$key]['attach'] = $this->getAttachPathByAttachId($v['attachment']);
}
......
......@@ -35,6 +35,18 @@ class TopicsModel extends Model
{
return $this->add($data);
}
protected function getAttachPathByAttachId($attachid) {
if (empty($attachid)) {
return '';
}
if ($attachInfo = model('Attach')->getAttachById($attachid)) {
return '/data/upload/' . $attachInfo['save_path'] . $attachInfo['save_name'];
} else {
return '';
}
}
/**
* 获取资讯
* @param boolean $with_plat_form 传入机构时是否同时显示平台资讯
......@@ -61,9 +73,13 @@ class TopicsModel extends Model
}else if ($type == 4) { //排序
$orders = '`re_sort` DESC';
}
var_dump(getAttachPathByAttachId(91));
die;
return $this->where($map)->order($orders)->findPage(10);
$results = $this->where($map)->order($orders)->findPage(10);
foreach ($results['data'] as $key => $result) {
if ($result['image']) {
$results['data'][$key]['cover'] = $this->getAttachPathByAttachId($result['image']);
}
}
return $results;
}
public function setTj($id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment