Merge remote-tracking branch 'origin/master' into akun
正在显示
16 个修改的文件
包含
228 行增加
和
66 行删除
| @@ -77,7 +77,7 @@ class AiBlogTask extends Command | @@ -77,7 +77,7 @@ class AiBlogTask extends Command | ||
| 77 | if($route != $result['data']['url']){ | 77 | if($route != $result['data']['url']){ |
| 78 | $aiBlogService->updateDetail(['route'=>$route,'task_id'=>$item['task_id']]); | 78 | $aiBlogService->updateDetail(['route'=>$route,'task_id'=>$item['task_id']]); |
| 79 | } | 79 | } |
| 80 | - $aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'], 'route'=>$route ,'status'=>2], ['task_id'=>$item['task_id']]); | 80 | + $aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'],'seo_title'=>$result['data']['title'],'seo_keyword'=>$result['data']['keyword'],'seo_description'=>$result['data']['description'], 'route'=>$route ,'status'=>2], ['task_id'=>$item['task_id']]); |
| 81 | DB::disconnect('custom_mysql'); | 81 | DB::disconnect('custom_mysql'); |
| 82 | $aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]); | 82 | $aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]); |
| 83 | } | 83 | } |
| @@ -71,6 +71,8 @@ class GeneratePage extends Command | @@ -71,6 +71,8 @@ class GeneratePage extends Command | ||
| 71 | } | 71 | } |
| 72 | $this->output(' taskID: ' . $noticeInfo['id'] . ' end'); | 72 | $this->output(' taskID: ' . $noticeInfo['id'] . ' end'); |
| 73 | } catch (\Exception $e) { | 73 | } catch (\Exception $e) { |
| 74 | + $noticeModel->edit(['status'=>3],['id'=>$noticeInfo['id']]); | ||
| 75 | + @file_put_contents(storage_path('logs/lyh/lyh_error.log'), var_export('通知C端生成任务:'.date('Y-m-d H:i:s') . ' taskID: ' . $noticeInfo['id'] . ', error: ' . $e->getMessage() . PHP_EOL) . PHP_EOL, FILE_APPEND); | ||
| 74 | $this->output(' taskID: ' . $noticeInfo['id'] . ', error: ' . $e->getMessage()); | 76 | $this->output(' taskID: ' . $noticeInfo['id'] . ', error: ' . $e->getMessage()); |
| 75 | } | 77 | } |
| 76 | sleep(2); | 78 | sleep(2); |
| @@ -9,7 +9,9 @@ | @@ -9,7 +9,9 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Console\Commands\RequestUrlLog; | 10 | namespace App\Console\Commands\RequestUrlLog; |
| 11 | 11 | ||
| 12 | +use App\Helper\FormGlobalsoApi; | ||
| 12 | use App\Models\Com\RequestUrl; | 13 | use App\Models\Com\RequestUrl; |
| 14 | +use App\Models\Domain\DomainInfo; | ||
| 13 | use App\Models\Project\Project; | 15 | use App\Models\Project\Project; |
| 14 | use Illuminate\Console\Command; | 16 | use Illuminate\Console\Command; |
| 15 | 17 | ||
| @@ -40,22 +42,87 @@ class RequestUrlLog extends Command | @@ -40,22 +42,87 @@ class RequestUrlLog extends Command | ||
| 40 | //获取需要请求的接口 | 42 | //获取需要请求的接口 |
| 41 | $requestUrlModel = new RequestUrl(); | 43 | $requestUrlModel = new RequestUrl(); |
| 42 | $urlList = $requestUrlModel->list(['status'=>0]); | 44 | $urlList = $requestUrlModel->list(['status'=>0]); |
| 45 | + //随机获取一个项目,需要验证的其他方法 | ||
| 46 | + $projectModel = new Project(); | ||
| 47 | + $projectInfo = $projectModel->formatQuery(['type'=>2,'delete_status'=>0])->inRandomOrder()->first(); | ||
| 48 | + //获取对应项目的域名 | ||
| 49 | + $domainModel = new DomainInfo(); | ||
| 50 | + $domainInfo = $domainModel->read(['project_id'=>$projectInfo['id']]); | ||
| 43 | foreach ($urlList as $v){ | 51 | foreach ($urlList as $v){ |
| 52 | + //需要单独验证的方法 | ||
| 53 | + if($v['url'] == 'getMonthInquiry'){ | ||
| 54 | + $result = $this->getMonthInquiry($domainInfo['domain'],date('Y-m'), 0); | ||
| 55 | + $requestUrlModel->edit(['text'=>json_encode($result,true),'time'=>$result['$requestTime'],'http_code'=>$result['http_code']],['id'=>$v['id']]); | ||
| 56 | + continue; | ||
| 57 | + } | ||
| 44 | //循环请求设置 | 58 | //循环请求设置 |
| 45 | - if($v['method'] == 'get'){ | ||
| 46 | - | ||
| 47 | - }else{ | ||
| 48 | - $url = $v['url']; | ||
| 49 | - $result = $this->postRequest($url,$v['param']); | ||
| 50 | - echo '执行的url:' . $url . PHP_EOL . '返回的结果:'.json_encode($result,true) . date('Y-m-d H:i:s').PHP_EOL; | 59 | + if($v['method'] == 'post'){ |
| 60 | + $result = $this->postRequest($v['url'],$v['param']); | ||
| 61 | + echo '执行的url:' . $v['url'] . PHP_EOL . '返回的结果:'.json_encode($result,true) . date('Y-m-d H:i:s').PHP_EOL; | ||
| 51 | //更新请求结果 | 62 | //更新请求结果 |
| 52 | - $requestUrlModel->edit(['text'=>json_encode($result,true)],['id'=>$v['id']]); | 63 | + $requestUrlModel->edit(['text'=>json_encode($result,true),'time'=>$result['$requestTime'],'http_code'=>$result['http_code']],['id'=>$v['id']]); |
| 64 | + continue; | ||
| 53 | } | 65 | } |
| 54 | } | 66 | } |
| 55 | return true; | 67 | return true; |
| 56 | } | 68 | } |
| 57 | 69 | ||
| 58 | /** | 70 | /** |
| 71 | + * @remark :按月统计xunpan | ||
| 72 | + * @name :getMonthInquiry | ||
| 73 | + * @author :lyh | ||
| 74 | + * @method :post | ||
| 75 | + * @time :2025/3/10 14:15 | ||
| 76 | + */ | ||
| 77 | + public function getMonthInquiry($url,$month,$is_upgrade = 0){ | ||
| 78 | + $url = 'https://'.$url.'/'; | ||
| 79 | + $token = md5($url.date("Y-m-d")); | ||
| 80 | + $data = [ | ||
| 81 | + 'domain' => $url, | ||
| 82 | + 'token' => $token, | ||
| 83 | + 'source'=> $is_upgrade ? '1,2,3,4,5' : '1,3,5', | ||
| 84 | + 'model' => 'month', | ||
| 85 | + 'sta_date'=>$month, | ||
| 86 | + ]; | ||
| 87 | + $queryString = http_build_query($data); | ||
| 88 | + $url = 'https://www.globalso.site/api/external-interface/country_con/15243d63ed5a5738?'.$queryString; | ||
| 89 | + $res = $this->getRequest($url); | ||
| 90 | + return $res; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * @remark :http_get请求 | ||
| 95 | + * @name :getRequest | ||
| 96 | + * @author :lyh | ||
| 97 | + * @method :post | ||
| 98 | + * @time :2025/3/10 14:35 | ||
| 99 | + */ | ||
| 100 | + public function getRequest($url){ | ||
| 101 | + $header[] = "content-type: application/json"; | ||
| 102 | + $ch1 = curl_init(); | ||
| 103 | + $timeout = 0; | ||
| 104 | + curl_setopt($ch1, CURLOPT_URL, $url); | ||
| 105 | + curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true); | ||
| 106 | + curl_setopt($ch1, CURLOPT_ENCODING, ''); | ||
| 107 | + curl_setopt($ch1, CURLOPT_MAXREDIRS, 10); | ||
| 108 | + curl_setopt($ch1, CURLOPT_TIMEOUT, 120); | ||
| 109 | + curl_setopt($ch1, CURLOPT_HTTPHEADER, $header); | ||
| 110 | + curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout); | ||
| 111 | + curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true); | ||
| 112 | + curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET'); | ||
| 113 | + curl_setopt($ch1, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); | ||
| 114 | + $access_txt = curl_exec($ch1); | ||
| 115 | + $total_time = curl_getinfo($ch1, CURLINFO_TOTAL_TIME); // 获取请求总时间 | ||
| 116 | + $httpCode = curl_getinfo($ch1, CURLINFO_HTTP_CODE); | ||
| 117 | + if (curl_errno($ch1)) { | ||
| 118 | + curl_error($ch1); | ||
| 119 | + } | ||
| 120 | + curl_close($ch1); | ||
| 121 | + $response = json_decode($access_txt, true); | ||
| 122 | + return ['response' => $response, 'http_code' => $httpCode, 'request_time_ms' => $total_time]; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + /** | ||
| 59 | * @remark :请求设置 | 126 | * @remark :请求设置 |
| 60 | * @name :postRequest | 127 | * @name :postRequest |
| 61 | * @author :lyh | 128 | * @author :lyh |
| @@ -64,12 +131,10 @@ class RequestUrlLog extends Command | @@ -64,12 +131,10 @@ class RequestUrlLog extends Command | ||
| 64 | */ | 131 | */ |
| 65 | public function postRequest($url, $postData) | 132 | public function postRequest($url, $postData) |
| 66 | { | 133 | { |
| 67 | - if (empty($header)) { | ||
| 68 | - $header = array( | ||
| 69 | - "Accept: application/json", | ||
| 70 | - "Content-Type:application/json;charset=utf-8", | ||
| 71 | - ); | ||
| 72 | - } | 134 | + $header = array( |
| 135 | + "Accept: application/json", | ||
| 136 | + "Content-Type:application/json;charset=utf-8", | ||
| 137 | + ); | ||
| 73 | $ch = curl_init(); | 138 | $ch = curl_init(); |
| 74 | curl_setopt($ch, CURLOPT_URL, $url); | 139 | curl_setopt($ch, CURLOPT_URL, $url); |
| 75 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | 140 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
| @@ -81,18 +146,15 @@ class RequestUrlLog extends Command | @@ -81,18 +146,15 @@ class RequestUrlLog extends Command | ||
| 81 | curl_setopt($ch, CURLOPT_AUTOREFERER, 1); | 146 | curl_setopt($ch, CURLOPT_AUTOREFERER, 1); |
| 82 | curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); | 147 | curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); |
| 83 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | 148 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
| 84 | - // 记录请求开始时间 | ||
| 85 | - $startTime = microtime(true); | ||
| 86 | $res = curl_exec($ch); | 149 | $res = curl_exec($ch); |
| 87 | - // 记录请求结束时间 | ||
| 88 | - $endTime = microtime(true); | 150 | + $total_time = curl_getinfo($ch, CURLINFO_TOTAL_TIME); // 获取请求总时间 |
| 89 | $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | 151 | $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
| 90 | if (curl_errno($ch)) { | 152 | if (curl_errno($ch)) { |
| 91 | curl_error($ch); | 153 | curl_error($ch); |
| 92 | } | 154 | } |
| 93 | - $requestTime = round(($endTime - $startTime) * 1000, 2); // 转换为毫秒 | ||
| 94 | curl_close($ch); | 155 | curl_close($ch); |
| 95 | - return ['response' => $res, 'http_code' => $httpCode, 'request_time_ms' => $requestTime]; | 156 | + $response = json_decode($res, true); |
| 157 | + return ['response' => $response, 'http_code' => $httpCode, 'request_time_ms' => $total_time]; | ||
| 96 | } | 158 | } |
| 97 | 159 | ||
| 98 | } | 160 | } |
| @@ -11,6 +11,7 @@ namespace App\Console\Commands\Suppliers; | @@ -11,6 +11,7 @@ namespace App\Console\Commands\Suppliers; | ||
| 11 | 11 | ||
| 12 | use App\Models\Product\Keyword; | 12 | use App\Models\Product\Keyword; |
| 13 | use App\Models\Project\DeployBuild; | 13 | use App\Models\Project\DeployBuild; |
| 14 | +use App\Models\Project\Project; | ||
| 14 | use App\Models\Purchaser\Purchaser; | 15 | use App\Models\Purchaser\Purchaser; |
| 15 | use App\Models\Purchaser\PurchaserInfo; | 16 | use App\Models\Purchaser\PurchaserInfo; |
| 16 | use App\Services\ProjectServer; | 17 | use App\Services\ProjectServer; |
| @@ -33,6 +34,10 @@ class RecommendedSuppliers extends Command | @@ -33,6 +34,10 @@ class RecommendedSuppliers extends Command | ||
| 33 | */ | 34 | */ |
| 34 | protected $description = '推荐供应商'; | 35 | protected $description = '推荐供应商'; |
| 35 | 36 | ||
| 37 | + public $deployBuildModel; | ||
| 38 | + | ||
| 39 | + public $projectModel; | ||
| 40 | + | ||
| 36 | /** | 41 | /** |
| 37 | * Create a new command instance. | 42 | * Create a new command instance. |
| 38 | * | 43 | * |
| @@ -40,7 +45,8 @@ class RecommendedSuppliers extends Command | @@ -40,7 +45,8 @@ class RecommendedSuppliers extends Command | ||
| 40 | */ | 45 | */ |
| 41 | public function __construct() | 46 | public function __construct() |
| 42 | { | 47 | { |
| 43 | - parent::__construct(); | 48 | + $this->deployBuildModel = new DeployBuild(); |
| 49 | + parent::__construct(); // 确保调用父类构造函数 | ||
| 44 | } | 50 | } |
| 45 | 51 | ||
| 46 | 52 | ||
| @@ -49,15 +55,42 @@ class RecommendedSuppliers extends Command | @@ -49,15 +55,42 @@ class RecommendedSuppliers extends Command | ||
| 49 | */ | 55 | */ |
| 50 | public function handle() | 56 | public function handle() |
| 51 | { | 57 | { |
| 52 | - $projectModel = new DeployBuild(); | ||
| 53 | - $project_list = $projectModel->list(['is_supplier'=>1]);//TODO::已开启推荐供应商 | 58 | + $project_list = $this->deployBuildModel->list(['is_supplier'=>1]);//TODO::已开启推荐供应商 |
| 54 | foreach ($project_list as $v){ | 59 | foreach ($project_list as $v){ |
| 55 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL; | 60 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['project_id'] . PHP_EOL; |
| 56 | - ProjectServer::useProject($v['project_id']); | ||
| 57 | - $title = $this->getKeywords($v['project_id']); | ||
| 58 | - echo date('Y-m-d H:i:s') . '开始:'.$v['project_id'] . PHP_EOL; | ||
| 59 | - $this->savePurchaser($v['project_id'],$title); | ||
| 60 | - DB::disconnect('custom_mysql'); | 61 | + $result = $this->countPurchaser($v); |
| 62 | + if($result !== false){ | ||
| 63 | + ProjectServer::useProject($v['project_id']); | ||
| 64 | + $title = $this->getKeywords($v['project_id']); | ||
| 65 | + echo date('Y-m-d H:i:s') . '开始:'.$v['project_id'] . PHP_EOL; | ||
| 66 | + $this->savePurchaser($v['project_id'],$title); | ||
| 67 | + DB::disconnect('custom_mysql'); | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + return true; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * @remark :当前项目拥有的 | ||
| 75 | + * @name :countPurchaser | ||
| 76 | + * @author :lyh | ||
| 77 | + * @method :post | ||
| 78 | + * @time :2025/3/10 16:29 | ||
| 79 | + * @param :is_purchaser_count;1->开启后已达到上线关闭过 0->未关闭过 | ||
| 80 | + * @param :plan(1->专业版 2->标准版 3->商务版 10->旗舰版) | ||
| 81 | + */ | ||
| 82 | + public function countPurchaser($v){ | ||
| 83 | + if($v['is_purchaser_count'] == 0){ | ||
| 84 | + $purchaserInfoModel = new PurchaserInfo(); | ||
| 85 | + $count = $purchaserInfoModel->counts(['project_id'=>$v['project_id']]); | ||
| 86 | + //获取项目版本 | ||
| 87 | + $plan = ['专业版'=>300, '标准版'=>500, '商务版'=>800, '旗舰版'=>1200]; | ||
| 88 | + $total_number = $plan[Project::planMap()[$v['plan']]] ?? 300; | ||
| 89 | + if($count > $total_number){ | ||
| 90 | + //更新数量上限字段,并关闭推荐供应商 | ||
| 91 | + $this->deployBuildModel->edit(['is_purchaser_count'=>1,'is_supplier'=>0],['project_id'=>$v['project_id']]); | ||
| 92 | + return false; | ||
| 93 | + } | ||
| 61 | } | 94 | } |
| 62 | return true; | 95 | return true; |
| 63 | } | 96 | } |
| @@ -62,10 +62,14 @@ class Validate | @@ -62,10 +62,14 @@ class Validate | ||
| 62 | */ | 62 | */ |
| 63 | public static function check_data($data,$type) | 63 | public static function check_data($data,$type) |
| 64 | { | 64 | { |
| 65 | - if($type == 1){ | ||
| 66 | - $res = HttpUtils::get('https://fob.ai.cc/api/check_email', ['email' => $data]); | ||
| 67 | - }else{ | ||
| 68 | - $res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $data]); | 65 | + try { |
| 66 | + if($type == 1){ | ||
| 67 | + $res = HttpUtils::get('https://fob.ai.cc/api/check_email', ['email' => $data]); | ||
| 68 | + }else{ | ||
| 69 | + $res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $data]); | ||
| 70 | + } | ||
| 71 | + }catch (\Exception $e){ | ||
| 72 | + return []; | ||
| 69 | } | 73 | } |
| 70 | return Arr::s2a($res); | 74 | return Arr::s2a($res); |
| 71 | } | 75 | } |
| @@ -71,8 +71,8 @@ class AutoTaskController extends BaseController | @@ -71,8 +71,8 @@ class AutoTaskController extends BaseController | ||
| 71 | } | 71 | } |
| 72 | // 映射信息 以及解析信息 | 72 | // 映射信息 以及解析信息 |
| 73 | $val['type'] = $type[$val['type']] ?? ''; | 73 | $val['type'] = $type[$val['type']] ?? ''; |
| 74 | - $val['route'] = $route[$val['route']]; | ||
| 75 | - $val['status'] = $status[$val['status']]; | 74 | + $val['route'] = $route[$val['route']] ?? ''; |
| 75 | + $val['status'] = $status[$val['status']] ?? ''; | ||
| 76 | $val['project_title'] = $projects[$val['project_id']] ?? ''; | 76 | $val['project_title'] = $projects[$val['project_id']] ?? ''; |
| 77 | $val['domain'] = $data['domain'] ?? ''; | 77 | $val['domain'] = $data['domain'] ?? ''; |
| 78 | $val['url'] = FALSE == empty($data['url']) ? $data['url'] : []; | 78 | $val['url'] = FALSE == empty($data['url']) ? $data['url'] : []; |
| @@ -411,8 +411,6 @@ class ComController extends BaseController | @@ -411,8 +411,6 @@ class ComController extends BaseController | ||
| 411 | $data[] = ['project_id'=>$v['id'],'company'=>$v['company']]; | 411 | $data[] = ['project_id'=>$v['id'],'company'=>$v['company']]; |
| 412 | } | 412 | } |
| 413 | } | 413 | } |
| 414 | - //登录选择项目的有效时间 | ||
| 415 | - Cache::add('login-project-'.$this->user['mobile'],1,300); | ||
| 416 | $this->response('success',Code::SUCCESS,$data); | 414 | $this->response('success',Code::SUCCESS,$data); |
| 417 | } | 415 | } |
| 418 | 416 |
| @@ -270,4 +270,21 @@ class InquiryController extends BaseController | @@ -270,4 +270,21 @@ class InquiryController extends BaseController | ||
| 270 | // return Storage::disk('runtime')->download($file); //直接下载 | 270 | // return Storage::disk('runtime')->download($file); //直接下载 |
| 271 | $this->response('success',Code::SUCCESS,['url' => $fileurl]); | 271 | $this->response('success',Code::SUCCESS,['url' => $fileurl]); |
| 272 | } | 272 | } |
| 273 | + | ||
| 274 | + /** | ||
| 275 | + * @remark :翻译国家 | ||
| 276 | + * @name :tranCountry | ||
| 277 | + * @author :lyh | ||
| 278 | + * @method :post | ||
| 279 | + * @time :2025/3/11 14:18 | ||
| 280 | + */ | ||
| 281 | + public function tranCountry(InquiryLogic $logic){ | ||
| 282 | + $this->request->validate([ | ||
| 283 | + 'phone_region' => 'required', | ||
| 284 | + ],[ | ||
| 285 | + 'phone_region.required' => '国家译文不能为空' | ||
| 286 | + ]); | ||
| 287 | + $data = $logic->tranCountry(); | ||
| 288 | + $this->response('success',Code::SUCCESS,$data); | ||
| 289 | + } | ||
| 273 | } | 290 | } |
| @@ -35,7 +35,7 @@ class LoginController extends BaseController | @@ -35,7 +35,7 @@ class LoginController extends BaseController | ||
| 35 | { | 35 | { |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | - * @remark :登录 | 38 | + * @remark :登录返回所属项目 |
| 39 | * @name :login | 39 | * @name :login |
| 40 | * @author :lyh | 40 | * @author :lyh |
| 41 | * @method :post | 41 | * @method :post |
| @@ -154,12 +154,12 @@ class ProjectLogic extends BaseLogic | @@ -154,12 +154,12 @@ class ProjectLogic extends BaseLogic | ||
| 154 | * @author :lyh | 154 | * @author :lyh |
| 155 | * @method :post | 155 | * @method :post |
| 156 | * @time :2023/8/30 11:57 | 156 | * @time :2023/8/30 11:57 |
| 157 | + * @param :1->建站中 2->优化中 3->建站完成 6-》错误单 | ||
| 157 | */ | 158 | */ |
| 158 | public function projectSave(){ | 159 | public function projectSave(){ |
| 159 | DB::beginTransaction(); | 160 | DB::beginTransaction(); |
| 160 | try { | 161 | try { |
| 161 | if($this->param['type'] == Project::TYPE_SEVEN){ | 162 | if($this->param['type'] == Project::TYPE_SEVEN){ |
| 162 | - //错误单直接返回,单独处理 | ||
| 163 | $this->setTypeSevenEdit($this->param); | 163 | $this->setTypeSevenEdit($this->param); |
| 164 | }else{ | 164 | }else{ |
| 165 | //初始化项目 | 165 | //初始化项目 |
| @@ -196,6 +196,32 @@ class ProjectLogic extends BaseLogic | @@ -196,6 +196,32 @@ class ProjectLogic extends BaseLogic | ||
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | /** | 198 | /** |
| 199 | + * @remark :开启推荐供应商设置 | ||
| 200 | + * @name :isPurchaser | ||
| 201 | + * @author :lyh | ||
| 202 | + * @method :post | ||
| 203 | + * @time :2025/3/10 15:33 | ||
| 204 | + */ | ||
| 205 | + public function isPurchaser($project_id){ | ||
| 206 | + if($this->param['type'] == Project::TYPE_TWO){ | ||
| 207 | + if(empty($this->param['uptime'])){ | ||
| 208 | + $this->param['deploy_build']['is_supplier'] = 1; | ||
| 209 | + }else{ | ||
| 210 | + //获取项目的上线时间 | ||
| 211 | + $projectInfo = $this->model->read(['id'=>$project_id],['uptime']); | ||
| 212 | + //查看上线时间是否大于3天 | ||
| 213 | + $threeDaysAgo = date('Y-m-d H:i:s', strtotime('-3 days')); | ||
| 214 | + if($projectInfo['uptime'] > $threeDaysAgo){ | ||
| 215 | + //上线时间大于当前时间的3天钱,默认不允许关闭推荐供应商 | ||
| 216 | + $this->param['deploy_build']['is_supplier'] = 1; | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + return true; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + /** | ||
| 199 | * @remark :开启AI博客后 | 225 | * @remark :开启AI博客后 |
| 200 | * @name :setAiBlog | 226 | * @name :setAiBlog |
| 201 | * @author :lyh | 227 | * @author :lyh |
| @@ -206,8 +232,7 @@ class ProjectLogic extends BaseLogic | @@ -206,8 +232,7 @@ class ProjectLogic extends BaseLogic | ||
| 206 | if(empty($main_lang_id) || empty($is_ai_blog)){ | 232 | if(empty($main_lang_id) || empty($is_ai_blog)){ |
| 207 | return true; | 233 | return true; |
| 208 | } | 234 | } |
| 209 | - $projectModel = new Project(); | ||
| 210 | - $projectInfo = $projectModel->read(['id'=>$project_id],['title','is_ai_blog','main_lang_id','company']); | 235 | + $projectInfo = $this->model->read(['id'=>$project_id],['title','is_ai_blog','main_lang_id','company']); |
| 211 | //获取项目主语种 | 236 | //获取项目主语种 |
| 212 | $languageModel = new WebLanguage(); | 237 | $languageModel = new WebLanguage(); |
| 213 | $languageInfo = $languageModel->read(['id'=>$main_lang_id],['short']); | 238 | $languageInfo = $languageModel->read(['id'=>$main_lang_id],['short']); |
| @@ -277,8 +302,7 @@ class ProjectLogic extends BaseLogic | @@ -277,8 +302,7 @@ class ProjectLogic extends BaseLogic | ||
| 277 | return $this->success(); | 302 | return $this->success(); |
| 278 | } | 303 | } |
| 279 | //查看當前項目服務器是否有更改 | 304 | //查看當前項目服務器是否有更改 |
| 280 | - $projectModel = new Project(); | ||
| 281 | - $projectInfo = $projectModel->read(['id'=>$project_id],['serve_id']); | 305 | + $projectInfo = $this->model->read(['id'=>$project_id],['serve_id']); |
| 282 | $serversIpModel = new ServersIp(); | 306 | $serversIpModel = new ServersIp(); |
| 283 | $serversModel = new Servers(); | 307 | $serversModel = new Servers(); |
| 284 | if(!empty($projectInfo['serve_id'])){ | 308 | if(!empty($projectInfo['serve_id'])){ |
| @@ -212,10 +212,29 @@ class InquiryLogic extends BaseLogic | @@ -212,10 +212,29 @@ class InquiryLogic extends BaseLogic | ||
| 212 | 'country_code'=>$data['country_code'] ?? '', | 212 | 'country_code'=>$data['country_code'] ?? '', |
| 213 | 'phone_region'=>$data['phone_region'] ?? '', | 213 | 'phone_region'=>$data['phone_region'] ?? '', |
| 214 | ]; | 214 | ]; |
| 215 | + if(!empty($param['phone_region'])){ | ||
| 216 | + $param['country'] = Translate::tran($this->param['phone_region'], 'zh') ?? ''; | ||
| 217 | + } | ||
| 215 | (new PhoneData())->addReturnId($param); | 218 | (new PhoneData())->addReturnId($param); |
| 216 | return $this->success($param); | 219 | return $this->success($param); |
| 217 | } | 220 | } |
| 218 | } | 221 | } |
| 219 | return $this->success($data); | 222 | return $this->success($data); |
| 220 | } | 223 | } |
| 224 | + | ||
| 225 | + /** | ||
| 226 | + * @remark :翻译国家 | ||
| 227 | + * @name :tranCountry | ||
| 228 | + * @author :lyh | ||
| 229 | + * @method :post | ||
| 230 | + * @time :2025/3/11 14:11 | ||
| 231 | + */ | ||
| 232 | + public function tranCountry(){ | ||
| 233 | + $country = Translate::tran($this->param['phone_region'], 'zh') ?? ''; | ||
| 234 | + if(!empty($country)){ | ||
| 235 | + $phoneDataModel = new PhoneData(); | ||
| 236 | + $phoneDataModel->edit(['country'=>$country],['phone_region'=>$this->param['phone_region']]); | ||
| 237 | + } | ||
| 238 | + return $this->success(['country'=>$country]); | ||
| 239 | + } | ||
| 221 | } | 240 | } |
| @@ -54,15 +54,19 @@ class WebSettingTextLogic extends BaseLogic | @@ -54,15 +54,19 @@ class WebSettingTextLogic extends BaseLogic | ||
| 54 | */ | 54 | */ |
| 55 | public function setting_text_save(){ | 55 | public function setting_text_save(){ |
| 56 | $web_setting = new WebSetting(); | 56 | $web_setting = new WebSetting(); |
| 57 | - if(count($this->param['data']) > $this->param['anchor_num']){ | ||
| 58 | - $this->fail('超过最大设置限制'); | 57 | + if(isset($this->param['data']) && !empty($this->param['data'])){ |
| 58 | + if(count($this->param['data']) > $this->param['anchor_num']){ | ||
| 59 | + $this->fail('超过最大设置限制'); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + //更新描文本设置 | ||
| 63 | + if($this->param['anchor_is_enable'] == 0){ | ||
| 64 | + $this->param['anchor_keyword_is_enable'] = 0; | ||
| 65 | + $web_setting->edit($this->param,['project_id'=>$this->user['project_id']]); | ||
| 66 | + return $this->success(); | ||
| 59 | } | 67 | } |
| 60 | DB::beginTransaction(); | 68 | DB::beginTransaction(); |
| 61 | try { | 69 | try { |
| 62 | - //更新描文本设置 | ||
| 63 | - if($this->param['anchor_is_enable'] == 0){ | ||
| 64 | - $this->param['anchor_keyword_is_enable'] = 0; | ||
| 65 | - } | ||
| 66 | $data = [ | 70 | $data = [ |
| 67 | 'anchor_setting'=>$this->param['anchor_setting'] ?? [], | 71 | 'anchor_setting'=>$this->param['anchor_setting'] ?? [], |
| 68 | 'anchor_is_enable'=>$this->param['anchor_is_enable'], | 72 | 'anchor_is_enable'=>$this->param['anchor_is_enable'], |
| @@ -72,7 +76,7 @@ class WebSettingTextLogic extends BaseLogic | @@ -72,7 +76,7 @@ class WebSettingTextLogic extends BaseLogic | ||
| 72 | ]; | 76 | ]; |
| 73 | $web_setting->edit($data,['project_id'=>$this->user['project_id']]); | 77 | $web_setting->edit($data,['project_id'=>$this->user['project_id']]); |
| 74 | $this->model->del(['project_id'=>$this->user['project_id']]); | 78 | $this->model->del(['project_id'=>$this->user['project_id']]); |
| 75 | - if(!empty($this->param['data'])){ | 79 | + if(isset($this->param['data']) && !empty($this->param['data'])){ |
| 76 | foreach ($this->param['data'] as $k => $v){ | 80 | foreach ($this->param['data'] as $k => $v){ |
| 77 | $v['created_at'] = date('Y-m-d H:i:s'); | 81 | $v['created_at'] = date('Y-m-d H:i:s'); |
| 78 | $v['updated_at'] = date('Y-m-d H:i:s'); | 82 | $v['updated_at'] = date('Y-m-d H:i:s'); |
| @@ -86,6 +90,6 @@ class WebSettingTextLogic extends BaseLogic | @@ -86,6 +90,6 @@ class WebSettingTextLogic extends BaseLogic | ||
| 86 | DB::rollBack(); | 90 | DB::rollBack(); |
| 87 | $this->fail('更新失败'); | 91 | $this->fail('更新失败'); |
| 88 | } | 92 | } |
| 89 | - $this->success(); | 93 | + return $this->success(); |
| 90 | } | 94 | } |
| 91 | } | 95 | } |
| @@ -22,10 +22,8 @@ class UserLoginLogic | @@ -22,10 +22,8 @@ class UserLoginLogic | ||
| 22 | 22 | ||
| 23 | public function __construct() | 23 | public function __construct() |
| 24 | { | 24 | { |
| 25 | - //验证账号密码 | ||
| 26 | $this->param = request()->all(); | 25 | $this->param = request()->all(); |
| 27 | $this->model = new User(); | 26 | $this->model = new User(); |
| 28 | - | ||
| 29 | } | 27 | } |
| 30 | 28 | ||
| 31 | /** | 29 | /** |
| @@ -86,7 +84,6 @@ class UserLoginLogic | @@ -86,7 +84,6 @@ class UserLoginLogic | ||
| 86 | if(isset($info['token']) && !empty($info['token'])){ | 84 | if(isset($info['token']) && !empty($info['token'])){ |
| 87 | //清除上一次用户缓存 | 85 | //清除上一次用户缓存 |
| 88 | Cache::pull($info['token']); | 86 | Cache::pull($info['token']); |
| 89 | - Cache::pull('login-project-'.$this->param['mobile']); | ||
| 90 | } | 87 | } |
| 91 | //生成新token | 88 | //生成新token |
| 92 | $token = md5(uniqid().$info['id']); | 89 | $token = md5(uniqid().$info['id']); |
| @@ -178,7 +175,7 @@ class UserLoginLogic | @@ -178,7 +175,7 @@ class UserLoginLogic | ||
| 178 | 175 | ||
| 179 | /** | 176 | /** |
| 180 | * @remark :组装返回数据 | 177 | * @remark :组装返回数据 |
| 181 | - * @name :getProjectInfo | 178 | + * @name :assembleParam |
| 182 | * @author :lyh | 179 | * @author :lyh |
| 183 | * @method :post | 180 | * @method :post |
| 184 | * @time :2023/8/29 15:26 | 181 | * @time :2023/8/29 15:26 |
| @@ -343,10 +340,7 @@ class UserLoginLogic | @@ -343,10 +340,7 @@ class UserLoginLogic | ||
| 343 | public function wechatLogin($wechat){ | 340 | public function wechatLogin($wechat){ |
| 344 | $info = $this->model->read(['wechat'=>$wechat]); | 341 | $info = $this->model->read(['wechat'=>$wechat]); |
| 345 | if($info === false){ | 342 | if($info === false){ |
| 346 | - $data = [ | ||
| 347 | - 'code'=>0, | ||
| 348 | - 'message'=>'当前用户未绑定账户,请绑定后登录', | ||
| 349 | - ]; | 343 | + $data = ['code'=>0, 'message'=>'当前用户未绑定账户,请绑定后登录',]; |
| 350 | }else { | 344 | }else { |
| 351 | //获取项目详情 | 345 | //获取项目详情 |
| 352 | $info = $this->autoAssembleParam($info,User::LOGIN_PASSWORD_SOURCE); | 346 | $info = $this->autoAssembleParam($info,User::LOGIN_PASSWORD_SOURCE); |
| @@ -366,8 +360,7 @@ class UserLoginLogic | @@ -366,8 +360,7 @@ class UserLoginLogic | ||
| 366 | 'message'=>'登陆成功', | 360 | 'message'=>'登陆成功', |
| 367 | 'data'=>$info | 361 | 'data'=>$info |
| 368 | ]; | 362 | ]; |
| 369 | - Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(), | ||
| 370 | - 'project_id'=>$info['project_id'], 'type'=>2 ,'remark' => '自动登录,用户微信扫码']); | 363 | + Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(), 'project_id'=>$info['project_id'], 'type'=>2 ,'remark' => '自动登录,用户微信扫码']); |
| 371 | } | 364 | } |
| 372 | return $this->success($data); | 365 | return $this->success($data); |
| 373 | } | 366 | } |
| @@ -40,7 +40,7 @@ class Notify extends Base | @@ -40,7 +40,7 @@ class Notify extends Base | ||
| 40 | const ROUTE_PRODUCT_KEYWORD = 4; | 40 | const ROUTE_PRODUCT_KEYWORD = 4; |
| 41 | const ROUTE_NOT_TRANSLATE = 5; | 41 | const ROUTE_NOT_TRANSLATE = 5; |
| 42 | const ROUTE_PRODUCT_VIDEO_KEYWORD = 6; | 42 | const ROUTE_PRODUCT_VIDEO_KEYWORD = 6; |
| 43 | - | 43 | + const ROUTE_AI_BLOG = 7; |
| 44 | /** | 44 | /** |
| 45 | * 是否拉取HTML压缩包 | 45 | * 是否拉取HTML压缩包 |
| 46 | * 0:默认不拉取 | 46 | * 0:默认不拉取 |
| @@ -74,7 +74,8 @@ class Notify extends Base | @@ -74,7 +74,8 @@ class Notify extends Base | ||
| 74 | self::ROUTE_URL => '指定路由', | 74 | self::ROUTE_URL => '指定路由', |
| 75 | self::ROUTE_PRODUCT_KEYWORD => '聚合页面', | 75 | self::ROUTE_PRODUCT_KEYWORD => '聚合页面', |
| 76 | self::ROUTE_NOT_TRANSLATE => '漏翻检查', | 76 | self::ROUTE_NOT_TRANSLATE => '漏翻检查', |
| 77 | - self::ROUTE_PRODUCT_VIDEO_KEYWORD => '视频聚合页' | 77 | + self::ROUTE_PRODUCT_VIDEO_KEYWORD => '视频聚合页', |
| 78 | + self::ROUTE_AI_BLOG => 'AI博客' | ||
| 78 | ]; | 79 | ]; |
| 79 | } | 80 | } |
| 80 | 81 |
| @@ -4,6 +4,7 @@ namespace App\Models\Workchat; | @@ -4,6 +4,7 @@ namespace App\Models\Workchat; | ||
| 4 | 4 | ||
| 5 | use App\Models\Base; | 5 | use App\Models\Base; |
| 6 | use App\Models\Inquiry\InquiryFormData; | 6 | use App\Models\Inquiry\InquiryFormData; |
| 7 | +use App\Models\Project\Project; | ||
| 7 | use App\Models\ProjectAssociation\ProjectAssociation; | 8 | use App\Models\ProjectAssociation\ProjectAssociation; |
| 8 | use App\Services\ProjectServer; | 9 | use App\Services\ProjectServer; |
| 9 | use App\Utils\LogUtils; | 10 | use App\Utils\LogUtils; |
| @@ -40,12 +41,15 @@ class MessagePush extends Base | @@ -40,12 +41,15 @@ class MessagePush extends Base | ||
| 40 | * @param $name | 41 | * @param $name |
| 41 | * @param $submit_at | 42 | * @param $submit_at |
| 42 | * @return bool | 43 | * @return bool |
| 44 | + * @param : is_forward_inquiry:0未开启转发询盘 1:开启转发询盘 | ||
| 43 | */ | 45 | */ |
| 44 | public static function addInquiryMessage($id, $project_id, $country, $name, $submit_at){ | 46 | public static function addInquiryMessage($id, $project_id, $country, $name, $submit_at){ |
| 45 | -// if(!ProjectServer::useProject($project_id)){ | ||
| 46 | -// return false; | ||
| 47 | -// } | ||
| 48 | - | 47 | + //查看项目是否开启转发询盘 |
| 48 | + $projectModel = new Project(); | ||
| 49 | + $projectInfo = $projectModel->read(['id'=>$project_id],['is_forward_inquiry']); | ||
| 50 | + if($projectInfo['is_forward_inquiry'] == 0){ | ||
| 51 | + return false; | ||
| 52 | + } | ||
| 49 | //项目是否有绑定群 | 53 | //项目是否有绑定群 |
| 50 | $friend_id = ProjectAssociation::where('project_id', $project_id) | 54 | $friend_id = ProjectAssociation::where('project_id', $project_id) |
| 51 | ->where('status', ProjectAssociation::STATUS_NORMAL) | 55 | ->where('status', ProjectAssociation::STATUS_NORMAL) |
| @@ -371,6 +371,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -371,6 +371,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 371 | Route::any('/export', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'export'])->name('inquiry_export'); | 371 | Route::any('/export', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'export'])->name('inquiry_export'); |
| 372 | Route::any('/send', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'sendMobileVerifyData'])->name('inquiry_sendMobileVerifyData'); | 372 | Route::any('/send', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'sendMobileVerifyData'])->name('inquiry_sendMobileVerifyData'); |
| 373 | Route::any('/checkEmail', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'checkEmail'])->name('inquiry_checkEmail'); | 373 | Route::any('/checkEmail', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'checkEmail'])->name('inquiry_checkEmail'); |
| 374 | + Route::any('/tranCountry', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'tranCountry'])->name('inquiry_tranCountry'); | ||
| 374 | }); | 375 | }); |
| 375 | 376 | ||
| 376 | //生成路由 | 377 | //生成路由 |
-
请 注册 或 登录 后发表评论