Commit 443545ed authored by hujun's avatar hujun

公告

parent 825d21a5
......@@ -62,9 +62,12 @@ class Notice extends Basic
$where['a.type'] = 1;
$data['list'] = $this->m_push->getListAgent($pageNo, $pageSize, 'id DESC', $field, $where);
$m_file = new SFile();
foreach ($data['list'] as $k => $v){
//dump($v);
$data['list'][$k]['annex_file_path'] = CURRENT_URL . 'static/business_school_file/' . $v['annex_file_name'];;
$file_data = $m_file->getFileList('id,file_name', ['new_id'=>$v['id'], 'type'=>1]);
foreach ($file_data as $k2=>$v2) {
$data['list'][$k]['annex_file_path'][] = CURRENT_URL . 'static/business_school_file/' . $v2['annex_file_name'];;
}
}
$data['total'] = $this->m_push->getListAgentTotal($where);
return $this->response(200, "", $data);
......@@ -93,7 +96,7 @@ class Notice extends Basic
$data['annex_file_name'] = $this->params['annex_file_name'];
$id = $this->m_push->addData($data);
if ($id < 1) {
if ($id > 0) {
if ($this->params['annex_file_name']) {
$s_file = new SFile();
$annex_file_name = explode(',', $this->params['annex_file_name']);
......@@ -106,13 +109,13 @@ class Notice extends Basic
$s_file->insertData($file_data);
}
}
} else {
return $this->response(101, '新增公告失败!');
}
$service_push = new PushMessageService();
$url = 'app/dist/index.html#/announcementDetails?id='.$this->m_push->id;
$this->m_push->editData(['link'=> CURRENT_URL . $url], $this->m_push->id);
$url = 'app/dist/index.html#/announcementDetails?id='.$id;
$this->m_push->editData(['link'=> CURRENT_URL . $url], $id);
$service_push->pushAll($data['title'], '点击查看公告内容', $url);
return $this->response(200, '新增成功!');
......@@ -132,6 +135,8 @@ class Notice extends Basic
}
$data = $this->m_push->getFeedInfo('id,content,title');
$m_sile = new SFile();
$data['annex_file_name'] = $m_sile->getFileList('id,file_name');
return $this->response(200, "", $data);
}
......
......@@ -59,4 +59,21 @@ class SFile extends BaseModel
return 0;
}
}
/**
* @param string $field
* @param string $params
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getFileList($field = '', $params = '', $order = 'id ASC')
{
return $this->field($field)
->where($params)
->order($order)
->select();
}
}
\ No newline at end of file
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