|
|
@ -33,10 +33,18 @@ class EcloudController < ApplicationController
|
|
|
|
def trustie_login
|
|
|
|
def trustie_login
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
CLIENT_ID = '1022'
|
|
|
|
# 测试环境
|
|
|
|
CLIENT_SECRET = '2112037a-6d7a-432b-9081-feb1153d8668'
|
|
|
|
# CLIENT_ID = '1022'
|
|
|
|
ROOT_URl = 'http://localhost:3000'
|
|
|
|
# CLIENT_SECRET = '2112037a-6d7a-432b-9081-feb1153d8668'
|
|
|
|
SERVER_URL = "https://221.176.54.92:9081/restful/services/"
|
|
|
|
# SERVER_URL = "https://221.176.54.92:9081/restful/services/"
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 正式环境
|
|
|
|
|
|
|
|
CLIENT_ID = '1056'
|
|
|
|
|
|
|
|
CLIENT_SECRET = '2e84256a-3de4-4713-9e02-10ee88a14592'
|
|
|
|
|
|
|
|
SERVER_URL = "https://221.176.53.130:44390/services/"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 签名
|
|
|
|
## 签名
|
|
|
|
def sign(timestamp)
|
|
|
|
def sign(timestamp)
|
|
|
@ -55,12 +63,12 @@ class EcloudController < ApplicationController
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
if params['opttype'] == 0 # 开通企业/个人业务
|
|
|
|
if params['opttype'] == 0 # 开通企业/个人业务
|
|
|
|
ecloud = Ecloud.create!(eloud_params)
|
|
|
|
ecloud = Ecloud.create!(eloud_params)
|
|
|
|
create_service(params['services'], ecloud.try(:id))
|
|
|
|
create_service(params['services'], ecloud.try(:id)) if params['services'].present?
|
|
|
|
create_product_params(params['productparas'], ecloud.try(:id)) if params['productparas'].present?
|
|
|
|
create_product_params(params['productparas'], ecloud.try(:id)) if params['productparas'].present?
|
|
|
|
# 为管理员添加一条记录
|
|
|
|
# 为管理员添加一条记录
|
|
|
|
# 开通的时候都是用户的opttype也是0
|
|
|
|
# 开通的时候都是用户的opttype也是0
|
|
|
|
# 如果管理员已经存在,则不用重复开通
|
|
|
|
# 如果管理员已经存在,则不用重复开通
|
|
|
|
euser = EcloudUser.where(id: params['userid'], custid: params['custid']).first
|
|
|
|
euser = EcloudUser.where(userid: params['userid'], custid: params['custid']).first
|
|
|
|
unless euser
|
|
|
|
unless euser
|
|
|
|
EcloudUser.create!(custid: params['custid'], opttype: params['opttype'], userid: params['userid'],
|
|
|
|
EcloudUser.create!(custid: params['custid'], opttype: params['opttype'], userid: params['userid'],
|
|
|
|
username: params['username'], useralias: params['useralias'],
|
|
|
|
username: params['username'], useralias: params['useralias'],
|
|
|
@ -88,7 +96,8 @@ class EcloudController < ApplicationController
|
|
|
|
elsif params['opttype'] == 1 # 业务变更
|
|
|
|
elsif params['opttype'] == 1 # 业务变更
|
|
|
|
ecloud = Ecloud.where(custid: params['custid'], custcode: params['custcode'], productcode: params['productcode']).first
|
|
|
|
ecloud = Ecloud.where(custid: params['custid'], custcode: params['custcode'], productcode: params['productcode']).first
|
|
|
|
# 套餐变更
|
|
|
|
# 套餐变更
|
|
|
|
# 新增业务
|
|
|
|
# 操作代码 0:新增业务,1:注销业务2:修改业务
|
|
|
|
|
|
|
|
# # 新增服务
|
|
|
|
add_service = params['services'].select{|s| s['opttype'] == 0}
|
|
|
|
add_service = params['services'].select{|s| s['opttype'] == 0}
|
|
|
|
create_service(add_service, ecloud.try(:id)) if add_service.present?
|
|
|
|
create_service(add_service, ecloud.try(:id)) if add_service.present?
|
|
|
|
|
|
|
|
|
|
|
@ -106,8 +115,8 @@ class EcloudController < ApplicationController
|
|
|
|
if edt_services.present?
|
|
|
|
if edt_services.present?
|
|
|
|
edt_services.each do |es|
|
|
|
|
edt_services.each do |es|
|
|
|
|
ese = EcloudService.where(ecloud_id: ecloud.try(:id), code: es['code']).first
|
|
|
|
ese = EcloudService.where(ecloud_id: ecloud.try(:id), code: es['code']).first
|
|
|
|
ese.update_attributes!(opttype: es['opttype'], begintime: es['begintime'], endtime: es['endtime'])
|
|
|
|
ese.update_attributes!(opttype: es['opttype'], begintime: es['begintime'], endtime: es['endtime']) if ese.present?
|
|
|
|
create_serviceparas es['serviceparas'].first, ese.id
|
|
|
|
create_serviceparas(es['serviceparas'].first, ese.id) if ese.present?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -120,6 +129,7 @@ class EcloudController < ApplicationController
|
|
|
|
# ecloud_id = ecloud.try(:id)
|
|
|
|
# ecloud_id = ecloud.try(:id)
|
|
|
|
|
|
|
|
|
|
|
|
elsif params['opttype'] == 4 # 再次重复开通
|
|
|
|
elsif params['opttype'] == 4 # 再次重复开通
|
|
|
|
|
|
|
|
# 再次申请开通,这种情况就是累加时间
|
|
|
|
ecloud = Ecloud.where(custid: params['custid'], custcode: params['custcode'], productcode: params['productcode']).first
|
|
|
|
ecloud = Ecloud.where(custid: params['custid'], custcode: params['custcode'], productcode: params['productcode']).first
|
|
|
|
create_service(params['services'], ecloud.try(:id))
|
|
|
|
create_service(params['services'], ecloud.try(:id))
|
|
|
|
create_product_params(params['productparas'], ecloud.try(:id)) if params['productparas'].present?
|
|
|
|
create_product_params(params['productparas'], ecloud.try(:id)) if params['productparas'].present?
|
|
|
|