moshaorui 1 deň pred
rodič
commit
8988ea3b96

+ 3 - 59
app/Distributor/Controllers/SmmPostController.php

@@ -103,63 +103,6 @@ class SmmPostController extends AdminDistController
             $form->disableCreatingCheck();
             $this->addJs();
 
-          //  $form->select('youtube_category')->setView('distributor.form_custom.select_hide')->options(SmmUserAccount::getYoutubeCategory())->default(22)->required();
-
-            /*
-            $form->multipleSteps()
-                ->remember()
-                ->width('950px')
-                ->add(admin_trans_label('select_local_media'), function ($step) {
-                    $step->radio('send_type',admin_trans_label('send_type'))
-                        ->when([1], function ($step) {
-                            $step->datetime('send_time', '<span style="color:#bd4147;">*</span> '.admin_trans_label('send_time'))->placeholder(' ');
-                        })
-                        ->options([ 0=>admin_trans_label('immediate'), 1=>admin_trans_label('timing')])->default(0);
-                    $step->radio('post_type',admin_trans_label('media_type'))
-                        ->when([0], function ($step) {
-                            $step->textarea('image_message', '<span style="color:#bd4147;">*</span> '.admin_trans_label('post_message'))->rows(3)->placeholder(' ');
-                            $step->multipleImage('image_url', '<span style="color:#bd4147;">*</span> '.admin_trans_label('images'))
-                                ->retainable()//禁止删OSS图
-                                ->sortable() // 可拖动排序
-                                ->removable() // 可移除图片
-                                ->autoUpload() // 自动上传
-                                ->uniqueName()
-                                ->limit(4)
-                                ->accept('jpg,png')
-                                ->help('jpg,png (Max 3M)')
-                                ->maxSize(3072);
-                        })
-                        ->when([1], function ($step)  {
-                            $step->textarea('video_message', '<span style="color:#bd4147;">*</span> '.admin_trans_label('post_message'))->rows(3)->placeholder(' ');
-                            $step->file('video_url','<span style="color:#bd4147;">*</span> '.admin_trans_label('video'))
-                                ->uniqueName()
-                                ->autoUpload()
-                                ->accept(config('admin.upload.oss_video.accept'))
-                                ->maxSize(20480)
-                                ->chunked()
-                                ->help('mp4 (Max 20M)')
-                                ->removable();
-                                //->chunked()
-                        })
-                        ->options([ 0=>admin_trans_label('images'), 1=>admin_trans_label('videos')])->default(0);
-                    $this->stepLeaving($step,0);
-                })
-                ->add(admin_trans_label('choose_platforms'), function ($step) {
-                    $rootAccounts = SmmUserAccount::getUserAccounts();
-                    $listBoxOptions = [];
-                    foreach ($rootAccounts as $account) {
-                        if (SmmPostLog::getPostQuota($account->getParent->name) > 0) {
-                            //限额大于0才显示
-                            $listBoxOptions[$account->id] = $account->name . ' ('.$account->getParent->name.')';
-                        }
-                    }
-                    $step->listbox('account_ids', '<span style="color:#bd4147;">*</span> '.admin_trans_label('accountsSelect'))
-                        ->options($listBoxOptions);
-                    $step->select('youtube_category')->setView('distributor.form_custom.select_hide')->options(SmmUserAccount::getYoutubeCategory())->default(22)->required();
-                    $this->stepLeaving($step,1);
-                });
-            $this->addJs();
-            */
         });
     }
 
@@ -216,8 +159,9 @@ class SmmPostController extends AdminDistController
             }
 
             //判断是否超过发送限制
-            if (SmmUserAccount::checkAccountCanSendPost($post['account_ids'],getDistributorId()) == false) {
-                return Admin::json()->error(admin_trans_label('account_send_limit'));
+            $checkResult = SmmUserAccount::checkAccountCanSendPost($post['account_ids'],getDistributorId());
+            if ($checkResult['status'] == false) {
+                return Admin::json()->error($checkResult['mediaName'].' '.admin_trans_label('account_send_limit'));
             }
 
             // 從北京時間字符串創建 Carbon 對象

+ 3 - 3
app/Distributor/Repositories/SmmUserAccount.php

@@ -174,12 +174,12 @@ class SmmUserAccount extends EloquentRepository
             }
         }
         if (SmmPostLog::getPostQuota('YouTube') < $youTubeCount) {
-            return false;
+            return ['status'=>false,'mediaName'=>'YouTube'];
         }
         if (SmmPostLog::getPostQuota('Twitter') < $twitterCount) {
-            return false;
+            return ['status'=>false,'mediaName'=>'Twitter'];
         }
-        return true;
+        return ['status'=>true];
     }
 
 }