完成用户动态迁移

dev_shixuns
huang 6 years ago
parent 7158b0710a
commit 29a0b03397

@ -170,7 +170,7 @@ class EcloudController < ApplicationController
# 用户业务开通与变更接口 # 用户业务开通与变更接口
# 授权statu为1取消授权status为0 # 授权statu为1取消授权status为0
# opttype: 操作类型0开通1变更 # user['opttype']: 操作类型0开通1变更3: 取消授权4暂停5恢复
def ps_new def ps_new
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
@ -201,19 +201,24 @@ class EcloudController < ApplicationController
end end
# 用户业务状态变更 # 用户业务状态变更
# 授权statu为1取消授权status为0 # user['opttype']: 操作类型0开通1变更3: 取消授权4暂停5恢复
def ps_update def ps_update
begin begin
user_params = params['users'] user_params = params['users']
user_params.each do |user_param| user_params.each do |user_param|
ecloud_user = EcloudUser.where(userid: user_param['userid'], status: 1).first case user_param['opttype']
ecloud_user.update_attributes(opttype: user_param['opttype'], userid: user_param['userid'], status: 0) 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 end
render :json => {success: true, errmsg: ""} render :json => {success: true, errmsg: ""}
# else
# render :json => {code: 404, msg: "企业ID不存在"}
# end
rescue Exception => e rescue Exception => e
logger.error(e.message) logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"} render :json => {code: 500, msg: "#{e.message}"}

@ -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

@ -0,0 +1,6 @@
class AddOperatimeToEcloudUsers < ActiveRecord::Migration
def change
add_column :ecloud_users, :operatime, :bigint
add_column :ecloud_users, :effecttime, :bigint
end
end
Loading…
Cancel
Save