public static function execut_notice($foreign_table, $foreign_id, $type_key, $member_id_from, $notice_member_ids) { if (!$notice_member_ids) { return; } $obj_notice = Model_Notice::check_and_create($foreign_table, $foreign_id, Site_Util::get_notice_type($type_key)); Model_NoticeMemberFrom::check_and_create($obj_notice->id, $member_id_from); foreach ($notice_member_ids as $notice_member_id) { Site_Util::update_notice_status2unread($notice_member_id, $obj_notice->id); } }
/** * Get notice list * * @access public * @return Response (json) * @throws Exception in Controller_Base::controller_common_api * @see Controller_Base::controller_common_api */ public function get_list() { $this->controller_common_api(function () { list($limit, $page) = $this->common_get_pager_list_params(\Config::get('notice.articles.limit'), \Config::get('notice.articles.limit_max')); $data = Model_NoticeStatus::get_pager_list4member_id($this->u->id, $limit, $page); $list_array = array(); foreach ($data['list'] as $key => $obj) { $row = $obj->to_array(); $row['members_count'] = Model_NoticeMemberFrom::get_count4notice_id($row['notice_id'], $this->u->id); $row['members'] = array(); $notice_member_froms = Model_NoticeMemberFrom::get4notice_id($row['notice_id'], \Config::get('notice.noticeMemberFrom.limit'), $this->u->id); foreach ($notice_member_froms as $notice_member_from) { $row['members'][] = \Model_Member::get_one_basic4id($notice_member_from->member_id); } $row['is_read'] = (int) $row['is_read']; $list_array[] = $row; } // json response $data['list'] = $list_array; $data['is_detail'] = (bool) \Input::get('is_detail', 0); $this->set_response_body_api($data); }); }