liuzejian пре 1 година
родитељ
комит
3a7a63845d

+ 56 - 0
modules/Callback/Http/Controllers/JuliangAccountController.php

@@ -270,4 +270,60 @@ class JuliangAccountController extends CatchController
 
         return 'ok';
     }
+
+    /**
+     * 解绑推广
+     * @param Request $request
+     */
+    public function unbindPromotion(Request $request) {
+        $this->validate($request, [
+            'id' => 'required'
+        ]);
+
+        $config = DB::table('juliang_account_callback_config')
+            ->where([
+                'id' => $request->input('id'),
+                'company_uid' => $this->getOptimizerUid(),
+            ])->first();
+
+        if(!$config) {
+            CommonBusinessException::throwError(Errors::JULIANG_ACCOUNT_CONFIG_NOT_EXISTS);
+        }
+        $now = date('Y-m-d H:i:s');
+        DB::table('promotions')
+            ->where([
+                'callback_type' => 1,
+                'callback_config_id' => $request->input('id'),
+                'is_enabled' => 1,
+            ])->update([
+                'callback_config_id' => 0,
+                'updated_at' => $now,
+            ]);
+        DB::table('juliang_account_rate_config_log')
+            ->where('company_uid', $this->getOptimizerUid())
+            ->where('account_id', $config->adv_account_id)
+            ->where('is_enabled', 1)
+            ->update(['is_enabled' => 0, 'updated_at' => $now]);
+        DB::table('juliang_account_promotion_protect_record')
+            ->where('optimizer_uid', $this->getOptimizerUid())
+            ->where('advertiser_id', $config->adv_account_id)
+            ->where('is_enabled', 1)
+            ->update(['is_enabled' => 0, 'updated_at' => $now]);
+        DB::table('juliang_account_rate_config_log')
+            ->insert([
+                'company_uid' => $this->getOptimizerUid(),
+                'account_id' => $config->adv_account_id,
+                'config_per' => $config->default_rate,
+                'created_at' => $now,
+                'updated_at' => $now,
+            ]);
+        // 让所有的时间区间比例配置,在定时任务中,重新执行一遍
+        DB::table('juliang_account_promotion_config_time')
+            ->where('is_enable',1)
+            ->where('company_uid',$this->getOptimizerUid())
+            ->where('account_id',$config->adv_account_id)
+            ->update(['next_exec_time' => date('Y-m-d'), 'updated_at' => $now]);
+
+        return 'ok';
+    }
 }

+ 1 - 1
modules/Common/Errors/Errors.php

@@ -21,7 +21,7 @@ class Errors
     public const  CALLBACK_RATE_TIME_RANGE_ERROR= [500102, '回传比例时间区间不合法'];
     public const  CALLBACK_RECORD_NOT_EXISTS= [500103, '回传日志不存在'];
     public const  CALLBACK_RECORD_LOG_ERROR= [500104, '回传日志补传信息缺失'];
-    public const  JULIANG_ACCOUNT_PROMOTION_UNIQUE = [500105, '巨量广告账户只允许绑定一个推广'];
+    public const  JULIANG_ACCOUNT_PROMOTION_UNIQUE = [500105, '巨量广告账户只允许绑定一个推广,请先解绑'];
     public const  JULIANG_ACCOUNT_CONFIG_NOT_EXISTS = [500106, '回传配置不存在'];
     public const  TIXIAN_YUE_BUZU = [500201, '提现余额不足'];
     public const  BANK_CARD_STATUS_ERROR = [500202, '银行卡不存在或当前状态不可提现'];

+ 2 - 2
modules/Tuiguang/config/tuiguang.php

@@ -4,9 +4,9 @@ return [
     /**
      * 推广链接地址
      */
-    'url' => env('TUIGUAGN_URL', 'https://api.dududus.com'),
+    'url' => env('TUIGUAGN_URL', 'https://api.zhiyupa.com'),
     /**
      * 监测链接地址
      */
-    'trackUrl' => env('TUIGUAGN_TRACK_URL', 'https://track.dududus.com')
+    'trackUrl' => env('TUIGUAGN_TRACK_URL', 'https://track.zhiyupa.com')
 ];