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