作者 赵彬吉

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -127,53 +127,53 @@ class ComController extends BaseController @@ -127,53 +127,53 @@ class ComController extends BaseController
127 * @method :post 127 * @method :post
128 * @time :2023/5/12 14:55 128 * @time :2023/5/12 14:55
129 */ 129 */
130 -// protected function ceShi(){  
131 -// $this->error = 0;  
132 -// //获取所有ayr_share用户  
133 -// $ayr_share_model = new AyrShareModel();  
134 -// $ayr_share_list = $ayr_share_model->list($this->map);  
135 -// if(!empty($ayr_share_list)){  
136 -// foreach ($ayr_share_list as $k => $v){  
137 -// //查询当前用户是否有未推送的博文  
138 -// $ayr_release = new AyrReleaseModel();  
139 -// $release_info = $ayr_release->read(['schedule_date'=>['>',date('Y-m-d H:i:s',time())],'share_id'=>$v['id']]);  
140 -// //有推文时,直接跳出循环  
141 -// if($release_info !== false){  
142 -// continue;  
143 -// }  
144 -// //查看用户是否在一周内有发送博客  
145 -// $start_at = Carbon::now()->modify('-7 days')->toDateString();  
146 -// $end_at = Carbon::now()->toDateString();  
147 -// $release_info = $ayr_release->read(['created_at'=>['between',[$start_at,$end_at]]]);  
148 -// //有发送博文,则跳出循环  
149 -// if($release_info == false){  
150 -// continue;  
151 -// }  
152 -// //删除用户第三方配置  
153 -// $ayr_share_helper = new AyrShareHelper();  
154 -// $data_profiles = [  
155 -// 'title'=>$v['title'],  
156 -// 'profileKey'=>$v['profile_key']  
157 -// ];  
158 -// $res = $ayr_share_helper->deleted_profiles($data_profiles);  
159 -// if($res['status'] == 'fail'){  
160 -// $this->error++;  
161 -// continue;  
162 -// }  
163 -// //更新数据库  
164 -// $data = [  
165 -// 'title'=>null,  
166 -// 'bind_plat_from'=>null,  
167 -// 'profile_key'=>null,  
168 -// 'ref_id'=>null,  
169 -// ];  
170 -// $res = $ayr_share_model->edit($data,['id'=>$v['id']]);  
171 -// if($res == false){  
172 -// $this->error++;  
173 -// }  
174 -// }  
175 -// }  
176 -// return $this->error;  
177 -// } 130 + protected function ceShi(){
  131 + $this->error = 0;
  132 + //获取所有ayr_share用户
  133 + $ayr_share_model = new AyrShareModel();
  134 + $ayr_share_list = $ayr_share_model->list($this->map);
  135 + if(!empty($ayr_share_list)){
  136 + foreach ($ayr_share_list as $k => $v){
  137 + //查询当前用户是否有未推送的博文
  138 + $ayr_release = new AyrReleaseModel();
  139 + $release_info = $ayr_release->read(['schedule_date'=>['>',date('Y-m-d H:i:s',time())],'share_id'=>$v['id']]);
  140 + //有推文时,直接跳出循环
  141 + if($release_info !== false){
  142 + continue;
  143 + }
  144 + //查看用户是否在一周内有发送博客
  145 + $start_at = Carbon::now()->modify('-7 days')->toDateString();
  146 + $end_at = Carbon::now()->toDateString();
  147 + $release_info = $ayr_release->read(['created_at'=>['between',[$start_at,$end_at]]]);
  148 + //有发送博文,则跳出循环
  149 + if($release_info == false){
  150 + continue;
  151 + }
  152 + //删除用户第三方配置
  153 + $ayr_share_helper = new AyrShareHelper();
  154 + $data_profiles = [
  155 + 'title'=>$v['title'],
  156 + 'profileKey'=>$v['profile_key']
  157 + ];
  158 + $res = $ayr_share_helper->deleted_profiles($data_profiles);
  159 + if($res['status'] == 'fail'){
  160 + $this->error++;
  161 + continue;
  162 + }
  163 + //更新数据库
  164 + $data = [
  165 + 'title'=>null,
  166 + 'bind_plat_from'=>null,
  167 + 'profile_key'=>null,
  168 + 'ref_id'=>null,
  169 + ];
  170 + $res = $ayr_share_model->edit($data,['id'=>$v['id']]);
  171 + if($res == false){
  172 + $this->error++;
  173 + }
  174 + }
  175 + }
  176 + return $this->error;
  177 + }
