From f8d9aebfcbf96d3058a18c098848a38da8f8350b Mon Sep 17 00:00:00 2001 From: chenjing <28122123@qq.com> Date: Wed, 13 Jul 2022 11:10:27 +0800 Subject: [PATCH] change projedeID to sync --- app/controllers/watchers_controller.rb | 4 ++-- app/services/users/synchronization_service.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index 17dcf92e..05d19465 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -14,7 +14,7 @@ class WatchersController < ApplicationController return normal_status(2, "你还没有关注哦") unless current_user.watched?(@target) current_user.unwatch!(@target) render_ok({watchers_count: @target.watchers_count, watched: false}) - Users::SynchronizationService.new.call(current_user, @target, false) if params[:target_type].to_s == "project" + Users::SynchronizationService.new(current_user, @target, false).call if params[:target_type].to_s == "project" rescue Exception => e uid_logger_error(e.message) tip_exception(e.message) @@ -27,7 +27,7 @@ class WatchersController < ApplicationController return normal_status(2, "你已关注了") if current_user.watched?(@target) current_user.watch!(@target) render_ok({watchers_count: @target.watchers_count, watched: true}) - Users::SynchronizationService.new.call(current_user, @target, true) if params[:target_type].to_s == "project" + Users::SynchronizationService.new(current_user, @target, true).call if params[:target_type].to_s == "project" rescue Exception => e uid_logger_error(e.message) tip_exception(e.message) diff --git a/app/services/users/synchronization_service.rb b/app/services/users/synchronization_service.rb index fede5bd6..f0f728ad 100644 --- a/app/services/users/synchronization_service.rb +++ b/app/services/users/synchronization_service.rb @@ -7,7 +7,7 @@ class Users::SynchronizationService end def call - if current_user.platform == "smartdoaction" + if @user.platform == "smartdoaction" watcher_data sync_to_smart_doaction end @@ -27,8 +27,8 @@ class Users::SynchronizationService def watcher_data @data = { email: @user.mail, - projectId: "#{@target.owner.login}/#{@target.name}", - operateType: @watched ==true ? 1 : 2, + projectId: @target.id, + operateType: @watched == true ? 1 : 2, projectUrl:"https://code.mulanos.cn/#{@target.owner.login}/#{@target.name}", projectTitle: @target.name, projectDesc: @target.description,