From 4cf4655b2652b130ac8c6446a4b3c768ec96ca1e Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 14 Mar 2019 14:46:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=B8=9A=E5=8A=A1=E9=80=80?= =?UTF-8?q?=E8=AE=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ecloud_controller.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index 97a84522..9fd4a8b8 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -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: ""}