Example #1
0
 /**
  * 结算发送合体奖励邮件
  *
  * @access public
  * @param 无
  * @return JsonView 响应json
  */
 public function sendFitMail($user_id, $friend_id)
 {
     $user_name = UserCache::getByKey($user_id, "s_name");
     if (!$friend_id) {
         $userInfo = MailModel::getUserInfo($user_id);
         $user_name = $userInfo['s_name'];
     }
     $type = Constants::FIT_REWARD_TYPE;
     $coin = Constants::FIT_REWARD_NUM;
     $str = "你的好友" . $user_name . "邀你助战,你获得人生果" . $coin;
     $res = MailModel::insert(array('n_send_id' => $user_id, 'n_receive_id' => $friend_id, 's_message' => $str, 'n_item_type' => $type, 'n_item_num' => $coin, 'n_type' => 1, 't_update_time' => date("Y-m-d H:i:s"), 't_create_time' => date("Y-m-d H:i:s")));
 }
 public function saveMailAction()
 {
     //      Load cac model can thiet
     Zend_Loader::loadClass('MailModel');
     $model = new MailModel();
     $params = $this->_arrParam;
     if ($this->_request->isPost()) {
         if (!empty($params['mail'])) {
             try {
                 $result = $model->check($params['mail']);
                 if (!$result) {
                     $model->insert(array("mail" => $params['mail']));
                 }
             } catch (exception $e) {
                 $data = array("code" => 0, "content" => "Error in server");
             }
         } else {
             $data = array("code" => 0, "content" => "Invalid parameters");
         }
         echo json_encode($data);
     }
     exit;
 }