From 29a0b03397483f28c72ba8304f7b882f9151c182 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 14 Mar 2019 15:49:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=94=A8=E6=88=B7=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ecloud_controller.rb | 19 ++++++++++++------- ...90314065601_add_applyno_to_ecloud_users.rb | 7 ------- ...314073723_add_operatime_to_ecloud_users.rb | 6 ++++++ 3 files changed, 18 insertions(+), 14 deletions(-) delete mode 100644 db/migrate/20190314065601_add_applyno_to_ecloud_users.rb create mode 100644 db/migrate/20190314073723_add_operatime_to_ecloud_users.rb diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index 49f28076..c732a954 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -170,7 +170,7 @@ class EcloudController < ApplicationController # 用户业务开通与变更接口 # 授权statu为1,取消授权status为0 - # opttype: 操作类型0:开通;1:变更; + # user['opttype']: 操作类型0:开通;1:变更;3: 取消授权;4:暂停;5:恢复; def ps_new ActiveRecord::Base.transaction do @@ -201,19 +201,24 @@ class EcloudController < ApplicationController end # 用户业务状态变更 - # 授权statu为1,取消授权status为0 + # user['opttype']: 操作类型0:开通;1:变更;3: 取消授权;4:暂停;5:恢复; def ps_update begin user_params = params['users'] user_params.each do |user_param| - ecloud_user = EcloudUser.where(userid: user_param['userid'], status: 1).first - ecloud_user.update_attributes(opttype: user_param['opttype'], userid: user_param['userid'], status: 0) + case user_param['opttype'] + when 0 # 取消授权 + opttype = 3 + when 1 # 暂停 + opttype = 4 + when 2 # 恢复 + opttype = 5 + end + ecloud_user = EcloudUser.where(custid: params['custid'], userid: user_param['userid']).first + ecloud_user.update_attributes!(opttype: opttype, operatime: params['operatime'], effecttime: params['effecttime']) end render :json => {success: true, errmsg: ""} - # else - # render :json => {code: 404, msg: "企业ID不存在"} - # end rescue Exception => e logger.error(e.message) render :json => {code: 500, msg: "#{e.message}"} diff --git a/db/migrate/20190314065601_add_applyno_to_ecloud_users.rb b/db/migrate/20190314065601_add_applyno_to_ecloud_users.rb deleted file mode 100644 index 6824c9a4..00000000 --- a/db/migrate/20190314065601_add_applyno_to_ecloud_users.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddApplynoToEcloudUsers < ActiveRecord::Migration - def change - add_column :ecloud_users, :applyno, :string - add_column :ecloud_users, :ecordercode, :string - add_column :ecloud_users, :productcode, :string - end -end diff --git a/db/migrate/20190314073723_add_operatime_to_ecloud_users.rb b/db/migrate/20190314073723_add_operatime_to_ecloud_users.rb new file mode 100644 index 00000000..3be52e04 --- /dev/null +++ b/db/migrate/20190314073723_add_operatime_to_ecloud_users.rb @@ -0,0 +1,6 @@ +class AddOperatimeToEcloudUsers < ActiveRecord::Migration + def change + add_column :ecloud_users, :operatime, :bigint + add_column :ecloud_users, :effecttime, :bigint + end +end