|
@@ -112,7 +112,7 @@ class Consult extends Controller
|
|
|
$post = $this->app->request->post();
|
|
|
if (isset($post['id']) && $post['id']) {
|
|
|
$root_consult_id = Db::name('store_consult')->where('id',$id)->value('root_consult_id');
|
|
|
- $data = array(
|
|
|
+ $consult_data = array(
|
|
|
'user_id' => session('user.engineer_id'),
|
|
|
'content' => $post['answer_content'],
|
|
|
'consult_id' => $id,
|
|
@@ -120,7 +120,16 @@ class Consult extends Controller
|
|
|
'type' => 2
|
|
|
);
|
|
|
Db::name('store_consult')->where('id',$id)->update(array('is_answer'=>1,'from_user_id'=>session('user.engineer_id')));
|
|
|
- Db::name('store_consult')->insert($data);
|
|
|
+ Db::name('store_consult')->insert($consult_data);
|
|
|
+ //添加消息通知
|
|
|
+ $user_id = Db::name('store_consult')->where('id',$id)->value('user_id');
|
|
|
+ $new_data = array(
|
|
|
+ 'user_id' => $user_id,
|
|
|
+ 'content' => '您咨询的问题得到了新的回复,赶紧快来查看~',
|
|
|
+ 'consult_id' => $root_consult_id,
|
|
|
+ 'type' => 2
|
|
|
+ );
|
|
|
+ Db::name('store_news')->insert($new_data);
|
|
|
$this->success('解答成功');
|
|
|
} else {
|
|
|
$this->_form($this->table, 'answer');
|