178 178
179 } 179 }
@@ -122,8 +122,90 @@ class TemplateController extends BaseController @@ -122,8 +122,90 @@ class TemplateController extends BaseController
122 122
123 $data = TemplateLogic::instance()->first($source,$source_id); 123 $data = TemplateLogic::instance()->first($source,$source_id);
124 124
125 -  
126 - return $this->response('',Code::SUCCESS,$data['html']); 125 + $def = '<div class=" d-flex align-items-center justify-content-between py-md-4">
  126 + <div class="logo w-25 w-sm-auto"><a href="#"><img class="img-fluid" src="img/logo.png" alt=""></a></div>
  127 + <nav class="navbar navbar-expand-md navbar-dark flex-fill justify-content-end mx-2 pe-md-5">
  128 + <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#navMenu"
  129 + aria-controls="navMenu">
  130 + <span class="navbar-toggler-icon"></span>
  131 + </button>
  132 + <ul class="nav column-gap-5 justify-content-end text-white d-none d-md-flex">
  133 + <li><a href="#">Home</a></li>
  134 + <li class="dropdown">
  135 + <a href="#" class="dropdown-toggle" data-bs-toggle="dropdown">Products</a>
  136 + <ul class="dropdown-menu fs-6 text-body shadow-sm border-0">
  137 + <li><a href="#" class="dropdown-item py-2">Product Information</a></li>
  138 + <li><a href="#" class="dropdown-item py-2">Change of Insurance</a></li>
  139 + <li><a href="#" class="dropdown-item py-2">Traveling Oxygen Program</a></li>
  140 + <li><a href="#" class="dropdown-item py-2">Contact</a></li>
  141 + </ul>
  142 + </li>
  143 + <li><a href="#">News</a></li>
  144 + <li><a href="#">Download</a></li>
  145 + <li><a href="#">FAQ</a></li>
  146 + <li><a href="#">Contact</a></li>
  147 + </ul>
  148 + </nav>
  149 + <div class="d-flex align-items-center justify-content-end">
  150 + <div class="search">
  151 + <button type="button" class="btn border-0" data-bs-toggle="dropdown">
  152 + <svg viewBox="0 0 24 24" width="18" height="18" stroke="#ffffff" stroke-width="2"
  153 + fill="none" stroke-linecap="round" stroke-linejoin="round" class="css-i6dzq1">
  154 + <circle cx="11" cy="11" r="8"></circle>
  155 + <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
  156 + </svg>
  157 + </button>
  158 + <div class="dropdown-menu p-3 shadow-sm border-0">
  159 + <form action="">
  160 + <div class="d-flex mb-2">
  161 + <input type="text" class="form-control" name="search" placeholder="Start Typing...">
  162 + <button class="btn btn-search border-0" type="submit">
  163 + <svg viewBox="0 0 24 24" width="18" height="18" stroke="#333333"
  164 + stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"
  165 + class="css-i6dzq1">
  166 + <circle cx="11" cy="11" r="8"></circle>
  167 + <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
  168 + </svg>
  169 + </button>
  170 + </div>
  171 + <p class="search-attr">Hit enter to search or ESC to close</p>
  172 + </form>
  173 + </div>
  174 + </div>
  175 + <div class="change-language ms-md-4">
  176 + <div role="button" class="dropdown-toggle text-white d-flex align-items-center"
  177 + data-bs-toggle="dropdown">
  178 + <b class="country-flag language-flag-en"></b> <span>English</span>
  179 + </div>
  180 + <div class="dropdown-menu shadow-sm border-0">
  181 + <div class="d-flex flex-wrap p-3 text-body">
  182 + <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="English">
  183 + <b class="country-flag language-flag-en"></b>
  184 + <span>English</span>
  185 + </a>
  186 + <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Françai">
  187 + <b class="country-flag language-flag-fr"></b>
  188 + <span>Françai</span>
  189 + </a>
  190 + <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Español">
  191 + <b class="country-flag language-flag-es"></b>
  192 + <span>Español</span>
  193 + </a>
  194 + <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Deutsch">
  195 + <b class="country-flag language-flag-de"></b>
  196 + <span>Deutsch</span>
  197 + </a>
  198 + <a href="#" class="col-4 mb-3 pe-2 d-flex align-items-center" title="Română">
  199 + <b class="country-flag language-flag-ro"></b>
  200 + <span>Română</span>
  201 + </a>
  202 + </div>
  203 + </div>
  204 + </div>
  205 + </div>
  206 + </div>';
  207 +
  208 + return $this->response('',Code::SUCCESS,$data?$data['html']:$def);
