protected function addOrderConversation($sender) { $sn = trim($this->_getParam('sn')); $message = trim($this->_getParam('message')); $commonPhraseId = intval(trim($this->_getParam('commonPhraseId'))); $imageUrl = $this->_getParam('imageUrl'); if ($commonPhraseId) { $mcp = new Model_CommonPhrase($commonPhraseId); $zh = $mcp->get('zh'); $en = $mcp->get('en'); if ($sender == Model_OrderConversation::SENDER_DRIVER) { $message = "{$zh} ({$en})"; } else { $message = "{$en} ({$zh})"; } } $oc = new Model_OrderConversation(); $oc->set('sn', $sn); $oc->set('sender', $sender); $oc->set('message', $message); $oc->set('image_url', $imageUrl); $oc->set('created_time', time()); $oc->save(); $this->sendPush($sender, $sn, $message); }
public function addOrderConversationAction() { $sn = trim($this->_getParam('sn')); $message = trim($this->_getParam('message')); $imageUrl = $this->_getParam('imageUrl'); $oc = new Model_OrderConversation(); $oc->set('sn', $sn); $oc->set('sender', Model_OrderConversation::SENDER_CS); $oc->set('message', $message); $oc->set('image_url', $imageUrl); $oc->set('created_time', time()); $oc->save(); $arp = new AjaxResponse(); $arp->setStatus(AjaxResponse::STATUS_OK); $this->json($arp); $c = new ApiControllerAbstract(); $c->sendPush(Model_OrderConversation::SENDER_CS, $sn, $message); }