示例#1
0
 public function add($message, $target)
 {
     if ($this->seqId >= 5000) {
         throw new Exception("Can not add over 5000 message once! Please call submit() first.");
     } else {
         $this->seqId += 1;
         $innerMsg = new SingleBatchItem();
         $innerMsg->set_seqId($this->seqId);
         $innerMsg->set_data($this->createSingleJson($message, $target));
         array_push($this->innerMsgList, $innerMsg);
     }
     return $this->seqId . "";
 }
示例#2
0
文件: IGtBatch.php 项目: wy0727/getui
 /**
  * @param $message
  * @param $target
  * @return string
  * @throws \InvalidArgumentException
  */
 public function add($message, $target)
 {
     if ($this->seqId >= 5000) {
         throw new \InvalidArgumentException('Can not add over 5000 message once! Please call submit() first.');
     } else {
         ++$this->seqId;
         $innerMsg = new SingleBatchItem();
         $innerMsg->setSeqId($this->seqId);
         $innerMsg->setData($this->createSingleJson($message, $target));
         $this->innerMsgList[] = $innerMsg;
     }
     return $this->seqId . '';
 }