Ver Fonte

Merge branch 'liuzj-permission-dev' into test

liuzejian há 1 ano atrás
pai
commit
afb2157a9b

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

@@ -21,4 +21,5 @@ class Errors
     public const  CALLBACK_RATE_TIME_RANGE_ERROR= [500102, '回传比例时间区间不合法'];
     public const  CALLBACK_RATE_TIME_RANGE_ERROR= [500102, '回传比例时间区间不合法'];
     public const  CALLBACK_RECORD_NOT_EXISTS= [500103, '回传日志不存在'];
     public const  CALLBACK_RECORD_NOT_EXISTS= [500103, '回传日志不存在'];
     public const  CALLBACK_RECORD_LOG_ERROR= [500104, '回传日志补传信息缺失'];
     public const  CALLBACK_RECORD_LOG_ERROR= [500104, '回传日志补传信息缺失'];
+    public const  JULIANG_ACCOUNT_PROMOTION_UNIQUE = [500105, '巨量广告账户只允许绑定一个推广'];
 }
 }

+ 16 - 0
modules/Tuiguang/Http/Controllers/PromotionController.php

@@ -114,6 +114,13 @@ class PromotionController extends CatchController
         return 'ok';
         return 'ok';
     }
     }
 
 
+    /**
+     * 更新推广的回传配置
+     * 1, 如果是巨量账户级,推广id和巨量账户唯一绑定
+     * @param Request $request
+     * @return string
+     * @throws \Illuminate\Validation\ValidationException
+     */
     public function updateCallbackConfig(Request $request) {
     public function updateCallbackConfig(Request $request) {
         $this->validate($request, [
         $this->validate($request, [
             'id' => 'required',
             'id' => 'required',
@@ -121,6 +128,15 @@ class PromotionController extends CatchController
             'callback_config_id' => 'required',
             'callback_config_id' => 'required',
             'remark' => 'nullable|string|max:140',
             'remark' => 'nullable|string|max:140',
         ]);
         ]);
+        if(1 == $request->input('callback_type')) {
+            $exist = DB::table('promotions')
+                ->where(['is_enabled' => 1, 'callback_type' => $request->input('callback_type'),
+                    'callback_config_id' => $request->input('callback_config_id')])
+                ->first();
+            if($exist->id != $request->input('id')) {
+                CommonBusinessException::throwError(Errors::JULIANG_ACCOUNT_PROMOTION_UNIQUE);
+            }
+        }
         DB::table('promotions')
         DB::table('promotions')
             ->where(['id' => $request->input('id'), 'uid' => $this->getLoginUserId(), 'is_enabled' => 1])
             ->where(['id' => $request->input('id'), 'uid' => $this->getLoginUserId(), 'is_enabled' => 1])
             ->update([
             ->update([