Commit 8a8f2af04a6f962a4a34e670b51de77b9465e349
1 parent
adaa2f81
[留言板]附件模型优化
Showing
1 changed file
with
22 additions
and
0 deletions
trunk/Message/Common/Model/AttachmentModel.class.php
@@ -55,6 +55,28 @@ class AttachmentModel extends AbstractModel | @@ -55,6 +55,28 @@ class AttachmentModel extends AbstractModel | ||
55 | return $attachment_id_arr ? implode(',',$attachment_id_arr) : ''; | 55 | return $attachment_id_arr ? implode(',',$attachment_id_arr) : ''; |
56 | } | 56 | } |
57 | 57 | ||
58 | + public function getAttachmentByMsgId($message_id) | ||
59 | + { | ||
60 | +// $attach = $this->_m->field('attachment')->find($message_id); | ||
61 | +// | ||
62 | +// print_r($attach->data()); | ||
63 | + | ||
64 | + $params = []; | ||
65 | + $wheres = []; | ||
66 | + $conds = [ | ||
67 | + 'message_id' => $message_id, | ||
68 | + ]; | ||
69 | + if (!$this->_parse_where($wheres, $params, $conds)) { | ||
70 | + return false; | ||
71 | + } | ||
72 | + | ||
73 | + $sql = "SELECT attachment | ||
74 | + FROM __TABLE__ WHERE `message_id` = ? "; | ||
75 | + $attachment = $this->_m->fetch_row($sql,$params); | ||
76 | + | ||
77 | + | ||
78 | + return isset($attachment['attachment']) ? $attachment['attachment'] : ''; | ||
79 | + } | ||
58 | 80 | ||
59 | /** | 81 | /** |
60 | * 附件删除 | 82 | * 附件删除 |