|
|
@ -5,6 +5,7 @@ require 'digest'
|
|
|
|
class EcloudController < ApplicationController
|
|
|
|
class EcloudController < ApplicationController
|
|
|
|
skip_before_filter :verify_authenticity_token
|
|
|
|
skip_before_filter :verify_authenticity_token
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before_filter check_sign
|
|
|
|
before_filter :user_setup
|
|
|
|
before_filter :user_setup
|
|
|
|
before_filter :require_login, only: [:authorize]
|
|
|
|
before_filter :require_login, only: [:authorize]
|
|
|
|
|
|
|
|
|
|
|
@ -35,31 +36,44 @@ class EcloudController < ApplicationController
|
|
|
|
# 企业开通
|
|
|
|
# 企业开通
|
|
|
|
# ecordercode 唯一标志一个企业的订购关系
|
|
|
|
# ecordercode 唯一标志一个企业的订购关系
|
|
|
|
def bs_new
|
|
|
|
def bs_new
|
|
|
|
begin
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
ecloud = Ecloud.create!(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'],
|
|
|
|
begin
|
|
|
|
trial: params['trial'], bossorderid: params['bossorderid'], custid: params['custid'],
|
|
|
|
ecloud = Ecloud.create!(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'],
|
|
|
|
custcode: params['custcode'], registersource: params['registersource'], custname: params['custname'],
|
|
|
|
trial: params['trial'], bossorderid: params['bossorderid'], custid: params['custid'], custtype: params['custtype'],
|
|
|
|
userid: params['userid'], username: params['username'], useralias: params['useralias'], mobile: params['mobile'],
|
|
|
|
custcode: params['custcode'], registersource: params['registersource'], custname: params['custname'],
|
|
|
|
email: params['email'], productcode: params['productcode'], begintime: params['begintime'],
|
|
|
|
userid: params['userid'], username: params['username'], useralias: params['useralias'], mobile: params['mobile'],
|
|
|
|
endtime: params['endtime'])
|
|
|
|
email: params['email'], productcode: params['productcode'], begintime: params['begintime'],
|
|
|
|
EcloudService.create(opttype: params['services']['opttype'], code: params['services']['code'], begintime: params['services']['begintime'],
|
|
|
|
endtime: params['endtime'])
|
|
|
|
endtime: params['services']['endtime'], ecloud_id: ecloud.try(:id))
|
|
|
|
services = params['services'].first
|
|
|
|
|
|
|
|
EcloudService.create(opttype: services['opttype'], code: services['code'], begintime: services['begintime'],
|
|
|
|
render :json => {result: true, errmsg: ""}
|
|
|
|
endtime: services['endtime'], ecloud_id: ecloud.try(:id))
|
|
|
|
rescue Exception => e
|
|
|
|
|
|
|
|
logger.error(e.message)
|
|
|
|
render :json => {result: true, errmsg: ""}
|
|
|
|
render :json => {code: 500, msg: "#{e.message}"}
|
|
|
|
rescue Exception => e
|
|
|
|
|
|
|
|
logger.error(e.message)
|
|
|
|
|
|
|
|
render :json => {code: 500, msg: "#{e.message}"}
|
|
|
|
|
|
|
|
raise ActiveRecord::Rollback
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# 企业更新
|
|
|
|
# 企业更新
|
|
|
|
def bs_update
|
|
|
|
def bs_update
|
|
|
|
ecloud = Ecloud.where(custid: params['custid']).first
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
ecloud.update_attribute(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'],
|
|
|
|
begin
|
|
|
|
custid: params['custid'], custcode: params['custcode'], productcode: params['productcode'],
|
|
|
|
ecloud = Ecloud.where(custid: params['custid']).first
|
|
|
|
operatime: params['operatime'], effecttime: params['effecttime'])
|
|
|
|
ecloud.update_attribute(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'],
|
|
|
|
ecloud.ecloud_services.update_attributes(packagecode: params['services']['packagecode'], bossorderid: params['services']['bossorderid'])
|
|
|
|
custid: params['custid'], custcode: params['custcode'], productcode: params['productcode'],
|
|
|
|
|
|
|
|
operatime: params['operatime'], effecttime: params['effecttime'])
|
|
|
|
|
|
|
|
services = params['ervices'].first
|
|
|
|
|
|
|
|
ecloud.ecloud_services.update_attributes(packagecode: services['packagecode'], bossorderid: services['bossorderid'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
|
|
|
logger.error(e.message)
|
|
|
|
|
|
|
|
render :json => {code: 500, msg: "#{e.message}"}
|
|
|
|
|
|
|
|
raise ActiveRecord::Rollback
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# 用户业务开通接口
|
|
|
|
# 用户业务开通接口
|
|
|
@ -171,7 +185,10 @@ class EcloudController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
private
|
|
|
|
def ecloudeuser_params
|
|
|
|
def check_sign
|
|
|
|
{}
|
|
|
|
public_key = '1022'
|
|
|
|
|
|
|
|
secret_key = '2112037a-6d7a-432b-9081-feb1153d8668'
|
|
|
|
|
|
|
|
timestamp = params['timestamp']
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|