fix error

This commit is contained in:
邱博亞 2023-05-08 23:45:15 +08:00
parent 6bf0bfd6bd
commit dcbe1f2f2f
1 changed files with 10 additions and 1 deletions

View File

@ -59,7 +59,12 @@ class Admin::RegisterApiController < ApplicationController
def re_register_url def re_register_url
site_token = params[:store_token] site_token = params[:store_token]
send_token = false
site = RegisteredSite.find_by(:uid => site_token) rescue nil site = RegisteredSite.find_by(:uid => site_token) rescue nil
if site.nil? && site_token.blank?
send_token = true
site = RegisteredSite.find_by(:site_domain => params[:site_domain]) rescue nil
end
if !site.nil? if !site.nil?
site.site_domain = params[:site_domain] site.site_domain = params[:site_domain]
site.save site.save
@ -77,7 +82,11 @@ class Admin::RegisterApiController < ApplicationController
end end
{title: v.title,content: v.content,see_more_link: v.see_more_link} {title: v.title,content: v.content,see_more_link: v.see_more_link}
end end
if send_token
render :json => {"success" => true, 'site_anncs'=>site_anncs, 'store_token' => site_token}.to_json
else
render :json => {"success" => true, 'site_anncs'=>site_anncs}.to_json render :json => {"success" => true, 'site_anncs'=>site_anncs}.to_json
end
else else
render :json => {"success" => false}.to_json render :json => {"success" => false}.to_json
end end