|
|
|
@ -141,15 +141,22 @@ class EcloudController < ApplicationController
|
|
|
|
|
def bs_update
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
begin
|
|
|
|
|
#
|
|
|
|
|
case params['opttype']
|
|
|
|
|
when 0 # 退订
|
|
|
|
|
opttype = 6
|
|
|
|
|
when 1 # 暂停
|
|
|
|
|
opttype = 7
|
|
|
|
|
when 2 # 恢复
|
|
|
|
|
opttype = 8
|
|
|
|
|
end
|
|
|
|
|
if params['bossorderid'].present?
|
|
|
|
|
ecloud = Ecloud.where(bossorderid: params['bossorderid']).first
|
|
|
|
|
ecloud.update_attribute(:opttype, params['opttype'])
|
|
|
|
|
ecloud.update_attribute(:opttype, 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'])
|
|
|
|
|
Ecloud.find(ecloud_id).update_attribute(:opttype, opttype)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
render :json => {result: true, errmsg: ""}
|
|
|
|
|