Merge remote-tracking branch 'origin/master' into akun
正在显示
14 个修改的文件
包含
123 行增加
和
45 行删除
| @@ -264,15 +264,23 @@ class VideoTask extends Command | @@ -264,15 +264,23 @@ class VideoTask extends Command | ||
| 264 | } | 264 | } |
| 265 | if (count($productIds) < 13){ | 265 | if (count($productIds) < 13){ |
| 266 | $product_all_id = Product::where('thumb','!=',null)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->inRandomOrder()->take(20 - count($productIds))->pluck('id')->toArray(); | 266 | $product_all_id = Product::where('thumb','!=',null)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->inRandomOrder()->take(20 - count($productIds))->pluck('id')->toArray(); |
| 267 | + if(empty($product_all_id)){ | ||
| 268 | + $randomData = []; | ||
| 269 | + }else{ | ||
| 267 | $randomData = Product::whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get(); | 270 | $randomData = Product::whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get(); |
| 271 | + } | ||
| 268 | $products = $productsQuery->merge($randomData); | 272 | $products = $productsQuery->merge($randomData); |
| 269 | }else{ | 273 | }else{ |
| 270 | $products = $productsQuery; | 274 | $products = $productsQuery; |
| 271 | } | 275 | } |
| 272 | }else{ | 276 | }else{ |
| 273 | $product_all_id = Product::where('thumb','!=',null)->where("status",Product::STATUS_ON)->inRandomOrder()->take(20)->pluck('id')->toArray(); | 277 | $product_all_id = Product::where('thumb','!=',null)->where("status",Product::STATUS_ON)->inRandomOrder()->take(20)->pluck('id')->toArray(); |
| 278 | + if(empty($product_all_id)){ | ||
| 279 | + $products = []; | ||
| 280 | + }else{ | ||
| 274 | $products = Product::whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get(); | 281 | $products = Product::whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get(); |
| 275 | } | 282 | } |
| 283 | + } | ||
| 276 | $data = []; | 284 | $data = []; |
| 277 | if (!empty($products)){ | 285 | if (!empty($products)){ |
| 278 | foreach ($products as $item){ | 286 | foreach ($products as $item){ |
| @@ -72,7 +72,7 @@ class RankData extends BaseCommands | @@ -72,7 +72,7 @@ class RankData extends BaseCommands | ||
| 72 | } | 72 | } |
| 73 | } | 73 | } |
| 74 | return !$error; | 74 | return !$error; |
| 75 | - } catch (\Exception $e) { | 75 | + } catch (\Exception|\Throwable $e) { |
| 76 | Log::channel('rank_data')->error('排名数据任务失败 ' . $e->getMessage()); | 76 | Log::channel('rank_data')->error('排名数据任务失败 ' . $e->getMessage()); |
| 77 | throw new \Exception($e->getMessage()); | 77 | throw new \Exception($e->getMessage()); |
| 78 | } | 78 | } |
| @@ -56,7 +56,7 @@ class UpdateRoute extends Command | @@ -56,7 +56,7 @@ class UpdateRoute extends Command | ||
| 56 | */ | 56 | */ |
| 57 | public function handle(){ | 57 | public function handle(){ |
| 58 | $projectModel = new Project(); | 58 | $projectModel = new Project(); |
| 59 | - $list = $projectModel->list(['id'=>['in',[1871]]]); | 59 | + $list = $projectModel->list(['id'=>['in',[2350]]]); |
| 60 | $data = []; | 60 | $data = []; |
| 61 | foreach ($list as $v){ | 61 | foreach ($list as $v){ |
| 62 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 62 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| @@ -222,18 +222,18 @@ class UpdateRoute extends Command | @@ -222,18 +222,18 @@ class UpdateRoute extends Command | ||
| 222 | if(!empty($lists)){ | 222 | if(!empty($lists)){ |
| 223 | foreach ($lists as $v){ | 223 | foreach ($lists as $v){ |
| 224 | if(!empty($v['route'])){ | 224 | if(!empty($v['route'])){ |
| 225 | - $tag = "-product"; | ||
| 226 | - if (!(substr($v['route'], -strlen($tag)) === $tag)) { | ||
| 227 | - echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL; | ||
| 228 | - $route = $v['route'].$tag; | ||
| 229 | - // 如果不是以 '-product' 结尾,则拼接上 '-product' | ||
| 230 | - $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 231 | - $productModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 232 | - }else{ | 225 | +// $tag = "-product"; |
| 226 | +// if (!(substr($v['route'], -strlen($tag)) === $tag)) { | ||
| 227 | +// echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL; | ||
| 228 | +// $route = $v['route'].$tag; | ||
| 229 | +// // 如果不是以 '-product' 结尾,则拼接上 '-product' | ||
| 230 | +// $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 231 | +// $productModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 232 | +// }else{ | ||
| 233 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | 233 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; |
| 234 | $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | 234 | $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); |
| 235 | $productModel->edit(['route'=>$route],['id'=>$v['id']]); | 235 | $productModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 236 | - } | 236 | +// } |
| 237 | continue; | 237 | continue; |
| 238 | }else{ | 238 | }else{ |
| 239 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | 239 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; |
| @@ -135,6 +135,9 @@ class Common | @@ -135,6 +135,9 @@ class Common | ||
| 135 | if(isset($cache) && ($cache['is_cache'] == true)){ | 135 | if(isset($cache) && ($cache['is_cache'] == true)){ |
| 136 | if(is_array($id)){ | 136 | if(is_array($id)){ |
| 137 | foreach ($id as $v){ | 137 | foreach ($id as $v){ |
| 138 | + if(is_array($v)){ | ||
| 139 | + continue; | ||
| 140 | + } | ||
| 138 | $key = 'cache_'.$table.'_'.$v.'_type'; | 141 | $key = 'cache_'.$table.'_'.$v.'_type'; |
| 139 | Cache::store('file')->pull($key); | 142 | Cache::store('file')->pull($key); |
| 140 | } | 143 | } |
| @@ -281,6 +281,13 @@ class ProjectController extends BaseController | @@ -281,6 +281,13 @@ class ProjectController extends BaseController | ||
| 281 | if(isset($this->map['site_status'])){ | 281 | if(isset($this->map['site_status'])){ |
| 282 | $query = $query->where('gl_project.site_status',$this->map['site_status']); | 282 | $query = $query->where('gl_project.site_status',$this->map['site_status']); |
| 283 | } | 283 | } |
| 284 | + if(isset($this->map['domain'])){ | ||
| 285 | + if($this->map['domain'] == 0){ | ||
| 286 | + $query = $query->where('gl_project_deploy_optimize.domain',null); | ||
| 287 | + }else{ | ||
| 288 | + $query = $query->where('gl_project_deploy_optimize.domain',null); | ||
| 289 | + } | ||
| 290 | + } | ||
| 284 | return $query; | 291 | return $query; |
| 285 | } | 292 | } |
| 286 | 293 |
| @@ -12,6 +12,8 @@ namespace App\Http\Controllers\Bside\BCom; | @@ -12,6 +12,8 @@ namespace App\Http\Controllers\Bside\BCom; | ||
| 12 | use App\Enums\Common\Code; | 12 | use App\Enums\Common\Code; |
| 13 | use App\Http\Controllers\Bside\BaseController; | 13 | use App\Http\Controllers\Bside\BaseController; |
| 14 | use App\Models\Log\OperationHeartbeat; | 14 | use App\Models\Log\OperationHeartbeat; |
| 15 | +use App\Models\Manage\Manage; | ||
| 16 | +use App\Models\User\User; | ||
| 15 | 17 | ||
| 16 | class OperationHeartbeatController extends BaseController | 18 | class OperationHeartbeatController extends BaseController |
| 17 | { | 19 | { |
| @@ -36,6 +38,7 @@ class OperationHeartbeatController extends BaseController | @@ -36,6 +38,7 @@ class OperationHeartbeatController extends BaseController | ||
| 36 | 'is_custom.required' => '是否为扩展模版', | 38 | 'is_custom.required' => '是否为扩展模版', |
| 37 | 'is_template.required' => '详情页/可视化', | 39 | 'is_template.required' => '详情页/可视化', |
| 38 | ]); | 40 | ]); |
| 41 | + | ||
| 39 | $condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'], | 42 | $condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'], |
| 40 | 'is_list'=>$this->param['is_list'],'is_custom'=>$this->param['is_custom'],'is_template'=>$this->param['is_template']]; | 43 | 'is_list'=>$this->param['is_list'],'is_custom'=>$this->param['is_custom'],'is_template'=>$this->param['is_template']]; |
| 41 | $operationHeartbeatModel = new OperationHeartbeat(); | 44 | $operationHeartbeatModel = new OperationHeartbeat(); |
| @@ -44,9 +47,11 @@ class OperationHeartbeatController extends BaseController | @@ -44,9 +47,11 @@ class OperationHeartbeatController extends BaseController | ||
| 44 | if($info === false){ | 47 | if($info === false){ |
| 45 | $condition['operator_id'] = $this->user['id']; | 48 | $condition['operator_id'] = $this->user['id']; |
| 46 | $condition['project_id'] = $this->user['project_id']; | 49 | $condition['project_id'] = $this->user['project_id']; |
| 50 | + $condition['ip'] = $this->request->ip(); | ||
| 51 | + $condition['manager_id'] = $this->user['manager_id'] ?? 0; | ||
| 47 | $operationHeartbeatModel->addReturnId($condition); | 52 | $operationHeartbeatModel->addReturnId($condition); |
| 48 | }else{ | 53 | }else{ |
| 49 | - $operationHeartbeatModel->edit(['status'=>$condition['status'] ?? 0],['id'=>$info['id']]); | 54 | + $operationHeartbeatModel->edit(['status'=>$condition['status'] ?? 0,'ip'=>$this->request->ip(),'manager_id'=> $this->user['manager_id'] ?? 0],['id'=>$info['id']]); |
| 50 | } | 55 | } |
| 51 | $this->response('success'); | 56 | $this->response('success'); |
| 52 | } | 57 | } |
| @@ -75,15 +80,33 @@ class OperationHeartbeatController extends BaseController | @@ -75,15 +80,33 @@ class OperationHeartbeatController extends BaseController | ||
| 75 | $condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'], | 80 | $condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'], |
| 76 | 'is_list'=>$this->param['is_list'],'is_custom'=>$this->param['is_custom'],'is_template'=>$this->param['is_template']]; | 81 | 'is_list'=>$this->param['is_list'],'is_custom'=>$this->param['is_custom'],'is_template'=>$this->param['is_template']]; |
| 77 | $operationHeartbeatModel = new OperationHeartbeat(); | 82 | $operationHeartbeatModel = new OperationHeartbeat(); |
| 78 | - $info = $operationHeartbeatModel->read($condition,['id','status','updated_at']); | 83 | + $info = $operationHeartbeatModel->read($condition,['id','status','manager_id','ip','operator_id','updated_at']); |
| 79 | if($info === false){ | 84 | if($info === false){ |
| 80 | $info = []; | 85 | $info = []; |
| 81 | }else{ | 86 | }else{ |
| 82 | $date_time = strtotime($info['updated_at']) + 7200; | 87 | $date_time = strtotime($info['updated_at']) + 7200; |
| 83 | if($date_time < time()){ | 88 | if($date_time < time()){ |
| 84 | - $operationHeartbeatModel->edit(['status'=>0],$condition); | 89 | + $operationHeartbeatModel->edit(['status'=>0,'ip'=>'127.0.0.1'],$condition); |
| 85 | $info['status'] = 0; | 90 | $info['status'] = 0; |
| 86 | } | 91 | } |
| 92 | + if($info['status'] == 1){ | ||
| 93 | + //当前登录为切入登录 | ||
| 94 | + if(isset($this->user['manager_id']) && !empty($this->user['manager_id'])){ | ||
| 95 | + //上一次验证也是切入登录 | ||
| 96 | + if($info['manager_id'] != 0){ | ||
| 97 | + $managerModel = new Manage(); | ||
| 98 | + $managerInfo = $managerModel->read(['id'=>$info['manager_id']],['name']); | ||
| 99 | + $info['message'] = '此页面数据已有人在编辑,请勿重复操作!操作人ip:'.$info['ip'].'操作的管理员为:'.$managerInfo['name']; | ||
| 100 | + }else{ | ||
| 101 | + //账号密码登录 | ||
| 102 | + $userModel = new User(); | ||
| 103 | + $userInfo = $userModel->read(['id'=>$info['operator_id']],['name']); | ||
| 104 | + $info['message'] = '此页面数据已有人在编辑,请勿重复操作!'.$userInfo['name'].'用户登录在操作。'; | ||
| 105 | + } | ||
| 106 | + }else{ | ||
| 107 | + $info['message'] = '此页面数据已有人在编辑,请勿重复操作!'; | ||
| 108 | + } | ||
| 109 | + } | ||
| 87 | } | 110 | } |
| 88 | $this->response('success',Code::SUCCESS,$info); | 111 | $this->response('success',Code::SUCCESS,$info); |
| 89 | } | 112 | } |
| @@ -47,14 +47,24 @@ class InquiryController extends BaseController | @@ -47,14 +47,24 @@ class InquiryController extends BaseController | ||
| 47 | $data = $logic->getApiList(); | 47 | $data = $logic->getApiList(); |
| 48 | } | 48 | } |
| 49 | if(!empty($data) && !empty($data['list'])){ | 49 | if(!empty($data) && !empty($data['list'])){ |
| 50 | - foreach ($data['list'] as $k => &$v){ | ||
| 51 | - if(isset($v['phone']) && !empty($v['phone'])){ | ||
| 52 | - $phoneInfo = (new PhoneData())->read(['phone'=>$v['phone']]); | ||
| 53 | - if($phoneInfo === false){ | ||
| 54 | - $v['phone_data'] = []; | ||
| 55 | - }else{ | ||
| 56 | - $v['phone_data'] = json_decode($phoneInfo['data']); | 50 | + $phone = []; |
| 51 | + foreach ($data['list'] as $v){ | ||
| 52 | + if(!empty($v['phone'])){ | ||
| 53 | + $phone[] = $v['phone']; | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + if(!empty($phone)){ | ||
| 57 | + $phoneDataModel = new PhoneData(); | ||
| 58 | + $phoneDataList = $phoneDataModel->list(['phone'=>['in',$phone]]); | ||
| 59 | + foreach ($data['list'] as $key => $value){ | ||
| 60 | + $value['phone_data'] = []; | ||
| 61 | + foreach ($phoneDataList as $valuePhone){ | ||
| 62 | + if($value['phone'] == $valuePhone['phone']){ | ||
| 63 | + $value['phone_data'] = $valuePhone; | ||
| 64 | + break; | ||
| 65 | + } | ||
| 57 | } | 66 | } |
| 67 | + $data['list'][$key] = $value; | ||
| 58 | } | 68 | } |
| 59 | } | 69 | } |
| 60 | } | 70 | } |
| @@ -297,8 +297,7 @@ class LoginController extends BaseController | @@ -297,8 +297,7 @@ class LoginController extends BaseController | ||
| 297 | ]; | 297 | ]; |
| 298 | } | 298 | } |
| 299 | } | 299 | } |
| 300 | - | ||
| 301 | - $info = $logic->autologin($data); | 300 | + $info = $logic->autologin($data,User::LOGIN_OTHER_SOURCE); |
| 302 | $this->response('success',Code::SUCCESS,['info'=>$info]); | 301 | $this->response('success',Code::SUCCESS,['info'=>$info]); |
| 303 | } | 302 | } |
| 304 | 303 |
| @@ -788,7 +788,7 @@ class ProductController extends BaseController | @@ -788,7 +788,7 @@ class ProductController extends BaseController | ||
| 788 | 'keyword_id'=>'required|array', | 788 | 'keyword_id'=>'required|array', |
| 789 | ],[ | 789 | ],[ |
| 790 | 'id.required' => '产品ID不能为空', | 790 | 'id.required' => '产品ID不能为空', |
| 791 | - 'category_id.required' => '关键词ID不能为空', | 791 | + 'keyword_id.required' => '关键词ID不能为空', |
| 792 | ]); | 792 | ]); |
| 793 | $logic->batchSetKeyword(); | 793 | $logic->batchSetKeyword(); |
| 794 | $this->response('success'); | 794 | $this->response('success'); |
| @@ -185,19 +185,29 @@ class InquiryLogic extends BaseLogic | @@ -185,19 +185,29 @@ class InquiryLogic extends BaseLogic | ||
| 185 | */ | 185 | */ |
| 186 | public function sendMobileVerifyData($phone){ | 186 | public function sendMobileVerifyData($phone){ |
| 187 | $phoneDataModel = new PhoneData(); | 187 | $phoneDataModel = new PhoneData(); |
| 188 | - $info = $phoneDataModel->read(['phone'=>$phone]); | ||
| 189 | - if($info === false){ | 188 | + $num_phone = preg_replace('/\D/', '',$phone) ?? ''; // \D 匹配所有非数字字符 |
| 189 | + $data = $phoneDataModel->read(['num_phone'=>$num_phone]); | ||
| 190 | + if($data === false){ | ||
| 190 | $url = 'https://fob.ai.cc/api/mobile_verify_data/'.$phone; | 191 | $url = 'https://fob.ai.cc/api/mobile_verify_data/'.$phone; |
| 191 | $data = http_get($url); | 192 | $data = http_get($url); |
| 193 | + if(!empty($data)){ | ||
| 192 | $param = [ | 194 | $param = [ |
| 193 | 'phone'=>$phone, | 195 | 'phone'=>$phone, |
| 194 | - 'data'=>json_encode($data,true) | 196 | + 'num_phone'=>$num_phone, |
| 197 | + 'wa_status'=>$data['wa_status'] ?? 0, | ||
| 198 | + 'wa_phone'=>$data['wa_phone'] ?? '', | ||
| 199 | + 'wa_name'=>$data['wa_name'] ?? '', | ||
| 200 | + 'wa_profile_pic'=>$data['wa_profile_pic'] ?? '', | ||
| 201 | + 'phone_status'=>$data['phone_status'] ?? 0, | ||
| 202 | + 'phone_type'=>$data['phone_type'] ?? '', | ||
| 203 | + 'country_code'=>$data['country_code'] ?? '', | ||
| 204 | + 'phone_region'=>$data['phone_region'] ?? '', | ||
| 195 | ]; | 205 | ]; |
| 196 | (new PhoneData())->addReturnId($param); | 206 | (new PhoneData())->addReturnId($param); |
| 197 | - }else{ | ||
| 198 | - $data = json_decode($info['data']); | 207 | + return $this->success($param); |
| 208 | + } | ||
| 199 | } | 209 | } |
| 200 | - return $this->success(['data'=>$data]); | 210 | + return $this->success($data); |
| 201 | } | 211 | } |
| 202 | 212 | ||
| 203 | } | 213 | } |
| @@ -107,7 +107,7 @@ class UserLoginLogic | @@ -107,7 +107,7 @@ class UserLoginLogic | ||
| 107 | * @method :post | 107 | * @method :post |
| 108 | * @time :2023/9/18 11:00 | 108 | * @time :2023/9/18 11:00 |
| 109 | */ | 109 | */ |
| 110 | - public function autologin($data) | 110 | + public function autologin($data,$login_source = User::LOGIN_AUTO_SOURCE) |
| 111 | { | 111 | { |
| 112 | //项目自动登录 | 112 | //项目自动登录 |
| 113 | if(isset($data['project_id']) && !empty($data['project_id'])){ | 113 | if(isset($data['project_id']) && !empty($data['project_id'])){ |
| @@ -120,7 +120,7 @@ class UserLoginLogic | @@ -120,7 +120,7 @@ class UserLoginLogic | ||
| 120 | if ($has_user === false) { | 120 | if ($has_user === false) { |
| 121 | $this->fail('该项目未找到注册账号'); | 121 | $this->fail('该项目未找到注册账号'); |
| 122 | } | 122 | } |
| 123 | - $info = $this->autoAssembleParam($has_user); | 123 | + $info = $this->autoAssembleParam($has_user,$login_source); |
| 124 | //生成新token | 124 | //生成新token |
| 125 | $token = md5(uniqid().$info['id']); | 125 | $token = md5(uniqid().$info['id']); |
| 126 | //存储缓存 | 126 | //存储缓存 |
| @@ -160,7 +160,7 @@ class UserLoginLogic | @@ -160,7 +160,7 @@ class UserLoginLogic | ||
| 160 | * @method :post | 160 | * @method :post |
| 161 | * @time :2023/6/12 15:34 | 161 | * @time :2023/6/12 15:34 |
| 162 | */ | 162 | */ |
| 163 | - public function autoAssembleParam($info){ | 163 | + public function autoAssembleParam($info,$login_source = User::LOGIN_AUTO_SOURCE){ |
| 164 | $project = $this->getProjectInfo($info['project_id']); | 164 | $project = $this->getProjectInfo($info['project_id']); |
| 165 | if($project['site_status'] != 0){//关闭站点 | 165 | if($project['site_status'] != 0){//关闭站点 |
| 166 | $this->fail('当前网站已过期,请联系管理员及时续费。'); | 166 | $this->fail('当前网站已过期,请联系管理员及时续费。'); |
| @@ -206,7 +206,7 @@ class UserLoginLogic | @@ -206,7 +206,7 @@ class UserLoginLogic | ||
| 206 | $is_amp = $amp_info ? $amp_info['amp_status'] : 0; | 206 | $is_amp = $amp_info ? $amp_info['amp_status'] : 0; |
| 207 | } | 207 | } |
| 208 | $info['is_amp'] = $is_amp; | 208 | $info['is_amp'] = $is_amp; |
| 209 | - | 209 | + $info['login_source'] = $login_source; |
| 210 | //保存项目缓存 | 210 | //保存项目缓存 |
| 211 | Cache::put('user-'.$info['project_id'],$project,12 * 3600); | 211 | Cache::put('user-'.$info['project_id'],$project,12 * 3600); |
| 212 | return $this->success($info); | 212 | return $this->success($info); |
| @@ -316,6 +316,7 @@ class UserLoginLogic | @@ -316,6 +316,7 @@ class UserLoginLogic | ||
| 316 | $is_amp = $amp_info ? $amp_info['amp_status'] : 0; | 316 | $is_amp = $amp_info ? $amp_info['amp_status'] : 0; |
| 317 | } | 317 | } |
| 318 | $info['is_amp'] = $is_amp; | 318 | $info['is_amp'] = $is_amp; |
| 319 | + $info['login_source'] = User::LOGIN_PASSWORD_SOURCE; | ||
| 319 | //保存项目缓存 | 320 | //保存项目缓存 |
| 320 | Cache::put('user-'.$info['project_id'],$project,12 * 3600); | 321 | Cache::put('user-'.$info['project_id'],$project,12 * 3600); |
| 321 | return $this->success($info); | 322 | return $this->success($info); |
| @@ -363,7 +364,7 @@ class UserLoginLogic | @@ -363,7 +364,7 @@ class UserLoginLogic | ||
| 363 | ]; | 364 | ]; |
| 364 | }else { | 365 | }else { |
| 365 | //获取项目详情 | 366 | //获取项目详情 |
| 366 | - $info = $this->autoAssembleParam($info); | 367 | + $info = $this->autoAssembleParam($info,User::LOGIN_PASSWORD_SOURCE); |
| 367 | if(isset($info['token']) && !empty($info['token'])){ | 368 | if(isset($info['token']) && !empty($info['token'])){ |
| 368 | //清除上一次用户缓存 | 369 | //清除上一次用户缓存 |
| 369 | Cache::pull($info['token']); | 370 | Cache::pull($info['token']); |
| @@ -14,4 +14,18 @@ use App\Models\Base; | @@ -14,4 +14,18 @@ use App\Models\Base; | ||
| 14 | class PhoneData extends Base | 14 | class PhoneData extends Base |
| 15 | { | 15 | { |
| 16 | protected $table = 'gl_phone_data'; | 16 | protected $table = 'gl_phone_data'; |
| 17 | + | ||
| 18 | + const STATUS_VALID = 1; | ||
| 19 | + const STATUS_INVALID = 2; | ||
| 20 | + const STATUS_ERROR = 9; | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + public static function statusMapping() | ||
| 24 | + { | ||
| 25 | + return [ | ||
| 26 | + self::STATUS_VALID => '有效WA', | ||
| 27 | + self::STATUS_INVALID => '无效WA', | ||
| 28 | + self::STATUS_ERROR => '查询失败', | ||
| 29 | + ]; | ||
| 30 | + } | ||
| 17 | } | 31 | } |
| @@ -17,6 +17,9 @@ class User extends Base | @@ -17,6 +17,9 @@ class User extends Base | ||
| 17 | //自动维护create_at创建时间 updated_at修改时间 | 17 | //自动维护create_at创建时间 updated_at修改时间 |
| 18 | public $timestamps = true; | 18 | public $timestamps = true; |
| 19 | 19 | ||
| 20 | + const LOGIN_AUTO_SOURCE = 1;//自动登录 | ||
| 21 | + const LOGIN_PASSWORD_SOURCE = 2;//账号密码登录 | ||
| 22 | + const LOGIN_OTHER_SOURCE = 3;//其他平台切入 | ||
| 20 | /** | 23 | /** |
| 21 | * The attributes that should be cast. | 24 | * The attributes that should be cast. |
| 22 | * | 25 | * |
| @@ -111,7 +111,7 @@ class SyncSubmitTaskService | @@ -111,7 +111,7 @@ class SyncSubmitTaskService | ||
| 111 | * @date 2024/8/27 | 111 | * @date 2024/8/27 |
| 112 | */ | 112 | */ |
| 113 | public function subscribe($data, $date){ | 113 | public function subscribe($data, $date){ |
| 114 | - $email = $data['data']['data']['email']; | 114 | + $email = $data['data']['email']; |
| 115 | if (filter_var($email, FILTER_VALIDATE_EMAIL)) { | 115 | if (filter_var($email, FILTER_VALIDATE_EMAIL)) { |
| 116 | $model = new Email(); | 116 | $model = new Email(); |
| 117 | $model->email = $email; | 117 | $model->email = $email; |
| @@ -273,7 +273,7 @@ class SyncSubmitTaskService | @@ -273,7 +273,7 @@ class SyncSubmitTaskService | ||
| 273 | 273 | ||
| 274 | $config = InquiryFilterConfig::getCacheInfoByProjectId($project_id); | 274 | $config = InquiryFilterConfig::getCacheInfoByProjectId($project_id); |
| 275 | //没配置 则默认开启且使用全局 | 275 | //没配置 则默认开启且使用全局 |
| 276 | - if($config){ | 276 | + if(!$config){ |
| 277 | $config['is_global_rule'] = 1; | 277 | $config['is_global_rule'] = 1; |
| 278 | $config['status'] = 1; | 278 | $config['status'] = 1; |
| 279 | } | 279 | } |
| @@ -284,11 +284,11 @@ class SyncSubmitTaskService | @@ -284,11 +284,11 @@ class SyncSubmitTaskService | ||
| 284 | self::inquiryFilter(Project::DEMO_PROJECT_ID, $data); | 284 | self::inquiryFilter(Project::DEMO_PROJECT_ID, $data); |
| 285 | } | 285 | } |
| 286 | //过滤国家 | 286 | //过滤国家 |
| 287 | - if($config['filter_countries'] && in_array($data['country'], $config['filter_countries'])){ | 287 | + if(!empty($config['filter_countries']) && in_array($data['country'], $config['filter_countries'])){ |
| 288 | throw new InquiryFilterException( '过滤国家:' . $data['country']); | 288 | throw new InquiryFilterException( '过滤国家:' . $data['country']); |
| 289 | } | 289 | } |
| 290 | //过滤ip | 290 | //过滤ip |
| 291 | - if($config['black_ips']){ | 291 | + if(!empty($config['black_ips'])){ |
| 292 | $black_ips = $config['black_ips']; | 292 | $black_ips = $config['black_ips']; |
| 293 | //后端获取的ip | 293 | //后端获取的ip |
| 294 | if(in_array($data['ip'], $black_ips)){ | 294 | if(in_array($data['ip'], $black_ips)){ |
| @@ -302,7 +302,7 @@ class SyncSubmitTaskService | @@ -302,7 +302,7 @@ class SyncSubmitTaskService | ||
| 302 | //过滤内容 | 302 | //过滤内容 |
| 303 | if(!empty($data['data']['message'])) { | 303 | if(!empty($data['data']['message'])) { |
| 304 | //过滤内容关键字 | 304 | //过滤内容关键字 |
| 305 | - if ($config['filter_contents']){ | 305 | + if (!empty($config['filter_contents'])){ |
| 306 | foreach ($config['filter_contents'] as $filter_content) { | 306 | foreach ($config['filter_contents'] as $filter_content) { |
| 307 | if (Str::contains(strtolower($data['data']['message']), strtolower($filter_content))) { | 307 | if (Str::contains(strtolower($data['data']['message']), strtolower($filter_content))) { |
| 308 | throw new InquiryFilterException('过滤内容:' . $filter_content); | 308 | throw new InquiryFilterException('过滤内容:' . $filter_content); |
| @@ -310,14 +310,14 @@ class SyncSubmitTaskService | @@ -310,14 +310,14 @@ class SyncSubmitTaskService | ||
| 310 | } | 310 | } |
| 311 | } | 311 | } |
| 312 | //是否允许包含链接 | 312 | //是否允许包含链接 |
| 313 | - if(!$config['is_allow_link']){ | 313 | + if(isset($config['is_allow_link']) && !$config['is_allow_link']){ |
| 314 | if (Str::contains(strtolower($data['data']['message']), ['http://', 'https://', 'www.'])) { | 314 | if (Str::contains(strtolower($data['data']['message']), ['http://', 'https://', 'www.'])) { |
| 315 | throw new InquiryFilterException('不允许包含链接'); | 315 | throw new InquiryFilterException('不允许包含链接'); |
| 316 | } | 316 | } |
| 317 | } | 317 | } |
| 318 | } | 318 | } |
| 319 | //过滤来源 | 319 | //过滤来源 |
| 320 | - if($config['filter_referers']){ | 320 | + if(!empty($config['filter_referers'])){ |
| 321 | //只比较path路径 | 321 | //只比较path路径 |
| 322 | $paths = array_map(function ($v){ | 322 | $paths = array_map(function ($v){ |
| 323 | return trim(parse_url(Url::to($v), PHP_URL_PATH), '/'); | 323 | return trim(parse_url(Url::to($v), PHP_URL_PATH), '/'); |
| @@ -333,7 +333,7 @@ class SyncSubmitTaskService | @@ -333,7 +333,7 @@ class SyncSubmitTaskService | ||
| 333 | } | 333 | } |
| 334 | } | 334 | } |
| 335 | //过滤邮箱 | 335 | //过滤邮箱 |
| 336 | - if($config['filter_emails'] && !empty($data['data']['email'])){ | 336 | + if(!empty($config['filter_emails']) && !empty($data['data']['email'])){ |
| 337 | foreach ($config['filter_emails'] as $filter_email){ | 337 | foreach ($config['filter_emails'] as $filter_email){ |
| 338 | if(Str::contains(strtolower($data['data']['email']), strtolower($filter_email))){ | 338 | if(Str::contains(strtolower($data['data']['email']), strtolower($filter_email))){ |
| 339 | throw new InquiryFilterException( '过滤邮箱:' . $filter_email); | 339 | throw new InquiryFilterException( '过滤邮箱:' . $filter_email); |
| @@ -341,7 +341,7 @@ class SyncSubmitTaskService | @@ -341,7 +341,7 @@ class SyncSubmitTaskService | ||
| 341 | } | 341 | } |
| 342 | } | 342 | } |
| 343 | //过滤电话 | 343 | //过滤电话 |
| 344 | - if($config['filter_mobiles'] && !empty($data['data']['phone'])){ | 344 | + if(!empty($config['filter_mobiles']) && !empty($data['data']['phone'])){ |
| 345 | foreach ($config['filter_mobiles'] as $filter_mobile){ | 345 | foreach ($config['filter_mobiles'] as $filter_mobile){ |
| 346 | if(Str::contains(strtolower($data['data']['phone']), strtolower($filter_mobile))){ | 346 | if(Str::contains(strtolower($data['data']['phone']), strtolower($filter_mobile))){ |
| 347 | throw new InquiryFilterException( '过滤电话:' . $filter_mobile); | 347 | throw new InquiryFilterException( '过滤电话:' . $filter_mobile); |
| @@ -349,7 +349,7 @@ class SyncSubmitTaskService | @@ -349,7 +349,7 @@ class SyncSubmitTaskService | ||
| 349 | } | 349 | } |
| 350 | } | 350 | } |
| 351 | //过滤姓名 | 351 | //过滤姓名 |
| 352 | - if($config['filter_names'] && !empty($data['data']['name'])){ | 352 | + if(!empty($config['filter_names']) && !empty($data['data']['name'])){ |
| 353 | foreach ($config['filter_names'] as $filter_name){ | 353 | foreach ($config['filter_names'] as $filter_name){ |
| 354 | if( Str::contains(strtolower($data['data']['name']), strtolower($filter_name))){ | 354 | if( Str::contains(strtolower($data['data']['name']), strtolower($filter_name))){ |
| 355 | throw new InquiryFilterException( '过滤姓名:' . $filter_name); | 355 | throw new InquiryFilterException( '过滤姓名:' . $filter_name); |
-
请 注册 或 登录 后发表评论