|
|
@ -57,13 +57,12 @@ class EcloudController < ApplicationController
|
|
|
|
ecloud_id = 0
|
|
|
|
ecloud_id = 0
|
|
|
|
if params['opttype'] == 0 # 开通企业/个人业务
|
|
|
|
if params['opttype'] == 0 # 开通企业/个人业务
|
|
|
|
ecloud = Ecloud.create!(eloud_params)
|
|
|
|
ecloud = Ecloud.create!(eloud_params)
|
|
|
|
ecloud_id = ecloud.try(:id)
|
|
|
|
create_service(params['services'], ecloud_id, params['productcode'])
|
|
|
|
elsif params['opttype'] == 2 # 试用转商用 # 变更企业/个人业务
|
|
|
|
elsif params['opttype'] == 2 # 试用转商用 # 变更企业/个人业务
|
|
|
|
# 业务列表:注销业务(注销试用的套餐),另一个业务项的操作代码是:新增业务(开通商用的套餐)
|
|
|
|
# 业务列表:注销业务(注销试用的套餐),另一个业务项的操作代码是:新增业务(开通商用的套餐)
|
|
|
|
# 需要通过产品服务编号和业务编码来区分哪个产品
|
|
|
|
# 需要通过产品服务编号和业务编码来区分哪个产品
|
|
|
|
ecloud = Ecloud.where(productcode: params['productcode'], trial: true).first
|
|
|
|
ecloud = Ecloud.where(productcode: params['productcode'], trial: true).first
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 注销试用的套餐
|
|
|
|
# 注销试用的套餐
|
|
|
|
## 需要注销的套餐; 试用转商用是不会有批量操作的,所以可以使用first
|
|
|
|
## 需要注销的套餐; 试用转商用是不会有批量操作的,所以可以使用first
|
|
|
|
des_service = params['services'].select{|s| s['opttype'] == 1}.first
|
|
|
|
des_service = params['services'].select{|s| s['opttype'] == 1}.first
|
|
|
@ -77,12 +76,19 @@ class EcloudController < ApplicationController
|
|
|
|
create_service(add_servide, ecloud_id)
|
|
|
|
create_service(add_servide, ecloud_id)
|
|
|
|
|
|
|
|
|
|
|
|
elsif params['opttype'] == 1 # 业务变更
|
|
|
|
elsif params['opttype'] == 1 # 业务变更
|
|
|
|
ecloud = Ecloud.where(bossorderid: params['bossorderid']).first
|
|
|
|
# 套餐变更
|
|
|
|
ecloud.update_attributes!(eloud_params)
|
|
|
|
params['services'].each do |service|
|
|
|
|
ecloud.ecloud_productparas.destroy
|
|
|
|
|
|
|
|
ecloud.ecloud_services.destroy
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
ecloud_id = ecloud.try(:id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ecloud = Ecloud.where(bossorderid: params['bossorderid']).first
|
|
|
|
|
|
|
|
# ecloud.update_attributes!(eloud_params)
|
|
|
|
|
|
|
|
# ecloud.ecloud_productparas.destroy
|
|
|
|
|
|
|
|
# ecloud.ecloud_services.destroy
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# ecloud_id = ecloud.try(:id)
|
|
|
|
|
|
|
|
|
|
|
|
elsif params['opttype'] == 4 # 再次重复开通
|
|
|
|
elsif params['opttype'] == 4 # 再次重复开通
|
|
|
|
REDO
|
|
|
|
REDO
|
|
|
@ -271,9 +277,11 @@ class EcloudController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# 新增套餐
|
|
|
|
# 新增套餐
|
|
|
|
def create_service service, ecloud_id
|
|
|
|
def create_service services, ecloud_id, productcode
|
|
|
|
EcloudService.create(opttype: service['opttype'], code: service['code'], begintime: service['begintime'],
|
|
|
|
services.each do |service|
|
|
|
|
endtime: service['endtime'], ecloud_id: ecloud_id)
|
|
|
|
EcloudService.create!(opttype: service['opttype'], code: service['code'], begintime: service['begintime'],
|
|
|
|
|
|
|
|
endtime: service['endtime'], ecloud_id: ecloud_id, productcode: productcode)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def check_sign
|
|
|
|
def check_sign
|
|
|
|