Procházet zdrojové kódy

修改接口:添加、修改、删除组件;

15313670163 před 1 dnem
rodič
revize
0b0f4cb53a
1 změnil soubory, kde provedl 8 přidání a 4 odebrání
  1. 8 4
      app/JsonRpc/PublicRpcService.php

+ 8 - 4
app/JsonRpc/PublicRpcService.php

@@ -1473,11 +1473,13 @@ class PublicRpcService implements PublicRpcServiceInterface
                 $add_arr['ad'] = json_encode($ad,true);
                 $add_arr['component_data'] = json_encode($component_data,true);
                 $add_arr['component_column'] = $component_type['com_code'] ?? '';
+                $add_arr['adimg_info'] = $data['img_info'];
+                $ad_imginfo = json_decode($data['img_info'],true);
                 break;
             default:
                 break;
         }
-        if($data['type_id'] == 11){
+        if($data['type_id'] == 11 || $data['type_id'] == 14){
             Db::beginTransaction();
             try{
                 $website_img = WebsiteImg::insertGetId($ad_imginfo);
@@ -1697,6 +1699,8 @@ class PublicRpcService implements PublicRpcServiceInterface
                 $add_arr['ad'] = json_encode($ad,true);
                 $add_arr['component_data'] = json_encode($component_data,true);
                 $add_arr['component_column'] = $component_type['com_code'] ?? '';
+                $add_arr['adimg_info'] = $data['img_info'];
+                $ad_imginfo = json_decode($data['img_info'],true);
                 break;
             default:
                 break;
@@ -1727,7 +1731,7 @@ class PublicRpcService implements PublicRpcServiceInterface
         Db::beginTransaction();
         try{
         // return Result::success($add_arr);
-            if($component['type_id'] == 11 && $component['type_id'] != $data['type_id']){
+            if(($component['type_id'] == 11 || $component['type_id'] == 14) && ($data['type_id'] != 11 && $data['type_id'] != 14)){
                 $website_img = WebsiteImg::where('id',$component['ad_imgid'])->delete();
                 
                 if(empty($website_img)){
@@ -1737,7 +1741,7 @@ class PublicRpcService implements PublicRpcServiceInterface
                 var_dump("删除",$website_img);
                 
             }
-            if($data['type_id'] == 11 && $component['type_id'] != $data['type_id']){
+            if(($data['type_id'] == 11 || $data['type_id'] == 14) && ($component['type_id'] != 11 && $component['type_id'] != 14)){
                 $website_img = WebsiteImg::insertGetId($ad_imginfo);
                 $add_arr['ad_imgid'] = $website_img;
                 if(empty($website_img)){
@@ -1747,7 +1751,7 @@ class PublicRpcService implements PublicRpcServiceInterface
                var_dump("上传",$website_img); 
               
             }
-            if($data['type_id'] == 11 && $component['type_id'] == $data['type_id']){
+            if(($component['type_id'] == 11 || $component['type_id'] == 14) && ($data['type_id'] == 11 || $data['type_id'] == 14)){
                 $website_img = WebsiteImg::where('id',$component['ad_imgid'])->first();
                 if(empty($website_img)){
                     $website_img = WebsiteImg::insertGetId($ad_imginfo);