127 209
128 } 210 }
129 211
@@ -174,33 +256,33 @@ class TemplateController extends BaseController @@ -174,33 +256,33 @@ class TemplateController extends BaseController
174 * @time 2023/5/10 14:55 256 * @time 2023/5/10 14:55
175 */ 257 */
176 public function customChunk(){ 258 public function customChunk(){
177 -  
178 - $html = $this->param['html']??[];  
179 - // 那个页面 的  
180 - $type = $this->param['type']??'';  
181 -  
182 - if(!is_array($html)){  
183 - return $this->response('参数异常',Code::SYSTEM_ERROR);  
184 - }  
185 -  
186 - // 项目id  
187 - $project_id = $this->user['project_id'];  
188 - // 当前模板  
189 - $template_id = BSetting::_get($project_id)['template_id'];  
190 -  
191 - // 验证这个模板是否存在  
192 - if(!$type || !ATemplateHtml::_typeExist($template_id,$type)){  
193 - return $this->response('页面类型错误',Code::SYSTEM_ERROR);  
194 - }  
195 -  
196 -  
197 - $html = view("template.{$template_id}.{$type}")->render();  
198 -  
199 -  
200 - return $this->response('',Code::SUCCESS,$html);  
201 -// $data = BTemplateData::_insert();  
202 -  
203 - 259 +//
  260 +// $html = $this->param['html']??[];
  261 +// // 那个页面 的
  262 +// $type = $this->param['type']??'';
  263 +//
  264 +// if(!is_array($html)){
  265 +// return $this->response('参数异常',Code::SYSTEM_ERROR);
  266 +// }
  267 +//
  268 +// // 项目id
  269 +// $project_id = $this->user['project_id'];
  270 +// // 当前模板
  271 +// $template_id = BSetting::_get($project_id)['template_id'];
  272 +//
  273 +// // 验证这个模板是否存在
  274 +// if(!$type || !ATemplateHtml::_typeExist($template_id,$type)){
  275 +// return $this->response('页面类型错误',Code::SYSTEM_ERROR);
  276 +// }
  277 +//
  278 +//
  279 +// $html = view("template.{$template_id}.{$type}")->render();
  280 +//
  281 +//
  282 +// return $this->response('',Code::SUCCESS,$html);
  283 +//// $data = BTemplateData::_insert();
  284 +//
  285 +//
204 286
205 287
206 } 288 }
@@ -40,7 +40,9 @@ class AyrReleaseLogic extends BaseLogic @@ -40,7 +40,9 @@ class AyrReleaseLogic extends BaseLogic
40 public function release_add(){ 40 public function release_add(){
41 $this->param['project_id'] = $this->user['project_id']; 41 $this->param['project_id'] = $this->user['project_id'];
42 $this->param['operator_id'] = $this->user['id']; 42 $this->param['operator_id'] = $this->user['id'];
43 - $this->param['images'] = implode(',',$this->param['images']); 43 + if(isset($this->param['images']) && !empty($this->param['images'])){
  44 + $this->param['images'] = implode(',',$this->param['images']);
  45 + }
44 $this->param['platforms'] = json_encode($this->param['platforms']); 46 $this->param['platforms'] = json_encode($this->param['platforms']);
45 $rs = $this->model->add($this->param); 47 $rs = $this->model->add($this->param);
46 if($rs === false){ 48 if($rs === false){
@@ -213,9 +213,11 @@ class AyrShareLogic extends BaseLogic @@ -213,9 +213,11 @@ class AyrShareLogic extends BaseLogic
213 $this->fail('不支持视频'); 213 $this->fail('不支持视频');
214 } 214 }
215 //验证图片数 215 //验证图片数
216 - $img_num = count($this->param['images']);  
217 - if($img_num > $this->send_num[$v]){  
218 - $this->fail('发布图片数量超过最大限制,'.$v.'只允许'.$this->send_num[$v].'张图'); 216 + if(isset($this->param['images']) && !empty($this->param['images'])){
  217 + $img_num = count($this->param['images']);
  218 + if($img_num > $this->send_num[$v]){
  219 + $this->fail('发布图片数量超过最大限制,'.$v.'只允许'.$this->send_num[$v].'张图');
  220 + }
219 } 221 }
220 //验证图片数 222 //验证图片数
221 // $img_num = count($this->param['video']); 223 // $img_num = count($this->param['video']);
@@ -2,6 +2,9 @@ @@ -2,6 +2,9 @@
2 2
3 namespace App\Http\Middleware; 3 namespace App\Http\Middleware;
4 4
  5 +use Illuminate\Http\Request;
  6 +use Closure;
  7 +
5 class AccessToken 8 class AccessToken
6 { 9 {
7 /** 10 /**
@@ -24,12 +24,9 @@ class AyrReleaseRequest extends FormRequest @@ -24,12 +24,9 @@ class AyrReleaseRequest extends FormRequest
24 { 24 {
25 return [ 25 return [
26 'title'=>'required', 26 'title'=>'required',
27 -// 'images'=>'required|array',  
28 -// 'video'=>'required',  
29 'content'=>'required', 27 'content'=>'required',
30 'share_id'=>'required', 28 'share_id'=>'required',
31 'platforms'=>'required|array', 29 'platforms'=>'required|array',
32 -// 'schedule_date'=>'required',  
33 ]; 30 ];
34 } 31 }
35 32
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 use Illuminate\Support\Facades\Route; 6 use Illuminate\Support\Facades\Route;
7 7
8 //必须登录验证的路由组 8 //必须登录验证的路由组
9 -Route::middleware(['bloginauth'])->group(function () { 9 +Route::middleware(['bloginauth','accesstoken'])->group(function () {
10 //登录用户编辑个人资料 10 //登录用户编辑个人资料
11 Route::any('/edit_info', [\App\Http\Controllers\Bside\ComController::class, 'edit_info'])->name('edit_info'); 11 Route::any('/edit_info', [\App\Http\Controllers\Bside\ComController::class, 'edit_info'])->name('edit_info');
12 Route::any('/logout', [\App\Http\Controllers\Bside\ComController::class, 'logout'])->name('logout'); 12 Route::any('/logout', [\App\Http\Controllers\Bside\ComController::class, 'logout'])->name('logout');