$sjId, 'label'=>$label ]; $res = self::getByCondition($where); if(empty($res)){ //写入一条 $data = $where; $data['sourceId'] = ''; self::add($data); return ''; } return $res['sourceId']; } public static function updateSourceId($sjId,$sourceId,$label ='dada') { $where = [ 'sJid'=>$sjId, 'label'=>$label ]; self::getSourceId($sjId,$label); self::updateByCondition($where,['sourceId'=>$sourceId]); return true; } }