完成业务退订

dev_shixuns
huang 6 years ago
parent e1558fbd07
commit 4cf4655b26

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

Loading…
Cancel
Save