作者 赵彬吉
... ... @@ -114,7 +114,7 @@ class AiBlogAuthorTask extends Command
return true;
}
$aiBlogAuthorModel = new AiBlogAuthor();
$info = $aiBlogAuthorModel->count(['project_id'=>$project_id]);
$info = $aiBlogAuthorModel->counts(['project_id'=>$project_id]);
if($info === false){
foreach ($data as $v){
$param = [
... ...
... ... @@ -107,7 +107,7 @@ class SyncInquiryProject extends Command
}
// 保存项目 以及 获取路由信息
$project = InquiryProject::saveProject($date, $val['v'], $val['postid'], $val['company'], implode(',', $channel_tmp), $val['main_url'], $recent_inquiry, $val['is_split'], $val['test_url']);
$project = InquiryProject::saveProject($date, $val['v'], $val['postid'], $val['company'], implode(',', $channel_tmp), $val['main_url'], $recent_inquiry, $val['notice'], $val['is_split'], $val['test_url']);
$route_domain = $val['is_split'] && $val['test_url'] ? $val['test_url'] : $val['main_url'];
try {
$result = http_get($route_domain . 'k_u_api.php');
... ... @@ -140,13 +140,14 @@ class SyncInquiryProject extends Command
$last_week_time = date('Y-m-d H:i:s', strtotime('-1 week'));
// 获取优化中台项目
$project = Project::leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id')
->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
->where('gl_project.type', Project::TYPE_TWO)
->where('gl_project.extend_type', '!=', 5)
->where(function ($query) {
$query->orwhere('gl_project_online_check.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)
->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE);
})
->get(['gl_project.id', 'gl_project.title', 'gl_project.level', 'gl_project.channel', 'gl_project.is_upgrade']);
->get(['gl_project.id', 'gl_project.title', 'gl_project.level', 'gl_project.channel', 'gl_project_deploy_optimize.inquiry_prompt']);
// 获取所有项目域名
$domains = DomainInfo::whereIn('project_id', $project->pluck('id')->toArray())->pluck('domain', 'project_id')->toArray();
$form_api = new FormGlobalsoApi();
... ... @@ -157,13 +158,13 @@ class SyncInquiryProject extends Command
continue;
$domain = $domains[$val->id] ?? '';
if(!$domain){
if (!$domain) {
continue;
}
//判断项目7天之内是否有询盘
$recent_inquiry = 0;
$inquiry_list = $form_api->getInquiryList('https://' . $domain . '/', $val->is_upgrade);
$inquiry_list = $form_api->getInquiryList('https://' . $domain . '/');
$last_inquiry_time = $inquiry_list['data']['data'][0]['submit_time'] ?? '';
if ($last_inquiry_time > $last_week_time) {
$recent_inquiry = 1;
... ... @@ -177,7 +178,7 @@ class SyncInquiryProject extends Command
DB::disconnect('custom_mysql');
}
$project = InquiryProject::saveProject($date, InquiryProject::VERSION_SIX, $val->id, $val->title, $val->channel['channel_id'], 'https://' . $domain . '/', $recent_inquiry);
$project = InquiryProject::saveProject($date, InquiryProject::VERSION_SIX, $val->id, $val->title, $val->channel['channel_id'], 'https://' . $domain . '/', $recent_inquiry, $val->inquiry_prompt ?? '');
$this->pushTask($project->id);
}
... ...
... ... @@ -67,10 +67,12 @@ class GeneratePage extends Command
$this->output($c_url . ' | 请求成功');
} else {
$noticeModel->edit(['status'=>2],['id'=>$noticeInfo['id']]);
$this->output($c_url . ' | ' . ($re['message'] ?? '未返回失败原因'));
$this->output($c_url . ' | ' . (json_encode($re,true) ?? '未返回失败原因'));
}
$this->output(' taskID: ' . $noticeInfo['id'] . ' end');
} catch (\Exception $e) {
$noticeModel->edit(['status'=>3],['id'=>$noticeInfo['id']]);
@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);
$this->output(' taskID: ' . $noticeInfo['id'] . ', error: ' . $e->getMessage());
}
sleep(2);
... ...
... ... @@ -62,10 +62,14 @@ class Validate
*/
public static function check_data($data,$type)
{
if($type == 1){
$res = HttpUtils::get('https://fob.ai.cc/api/check_email', ['email' => $data]);
}else{
$res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $data]);
try {
if($type == 1){
$res = HttpUtils::get('https://fob.ai.cc/api/check_email', ['email' => $data]);
}else{
$res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $data]);
}
}catch (\Exception $e){
return [];
}
return Arr::s2a($res);
}
... ...
... ... @@ -71,8 +71,8 @@ class AutoTaskController extends BaseController
}
// 映射信息 以及解析信息
$val['type'] = $type[$val['type']] ?? '';
$val['route'] = $route[$val['route']];
$val['status'] = $status[$val['status']];
$val['route'] = $route[$val['route']] ?? '';
$val['status'] = $status[$val['status']] ?? '';
$val['project_title'] = $projects[$val['project_id']] ?? '';
$val['domain'] = $data['domain'] ?? '';
$val['url'] = FALSE == empty($data['url']) ? $data['url'] : [];
... ...
... ... @@ -411,8 +411,6 @@ class ComController extends BaseController
$data[] = ['project_id'=>$v['id'],'company'=>$v['company']];
}
}
//登录选择项目的有效时间
Cache::add('login-project-'.$this->user['mobile'],1,300);
$this->response('success',Code::SUCCESS,$data);
}
... ...
... ... @@ -58,14 +58,23 @@ class InquiryController extends BaseController
if(!empty($data) && !empty($data['list'])){
$email = $phone = [];
foreach ($data['list'] as $v){
if(!empty($v['phone'])){
$phone[] = $v['phone'];
}
if(!empty($v['email'])){
$email[] = $v['email'];
}
if(!empty($v['phone'])){$phone[] = $v['phone'];}
if(!empty($v['email'])){$email[] = $v['email'];}
}
$data = $this->handleMobile($data,$phone);
$data = $this->handleEmail($data,$email);
}
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :处理手机号码
* @name :handleMobile
* @author :lyh
* @method :post
* @time :2025/3/11 16:22
*/
public function handleMobile($data,$phone){
if(!empty($phone)){
$phoneDataModel = new PhoneData();
$phoneDataList = $phoneDataModel->list(['phone'=>['in',$phone]]);
... ... @@ -80,6 +89,17 @@ class InquiryController extends BaseController
$data['list'][$key] = $value;
}
}
return $data;
}
/**
* @remark :处理邮箱
* @name :handleEmail
* @author :lyh
* @method :post
* @time :2025/3/11 16:24
*/
public function handleEmail($data,$email){
if(!empty($email)){
$emailDataModel = new EmailData();
$emailDataList = $emailDataModel->list(['email'=>['in',$email]]);
... ... @@ -94,7 +114,7 @@ class InquiryController extends BaseController
$data['list'][$key] = $value;
}
}
$this->response('success',Code::SUCCESS,$data);
return $data;
}
/**
... ... @@ -270,4 +290,21 @@ class InquiryController extends BaseController
// return Storage::disk('runtime')->download($file); //直接下载
$this->response('success',Code::SUCCESS,['url' => $fileurl]);
}
/**
* @remark :翻译国家
* @name :tranCountry
* @author :lyh
* @method :post
* @time :2025/3/11 14:18
*/
public function tranCountry(InquiryLogic $logic){
$this->request->validate([
'country_code' => 'required',
],[
'country_code.required' => '国家译文不能为空'
]);
$data = $logic->tranCountry();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -35,7 +35,7 @@ class LoginController extends BaseController
{
/**
* @remark :登录
* @remark :登录返回所属项目
* @name :login
* @author :lyh
* @method :post
... ...
... ... @@ -23,8 +23,8 @@ class WebSettingSeoController extends BaseController
* @time :2023/9/11 16:31
*/
public function info(WebSettingSeoLogic $logic){
$info = $logic->seoInfo();
$this->response('success',Code::SUCCESS,$info);
$result = $logic->seoInfo();
$this->response('success',Code::SUCCESS,$result);
}
/**
... ... @@ -35,7 +35,7 @@ class WebSettingSeoController extends BaseController
* @time :2023/9/11 16:32
*/
public function save(WebSettingSeoLogic $logic){
$logic->seoSave();
$this->response('success');
$result = $logic->seoSave();
$this->response('success',Code::SUCCESS,$result);
}
}
... ...
... ... @@ -7,6 +7,7 @@ use App\Helper\FormGlobalsoApi;
use App\Helper\Translate;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Com\WordCountry;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\InquiryForm;
use App\Models\Inquiry\InquiryFormData;
... ... @@ -27,7 +28,7 @@ class InquiryLogic extends BaseLogic
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->form_globalso_api = new FormGlobalsoApi();
}
... ... @@ -195,7 +196,7 @@ class InquiryLogic extends BaseLogic
public function sendMobileVerifyData($phone){
$phoneDataModel = new PhoneData();
$num_phone = preg_replace('/\D/', '',$phone) ?? ''; // \D 匹配所有非数字字符
$data = $phoneDataModel->read(['num_phone'=>$num_phone]);
$data = $phoneDataModel->read(['phone'=>$phone]);
if($data === false){
$url = 'https://fob.ai.cc/api/mobile_verify_data/'.$num_phone;
$data = http_get($url);
... ... @@ -212,10 +213,38 @@ class InquiryLogic extends BaseLogic
'country_code'=>$data['country_code'] ?? '',
'phone_region'=>$data['phone_region'] ?? '',
];
if(!empty($param['country_code'])){
$wordCountryModel = new WordCountry();
$info = $wordCountryModel->read(['pid'=>0,'iso2'=>$this->param['country_code']],['chinese_name']);
if($info !== false){
$param['country'] = $info['chinese_name'];
}
}
(new PhoneData())->addReturnId($param);
return $this->success($param);
}
}
return $this->success($data);
}
/**
* @remark :翻译国家
* @name :tranCountry
* @author :lyh
* @method :post
* @time :2025/3/11 14:11
* @param :pid:0->国家
*/
public function tranCountry(){
$wordCountryModel = new WordCountry();
$info = $wordCountryModel->read(['pid'=>0,'iso2'=>$this->param['country_code']],['chinese_name']);
if($info !== false){
$chinese_name = $info['chinese_name'];
}else{
$chinese_name = $this->param['country_code'];
}
$phoneDataModel = new PhoneData();
$phoneDataModel->edit(['country'=>$info['chinese_name']],['country_code'=>$this->param['country_code']]);
return $this->success(['country'=>$chinese_name]);
}
}
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Http\Logic\Bside\Setting;
use App\Helper\Arr;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\WebSetting\WebSettingSeo;
... ... @@ -42,8 +43,11 @@ class WebSettingSeoLogic extends BaseLogic
* @author :lyh
* @method :post
* @time :2023/9/11 16:34
* @param :product_category_prefix->分类页前缀;product_category_suffix->分类页后缀
*/
public function seoSave(){
$this->param['product_category_prefix'] = Arr::a2s($this->param['product_category_prefix'] ?? []);
$this->param['product_category_suffix'] = Arr::a2s($this->param['product_category_suffix'] ?? []);
try {
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
... ...
... ... @@ -22,10 +22,8 @@ class UserLoginLogic
public function __construct()
{
//验证账号密码
$this->param = request()->all();
$this->model = new User();
}
/**
... ... @@ -86,7 +84,6 @@ class UserLoginLogic
if(isset($info['token']) && !empty($info['token'])){
//清除上一次用户缓存
Cache::pull($info['token']);
Cache::pull('login-project-'.$this->param['mobile']);
}
//生成新token
$token = md5(uniqid().$info['id']);
... ... @@ -178,7 +175,7 @@ class UserLoginLogic
/**
* @remark :组装返回数据
* @name :getProjectInfo
* @name :assembleParam
* @author :lyh
* @method :post
* @time :2023/8/29 15:26
... ... @@ -343,10 +340,7 @@ class UserLoginLogic
public function wechatLogin($wechat){
$info = $this->model->read(['wechat'=>$wechat]);
if($info === false){
$data = [
'code'=>0,
'message'=>'当前用户未绑定账户,请绑定后登录',
];
$data = ['code'=>0, 'message'=>'当前用户未绑定账户,请绑定后登录',];
}else {
//获取项目详情
$info = $this->autoAssembleParam($info,User::LOGIN_PASSWORD_SOURCE);
... ... @@ -366,8 +360,7 @@ class UserLoginLogic
'message'=>'登陆成功',
'data'=>$info
];
Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(),
'project_id'=>$info['project_id'], 'type'=>2 ,'remark' => '自动登录,用户微信扫码']);
Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(), 'project_id'=>$info['project_id'], 'type'=>2 ,'remark' => '自动登录,用户微信扫码']);
}
return $this->success($data);
}
... ...
... ... @@ -40,7 +40,7 @@ class Notify extends Base
const ROUTE_PRODUCT_KEYWORD = 4;
const ROUTE_NOT_TRANSLATE = 5;
const ROUTE_PRODUCT_VIDEO_KEYWORD = 6;
const ROUTE_AI_BLOG = 7;
/**
* 是否拉取HTML压缩包
* 0:默认不拉取
... ... @@ -74,7 +74,8 @@ class Notify extends Base
self::ROUTE_URL => '指定路由',
self::ROUTE_PRODUCT_KEYWORD => '聚合页面',
self::ROUTE_NOT_TRANSLATE => '漏翻检查',
self::ROUTE_PRODUCT_VIDEO_KEYWORD => '视频聚合页'
self::ROUTE_PRODUCT_VIDEO_KEYWORD => '视频聚合页',
self::ROUTE_AI_BLOG => 'AI博客'
];
}
... ...
<?php
/**
* @remark :
* @name :WordCountry.php
* @author :lyh
* @method :post
* @time :2025/3/11 17:24
*/
namespace App\Models\Com;
use App\Models\Base;
/**
* @remark :国家信息
* @name :WordCountry
* @author :lyh
* @method :post
* @time :2025/3/11 17:24
*/
class WordCountry extends Base
{
protected $table = 'gl_world_country_city';
}
... ...
... ... @@ -5,6 +5,7 @@
* Date: 2025/2/17
* Time: 11:49
*/
namespace App\Models\Inquiry;
use App\Models\Base;
... ... @@ -34,16 +35,20 @@ class InquiryProject extends Base
* @param $channel
* @param $domain
* @param $recent_inquiry
* @param $remark
* @param int $is_split
* @param string $test_domain
* @return InquiryProject
*/
public static function saveProject($date, $version, $primary_id, $project, $channel, $domain,$recent_inquiry, $is_split = 0, $test_domain = '')
public static function saveProject($date, $version, $primary_id, $project, $channel, $domain, $recent_inquiry, $remark = '', $is_split = 0, $test_domain = '')
{
$log = self::where(compact('version', 'primary_id'))->first();
if ($log) {
$log->date = $date;
$log->project = $project;
$log->domain = $domain;
$log->recent_inquiry = $recent_inquiry;
$log->remark = $remark;
$log->save();
return $log;
}
... ...
... ... @@ -7,72 +7,6 @@ use App\Models\Base;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* App\Models\Product\Product
*
* @method static get()
* @property int $id
* @property int $project_id
* @property string $title
* @property string $thumb 封面
* @property mixed|null $gallery 图集
* @property mixed|null $attrs 属性参数
* @property string|null $attr_id 通用参数
* @property string|null $category_id 分类 多个,号隔开
* @property string|null $keyword_id 关键词标签 多个,号隔开
* @property string|null $intro 简介
* @property string|null $content 详情
* @property mixed|null $describe 描述
* @property string $describe_id 通用描述
* @property mixed|null $seo_mate seo tdk
* @property string $related_product_id 相关产品 多个,号隔开
* @property int $sort 排序
* @property int $status 状态 0草稿 1已上架 2已下架
* @property int $created_uid 创建者
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property string|null $route 路由
* @property mixed|null $icon 图标
* @property string|null $product_type 产品类型:1,一般产品;2:推荐产品(recommend);3:热销产品(hot)
* @property int $is_upgrade 0:6.0 1:4.0,5.0升级
* @property string|null $send_time 发布时间
* @property int|null $six_read 1:导入数据可按6.0显示
* @method \Illuminate\Database\Eloquent\Builder|Product newModelQuery()
* @method \Illuminate\Database\Eloquent\Builder|Product newQuery()
* @method \Illuminate\Database\Eloquent\Builder|Product onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Product query()
* @method \Illuminate\Database\Eloquent\Builder|Product whereAttrId($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereAttrs($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereCategoryId($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereContent($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereCreatedAt($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereCreatedUid($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereDeletedAt($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereDescribe($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereDescribeId($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereGallery($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereIcon($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereId($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereIntro($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereIsUpgrade($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereKeywordId($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereProductType($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereProjectId($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereRelatedProductId($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereRoute($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereSendTime($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereSeoMate($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereSixRead($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereSort($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereStatus($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereThumb($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereTitle($value)
* @method \Illuminate\Database\Eloquent\Builder|Product whereUpdatedAt($value)
* @method \Illuminate\Database\Eloquent\Builder|Product withTrashed()
* @method \Illuminate\Database\Eloquent\Builder|Product withoutTrashed()
* @mixin \Eloquent
*/
class Product extends Base
{
use SoftDeletes;
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Models\WebSetting;
use App\Helper\Arr;
use App\Models\Base;
class WebSettingSeo extends Base
... ... @@ -18,4 +19,32 @@ class WebSettingSeo extends Base
//连接数据库
protected $connection = 'custom_mysql';
/**
* @remark :(获取器)分类页前缀
* @name :getProductCategoryPrefixAttribute
* @author :lyh
* @method :post
* @time :2025/3/12 10:37
*/
public function getProductCategoryPrefixAttribute($value){
if(!empty($value)){
$value = Arr::s2a($value);
}
return $value;
}
/**
* @remark :(获取器)分类页后缀
* @name :getProductCategorySuffixAttribute
* @author :lyh
* @method :post
* @time :2025/3/12 10:38
*/
public function getProductCategorySuffixAttribute($value){
if(!empty($value)){
$value = Arr::s2a($value);
}
return $value;
}
}
... ...
<?php
/**
* @remark :
* @name :WebSettingYoutube.php
* @author :lyh
* @method :post
* @time :2025/3/11 15:51
*/
namespace App\Models\WebSetting;
use App\Models\Base;
/**
* @remark :youtube账号密码设置
* @name :WebSettingYoutube
* @author :lyh
* @method :post
* @time :2025/3/11 15:51
*/
class WebSettingYoutube extends Base
{
protected $table = 'gl_web_setting_youtube';
}
... ...
... ... @@ -371,6 +371,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/export', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'export'])->name('inquiry_export');
Route::any('/send', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'sendMobileVerifyData'])->name('inquiry_sendMobileVerifyData');
Route::any('/checkEmail', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'checkEmail'])->name('inquiry_checkEmail');
Route::any('/tranCountry', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'tranCountry'])->name('inquiry_tranCountry');
});
//生成路由
... ...