<?php if (!defined('BASEPATH'))  exit('No direct script access allowed');

/**
* @author cxf
* 消息发送类
*/


class Apply_class
{

    public function __construct()
    {

    }


    /**
     * @author cxf
     * @param $uid 用户id,
     * @param $subject 消息标题,
     * @param $msg 消息类型,
     * @param $kind 消息来源
     * 发送消息
     */
    function send_systemmsg( $uid , $subject , $msg , $kind , $city_name )
    {
        $ss = array();
        $ss['kind'] = $kind;
        $ss['subject'] = $subject;
        $ss['message'] = $msg;
        $ss['operator'] = 'system';
        $ss['creattime'] = time();
        $ss['issystem'] = 1;

        $ci = & get_instance();
        $ci->load->model('user_model');
        $newid = $ci->user_model->addannounce($ss);

        $ss = array();
        $ss['announceid'] = $newid;
        $ss['uid'] = $uid;
        $ss["new"] = 0;
        $ss["cityname"] = $city_name;

        //写入数据库
        $newid = $ci->user_model->addannounceitem($ss);

        return !empty($newid) ? '1' : '0';
    }

}