# Conflicts:
#	app/controllers/ecloud_controller.rb
dev_haigong
guange 6 years ago
commit 618fc93c80

@ -6,6 +6,7 @@ class EcloudController < ApplicationController
skip_before_filter :verify_authenticity_token skip_before_filter :verify_authenticity_token
before_filter :check_sign, only: [:ps_new, :ps_update, :bs_new, :bs_update] before_filter :check_sign, only: [:ps_new, :ps_update, :bs_new, :bs_update]
before_filter :user_setup before_filter :user_setup
# before_filter :require_login, only: [:authorize] # before_filter :require_login, only: [:authorize]
@ -13,7 +14,6 @@ class EcloudController < ApplicationController
skip_before_filter :verify_authenticity_token, only: [:ps_new, :ps_update, :bs_new, :bs_update, :ecloud_login_callback] skip_before_filter :verify_authenticity_token, only: [:ps_new, :ps_update, :bs_new, :bs_update, :ecloud_login_callback]
def index def index
render file: 'public/react-oschina/build/index.html', :layout => false render file: 'public/react-oschina/build/index.html', :layout => false
end end
@ -34,6 +34,7 @@ class EcloudController < ApplicationController
# 企业开通 # 企业开通
# applyno 申请单号,唯一
# ecordercode 唯一标志一个企业的订购关系 # ecordercode 唯一标志一个企业的订购关系
def bs_new def bs_new
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
@ -61,7 +62,7 @@ class EcloudController < ApplicationController
def bs_update def bs_update
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
ecloud = Ecloud.where(custid: params['custid']).first ecloud = Ecloud.where(applyno: params['applyno']).first
ecloud.update_attributes!(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'], ecloud.update_attributes!(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'],
custid: params['custid'], custcode: params['custcode'], productcode: params['productcode'], custid: params['custid'], custcode: params['custcode'], productcode: params['productcode'],
operatime: params['operatime'], effecttime: params['effecttime']) operatime: params['operatime'], effecttime: params['effecttime'])
@ -77,37 +78,38 @@ class EcloudController < ApplicationController
end end
end end
# 用户业务开通接口 # 用户业务开通与变更接口
def ps_new def ps_new
begin begin
user_param = params['users'].first user_param = params['users'].first
ecloud_user = EcloudUser.where(:custid => params['custid'], :userid => user_param['userid']).first # ecloud_user = EcloudUser.where(:custid => params['custid'], :userid => user_param['userid']).first
if ecloud_user.present? # if ecloud_user.present?
render :json => {code: 500, msg: "你已开通过该业务"} # render :json => {code: 500, msg: "你已开通过该业务"}
else # else
EcloudUser.create!(custid: params['custid'], opttype: user_param['opttype'], userid: user_param['userid'], EcloudUser.create!(custid: params['custid'], opttype: user_param['opttype'], userid: user_param['userid'],
username: user_param['username'], useralias: user_param['useralias'], username: user_param['username'], useralias: user_param['useralias'],
mobile: user_param['mobile'], email: user_param['email'], begintime: user_param['begintime'].to_s, mobile: user_param['mobile'], email: user_param['email'], begintime: user_param['begintime'].to_s,
endtime: user_param['endtime'].to_s) endtime: user_param['endtime'].to_s)
render :json => {success: true, errmsg: ""} render :json => {success: true, errmsg: ""}
end # end
rescue Exception => e rescue Exception => e
logger.error(e.message) logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"} render :json => {code: 500, msg: "#{e.message}"}
end end
end end
# 用户业务变更、销毁接口 # 用户业务状态变更
def ps_update def ps_update
begin begin
ecloud = Ecloud.where(applyno: params['applyno']).first
user_param = params['users'].first user_param = params['users'].first
ecloud_user = EcloudUser.where(:custid => params['custid'], :userid => user_param['userid']).first ecloud_user = ecloud.ecloud_user
if ecloud_user.present?
ecloud_user.update_attributes(opttype: user_param['opttype']) ecloud_user.update_attributes(opttype: user_param['opttype'], userid: user_param['userid'])
render :json => {success: true, errmsg: ""} render :json => {success: true, errmsg: ""}
else # else
render :json => {code: 404, msg: "企业ID不存在"} # render :json => {code: 404, msg: "企业ID不存在"}
end # end
rescue Exception => e rescue Exception => e
logger.error(e.message) logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"} render :json => {code: 500, msg: "#{e.message}"}

Loading…
Cancel
Save