startTrans(); try{ // C('TOKEN_ON', false); foreach($ids as &$v) { $data['news_id'] = $v; $data['topic_id'] = $topic_id; $r = D('TopicFromNews')->createAdd($data); if ($r === false) { E($this->getError()); } } $this->commit(); return $r; } catch(\Think\Exception $ex){ $this->rollback(); $this->error = $ex->getMessage(); return false; } } }