业务状态变更

dev_shixuns
huang 6 years ago
parent 43c4b784ea
commit e1558fbd07

@ -117,27 +117,6 @@ class EcloudController < ApplicationController
create_product_params(params['productparas'], ecloud.try(:id)) if params['productparas'].present?
end
# # 业务列表
# services = params['services']
# if services.present?
# services.each do |service|
# es = EcloudService.create(opttype: service['opttype'], code: service['code'], begintime: service['begintime'],
# endtime: service['endtime'], ecloud_id: ecloud_id)
# if service['serviceparas'].present?
# service['serviceparas'].each do |servicepara|
# EcloudServieceServicepara.create!(ecloud_service_id: es.id, key: servicepara['key'], value: servicepara['value'])
# end
# end
# end
# end
# # 应用开通参数
# productparas = params['productparas']
# if productparas.present?
# productparas.each do |productpara|
# EcloudProductpara.create!(key: productpara['key'], value: productpara['value'], ecloud_id: ecloud_id)
# end
# end
#
# # 非试用情况下,为管理员单独创建一条账号,企业账号
# unless params['trial']
@ -156,17 +135,24 @@ class EcloudController < ApplicationController
end
# 企业/个人业务变更、注销
# 处理业务平台退订、暂停(欠费暂停,信控暂停等)、暂停后恢复应用业务
# 这个接口是不会新增业务的
# 试用退订的时候bossorderid传空字符
def bs_update
ActiveRecord::Base.transaction do
begin
ecloud = Ecloud.where(custid: params['custid'], custcode: params['custcode']).first
ecloud.update_attributes!(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'],
custid: params['custid'], custcode: params['custcode'], productcode: params['productcode'],
operatime: params['operatime'], effecttime: params['effecttime'])
services = params['services'].first
ecloud.ecloud_service.update_attributes!(packagecode: services['packagecode'], bossorderid: services['bossorderid'])
#
if params['bossorderid'].present?
ecloud = Ecloud.where(bossorderid: params['bossorderid']).first
ecloud.update_attribute(:opttype, params['opttype'])
else
# 试用退订
params['services'].each do |service|
ecloud_id = EcloudService.where(code: service['packagecode']).first.try(:ecloud_id)
Ecloud.find(ecloud_id).update_attribute(:opttype, params['opttype'])
end
end
render :json => {result: true, errmsg: ""}
rescue Exception => e
logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"}

Loading…
Cancel
Save