作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -197,7 +197,10 @@ class RelayInquiry extends Command
continue;
}
// 未设置对法对象
if (empty($ad_task['target'])) {
$target_num_arr = array_map(function ($item) {
return count($item['target']);
}, $ad_task);
if (!array_sum($target_num_arr)) {
$val->status = ReInquiryForm::STATUS_FORGO;
$val->remark = '广告任务转发对象为空!';
$val->save();
... ... @@ -213,9 +216,14 @@ class RelayInquiry extends Command
}
try {
$this->relayDetail($ad_task, $val);
$res = false;
foreach ($ad_task as $task){
$res += $this->relayDetail($task, $val);
}
$val->status = $res ? ReInquiryForm::STATUS_SUCCESS : ReInquiryForm::STATUS_FORGO;
$val->save();
} catch (\Exception $e) {
$this->logChannel()->info('执行询盘错误:' . $e->getMessage());
$this->logChannel()->info('执行询盘错误:',[$e->getMessage(), $e->getFile(), $e->getLine()]);
$this->output('执行询盘错误:' . $e->getMessage());
}
}
... ... @@ -294,9 +302,7 @@ class RelayInquiry extends Command
if (empty($random_data)) {
$this->logChannel()->info('当前任务未发现转发对象!', ['广告任务ID:' . $task['id'], '询盘ID:' . $form->id]);
$form->status = ReInquiryForm::STATUS_FORGO;
$form->remark = '当前任务未发现转发对象,广告ID: ' . $form->ad_id . '!';
$form->save();
$form->remark = $form->remark . '当前任务未发现转发对象,广告ID: ' . $form->ad_id . '!';
return false;
}
... ... @@ -385,12 +391,22 @@ class RelayInquiry extends Command
//开启文案替换
if ($task['is_replace_text'] == 2) {
//AI生成
$message = $this->ai_send($task['ai_param'], $message);
if(!$message){
$this->output('AI文案生成失败');
continue;
$error = 0;
while ($error<3){
$message = $this->ai_send($task['ai_param'], $message);
if(!$message){
$this->output('AI文案生成失败');
$error++;
if($error==2){
$task['is_replace_text'] = 1;
$this->output('AI文案生成失败,使用文案库');
}
}else{
break;
}
}
} elseif ($task['is_replace_text'] == 1 || strlen($message) <= 4) {
}
if ($task['is_replace_text'] == 1 || strlen($message) <= 4) {
//配置文案库替换或者字符少于4个,直接替换文案
$use_ids = ReInquiryDetail::where(['re_website' => $domain])->where('status', '<>', ReInquiryDetail::STATUS_FAIL)->pluck('text_id')->toArray();
... ... @@ -444,9 +460,6 @@ class RelayInquiry extends Command
}
}
}
$form->status = ReInquiryForm::STATUS_SUCCESS;
$form->save();
return true;
}
... ... @@ -468,12 +481,15 @@ class RelayInquiry extends Command
*/
public function getAdTask($ad_id)
{
$cache_key = 'inquiry_ads_task';
$cache_key = 'inquiry_ads_tasks';
$ads = Cache::get($cache_key, function () use ($cache_key) {
$ads = ReInquiryTask::where(['status' => ReInquiryTask::STATUS_OPEN])->get(['id', 'ad_id', 'num', 'target', 'is_replace_text', 'ai_param']);
$array = [];
foreach ($ads as $key=>$val) {
$array[$val->ad_id] = $val;
$ad_ids = explode(',', $val['ad_id']);
foreach ($ad_ids as $ad_id){
$array[$ad_id][] = $val;
}
}
if ($array)
Cache::put($cache_key, $array, 60);
... ... @@ -584,13 +600,15 @@ class RelayInquiry extends Command
$lang = $translateSl['texts']['sl'] ?? 'en';
if ($lang == 'en' || Str::contains($lang, 'zh')) {
$language = '英文';
$lang = 'en';
}else{
$language = Translate::getTls($lang);
}
$ai_command = str_replace('{mkeywords}', Arr::random(explode("\r\n", $ai_param['mkeywords'])), $ai_command);
$ai_command = str_replace('{incontent}', Arr::random(explode("\r\n", $incontent)), $ai_command);
$ai_command = str_replace('{characters}', Arr::random(explode("\r\n", $ai_param['characters'])), $ai_command);
$ai_command = str_replace('{language}', Arr::random(explode("\r\n", $language)), $ai_command);
// $ai_command = str_replace('{language}', Arr::random(explode("\r\n", $language)), $ai_command);
$ai_command = str_replace('{language}', '英语', $ai_command); //输出英文 后面再翻译
$ai_command = str_replace('{inkeywords}', Arr::random(explode("\r\n", $ai_param['inkeywords'])), $ai_command);
$ai_command = str_replace('{suoxie}', Arr::random(explode("\r\n", $ai_param['suoxie'])), $ai_command);
//中括号里的根据概率使用
... ... @@ -609,8 +627,10 @@ class RelayInquiry extends Command
}
$text = Gpt::instance()->openai_chat_qqs($ai_command);
if ($lang != 'en' && !Str::contains($lang, 'zh')) {
$text = Translate::tran($text, $lang);
}
$this->logChannel()->info("AI询盘文案", [$ai_command, $text]);
$text = Common::deal_keywords($text);
return Common::deal_str($text);
}
... ...
... ... @@ -62,7 +62,7 @@ class postInquiry extends Command
if($log->status != ReInquiryDetailLog::STATUS_INIT){
continue;
}
$this->output('开始执行' . $val->id);
try {
$detail = ReInquiryDetail::find($val['detail_id']);
... ... @@ -107,7 +107,7 @@ class postInquiry extends Command
$res = Http::withoutVerifying()->post($website . 'api/traffic_visit/', $data)->json();
if (empty($res['status']) || $res['status'] != 200) {
$log->status = ReInquiryDetailLog::STATUS_FAIL;
$log->remark = $res['message'] ?? '';
$log->remark = mb_substr($res['message'] ?? '', 0, 200);
$log->save();
Log::channel('inquiry_relay')->error('inquiry_relay visit error', [$res, $website . 'api/traffic_visit/',$data]);
... ... @@ -135,13 +135,14 @@ class postInquiry extends Command
'user_agent' => $detail['user_agent'],
"ip" => $detail['ip'],
];
$res = Http::get($website . 'wp-admin/admin-ajax.php', $data)->json();
if($res != 200){
$res = Http::get($website . 'wp-admin/admin-ajax.php', $data);
$status = $res->status();
if($status != 200){
$log->status = ReInquiryDetailLog::STATUS_FAIL;
$log->remark = $res['message'] ?? '';
$log->remark = mb_substr($res->body() ?? '', 0 ,200);
$log->save();
Log::channel('inquiry_relay')->error('inquiry_relay v4|v5 visit error', [$res, $website . 'wp-admin/admin-ajax.php', $data]);
Log::channel('inquiry_relay')->error('inquiry_relay v4|v5 visit error', [$res->body(), $website . 'wp-admin/admin-ajax.php', $data]);
return false;
}
}
... ... @@ -170,7 +171,7 @@ class postInquiry extends Command
$res = Http::withoutVerifying()->withHeaders(['User-Agent' => $detail['user_agent']])->post($website . 'api/inquiryQd/', $data)->json();
if(empty($res['code']) || $res['code'] != 200){
$log->status = ReInquiryDetailLog::STATUS_FAIL;
$log->remark = $res['message'] ?? '';
$log->remark = mb_substr($res['message'] ?? '', 0, 200);
$log->save();
Log::channel('inquiry_relay')->error('inquiry_relay v6 inquiry error', [$res, $website . 'api/inquiryQd/', $data]);
... ... @@ -189,17 +190,18 @@ class postInquiry extends Command
'source' => 5,
];
$res = Http::withoutVerifying()->post('https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f', $data)->json();
$result = Http::withoutVerifying()->post('https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f', $data);
$res = $result->json();
//兼容接口返回格式
if(!empty($res['data'][0]['status'])){
$res['data'][0]['code'] = $res['data'][0]['status'] == 'success' ? 200 : 400;
}
if(empty($res['data'][0]['code']) || !in_array($res['data'][0]['code'], [200,300])){
$log->status = ReInquiryDetailLog::STATUS_FAIL;
$log->remark = $res['message'] ?? '';
$log->remark = mb_substr($res['message'] ?? '', 0, 200);
$log->save();
Log::channel('inquiry_relay')->error('inquiry_relay v4|v5 inquiry error', [$res, 'https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f', $data]);
Log::channel('inquiry_relay')->error('inquiry_relay v4|v5 inquiry error', [$result->body(), 'https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f', $data]);
return false;
}
}
... ...
... ... @@ -117,13 +117,16 @@ class VideoTask extends Command
}
$keywordInfo = $this->getKeywordImage($val->id,$task_project->project_id,$domainInfo['domain']);
if(!empty($keywordInfo['product_list'])){
if(!empty($task_project->logo_img)){
$logo_bg['logo'] = $task_project->logo_img;
}
$array = [
'project_id' => $task_project->project_id,
'keyword_id' => $val->id,
'keyword' => $val->title,
'data' => json_encode(['url' => $keywordInfo['url'],'title' => $keywordInfo['title'],
'description' => $keywordInfo['keyword_content'], 'images' => $keywordInfo['product_list'],
'keywords' => $keywordInfo['keyword_list'], 'logo_bg' => $logo_bg]),
'keywords' => $keywordInfo['keyword_list'], 'logo_bg' => $logo_bg , 'template_data' => $task_project->template_data]),
'status' => KeywordVideoTaskLog::STATUS_INIT,
'updated_at' => date('Y-m-d H:i:s'),
'created_at' => date('Y-m-d H:i:s'),
... ... @@ -162,7 +165,8 @@ class VideoTask extends Command
'description' => $valData['description'],
'images' => $valData['images'],
'logo'=> $valData['logo_bg']['logo'] ?? '',
'bg'=> $valData['logo_bg']['bg'] ?? ''
'bg'=> $valData['logo_bg']['bg'] ?? '',
'template_id'=> ((array)$valData['template_data'])['template_id'] ?? '',
],
'task_id' => $task_id,
'callback_url' => env('APP_URL') . '/api/video_task_callback',
... ...
... ... @@ -56,7 +56,7 @@ class UpdateRoute extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['id'=>['in',[1750]]]);
$list = $projectModel->list(['id'=>['in',[1653]]]);
$data = [];
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
... ... @@ -65,8 +65,8 @@ class UpdateRoute extends Command
// $this->setProductKeyword();
// $this->getBlog();
// $this->setCustomRoute($v['id']);
// $this->editProductAlt();
$this->custom_to_blogs();
$this->editProductAlt();
// $this->custom_to_blogs();
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
... ... @@ -108,17 +108,12 @@ class UpdateRoute extends Command
public function editProductAlt(){
$productModel = new Product();
$lists = $productModel->list(['status'=>1],'id',['id','route','thumb','gallery']);
$lists = $productModel->list(['status'=>1],'id',['id','route','seo_mate']);
foreach ($lists as $k => $v){
$v['thumb']['alt'] = $v['route'];
if(!empty($v['gallery'])){
foreach ($v['gallery'] as $keys => $values){
$values = (array)$values;
$values['alt'] = $v['route'];
$v['gallery'][$keys] = $values;
}
}
$productModel->edit(['thumb'=>json_encode($v['thumb'],true),'gallery'=>json_encode($v['gallery'],true)],['id'=>$v['id']]);
$seo_mate = $v['seo_mate'];
$seo_mate['title'] = '';
echo date('Y-m-d H:i:s') . ':'.json_encode($seo_mate) . PHP_EOL;
$productModel->edit(['seo_mate'=>json_encode($seo_mate,true)],['id'=>$v['id']]);
}
return true;
}
... ...
... ... @@ -50,7 +50,7 @@ class FormGlobalsoApi
* @author zbj
* @date 2023/5/17
*/
public function getInquiryList($domain, $search = '', $page = 1, $page_size = 20)
public function getInquiryList($domain, $search = '', $page = 1, $page_size = 20, $ids = [])
{
$project = Project::getProjectByDomain($domain);
$is_upgrade = $project['is_upgrade'] ??0;
... ... @@ -63,6 +63,11 @@ class FormGlobalsoApi
'page' => $page,
'source' => $is_upgrade ? '1,2,3,4' : '1,3' //来源类型 新项目用1,3
];
if($ids){
$params['ids'] = implode(',', $ids);
unset($params['page']);
unset($params['limit']);
}
if($search){
$params['name'] = $search;
}
... ...
... ... @@ -23,6 +23,9 @@ define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/');
if (!function_exists('generateRoute')) {
function generateRoute($string)
{
if(is_array($string)){
$string = $string[0];
}
return str_replace(".", "", trim(strtolower(preg_replace('/[^\w.]+/', '-', trim($string))), '-'));
}
}
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api;
use App\Enums\Common\Code;
use App\Exceptions\InquiryFilterException;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\ReInquiryCount;
use App\Models\Product\Category;
use App\Models\Product\Product;
use App\Models\Project\Project;
... ... @@ -142,4 +143,23 @@ class InquiryController extends BaseController
DB::disconnect('custom_mysql');
return $this->success($data);
}
public function getFbInquiry(Request $request){
$domain = $request->input('domain', '');
if(!$domain){
return $this->error('域名必填');
}
$result = ReInquiryCount::where('domain', 'like', '%'.$domain.'%')->first();
if($result){
$result->tasks = $result->tasks; //调用访问器
$return = 0; //所有都关闭或删除就不返回
foreach ($result->tasks as $task){
$return += (!$task['is_del'] && $task['status']);
}
if(!$return){
return $this->success([]);
}
}
return $this->success($result?:[]);
}
}
... ...
... ... @@ -7,13 +7,14 @@
* @time :2024/2/26 9:23
*/
namespace App\Http\Controllers\Aside\Com;
namespace App\Http\Controllers\Aside\KeywordVideo;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Com\KeywordVideoTask;
use App\Models\Com\KeywordVideoTaskLog;
use App\Models\Domain\DomainInfo;
use Illuminate\Support\Facades\Cache;
class KeywordVideoController extends BaseController
{
... ... @@ -114,6 +115,8 @@ class KeywordVideoController extends BaseController
'status'=>$this->param['status'] ?? 0,
'sort'=>$this->param['sort'] ?? 0,
'keywords'=>$this->param['keywords'] ?? '',
'logo_img'=>$this->param['logo_img'] ?? '',
'template_data'=>isset($this->param['template_data']) ? json_encode($this->param['template_data'],true) : null
];
$rs = $keywordModel->add($data);
if($rs === false){
... ... @@ -136,6 +139,9 @@ class KeywordVideoController extends BaseController
'id.required' => '主键标识不为空',
]);
$keywordModel = new KeywordVideoTask();
if(isset($this->param['template_data']) && !empty($this->param['template_data'])){
$this->param['template_data'] = json_encode($this->param['template_data'],true);
}
$rs = $keywordModel->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->response('编辑失败',Code::SYSTEM_ERROR);
... ... @@ -193,4 +199,27 @@ class KeywordVideoController extends BaseController
$count = $taskLogModel->formatQuery(['created_at'=>['between',[$start_of_month,$end_of_month]]])->count();
$this->response('success',Code::SUCCESS,['count'=>$count]);
}
/**
* @remark :获取模版库模版
* @name :get_template
* @author :lyh
* @method :post
* @time :2024/11/1 11:48
*/
public function get_template(){
$data = Cache::get('template_data');
if(empty($data)){
$url = 'http://216.250.255.116:7866/get_template';
$header = [
'accept: application/json'
];
$data = http_get($url,$header);
if(!empty($data['data']) && $data['code'] == 200){
$data = $data['data'];
Cache::put('template_data',$data,12 * 3600);
}
}
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -26,6 +26,7 @@ use App\Models\Manage\Manage;
use App\Models\Manage\ManageHr;
use App\Models\Project\DeployBuild;
use App\Models\Project\Payment;
use App\Models\Project\ProcessRecords;
use App\Models\Project\Project;
use App\Models\Project\ProjectUpdateTdk;
use App\Models\Project\RenewLog;
... ... @@ -356,6 +357,14 @@ class ProjectController extends BaseController
if($item['type'] != Project::TYPE_ZERO){
$data = APublicModel::getNumByProjectId($item['id']);
}
if($item['type'] == Project::TYPE_ONE){//建站中
$processModel = new ProcessRecords();
$item['sign_project'] = 0;
$proInfo = $processModel->read(['project_id'=>$item['id'],'updated_at'=>['>=',time() - 3 * 12 * 3600]],['id']);
if($proInfo === false){
$item['sign_project'] = 1;
}
}
$manageModel = new ManageHr();
$item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0);
$item['build_leader'] = $manageModel->getName($item['leader_mid']);
... ...
... ... @@ -62,7 +62,7 @@ class AdsController extends BaseController
foreach ($result as &$item){
$relay_site_total += count($item->target);
$item->requiry_num = ReInquiryDetail::where('task_id', $item->id)->where('status', ReInquiryDetail::STATUS_SUCCESS)->count();
$item->form_num = ReInquiryForm::where('ad_id', $item->ad_id)->count();
$item->form_num = ReInquiryForm::whereIn('ad_id', explode(',', $item->ad_id))->count();
}
$result = $result->toArray();
$result['relay_site_total'] = $relay_site_total;
... ... @@ -169,7 +169,8 @@ class AdsController extends BaseController
if($channel){
$data = [
'is_v6' => 1,
'agent' => trim(explode('-', Channel::getChannelText($channel['user_id']??0))[0]),
'agent' => Channel::getChannelText($channel['user_id']??0),
'agent_group' => trim(explode('-', Channel::getChannelText($channel['user_id']??0))[0]),
'domain' => $domain,
];
return $this->response('success', Code::SUCCESS, $data);
... ... @@ -180,13 +181,10 @@ class AdsController extends BaseController
return $this->response($res['msg'] ?? '验证失败,请稍后再试!', Code::USER_ERROR, []);
}
$agent = implode(',', array_map(function ($v){
return trim(explode('-', $v)[0]);
}, explode(',', $res['data'] ?? '')));
$data = [
'is_v6' => 0,
'agent' => $agent,
'agent' => $res['data'],
'agent_group' => trim(explode('-', explode(',', $res['data'] ?? '')[0])[0]),
'domain' => $domain,
];
return $this->response('success', Code::SUCCESS, $data);
... ... @@ -233,6 +231,7 @@ class AdsController extends BaseController
$task_id = intval($request->input('task_id'));
$form_id = intval($request->input('form_id'));
$country = intval($request->input('country'));
$page_size = intval($request->input('row', '20'));
$result = ReInquiryDetail::with('detailLog')
->when($status, function ($query, $status) {
return $query->where('status', $status);
... ... @@ -247,7 +246,7 @@ class AdsController extends BaseController
return $query->where('country', 'like', '%'.$country.'%');
})
->orderBy('id', 'desc')
->paginate();
->paginate($page_size);
return $this->response('success', Code::SUCCESS, $result);
}
... ... @@ -274,8 +273,9 @@ class AdsController extends BaseController
->orderBy('num', 'desc')
->paginate($row);
foreach ($result as $item){
foreach ($result as &$item){
$item->tasks = $item->tasks; //调用访问器
$item['project_id'] = DomainInfo::where('domain', $item['domain'])->value('project_id') ?: 0;
}
return $this->response('success', Code::SUCCESS, $result);
... ...
... ... @@ -404,7 +404,8 @@ class ComController extends BaseController
* @time :2024/10/28 11:51
*/
public function month_counts(){
Artisan::call('month_project '.$this->user['project_id']);
shell_exec('php artisan month_project '.$this->user['project_id']);
// Artisan::call('month_project '.$this->user['project_id']);
$this->response('重新刷新中,请稍后刷新查询');
}
}
... ...
... ... @@ -32,6 +32,9 @@ class CustomModuleCategoryController extends BaseController
],[
'module_id.required' => 'module_id不能为空',
]);
//获取模块路由
$customModuleModel = new CustomModule();
$moduleInfo = $customModuleModel->read(['id'=>$this->param['module_id']]);
$this->map['project_id'] = $this->user['project_id'];
$this->map['status'] = 0;
$list = $customModuleCategory->list($this->map,'sort');
... ... @@ -40,6 +43,11 @@ class CustomModuleCategoryController extends BaseController
foreach ($list as $k => $v){
$v['is_renovation'] = $this->getIsRenovation($v['module_id'],BTemplate::IS_LIST,$template_id,$v['id'],BTemplate::IS_CUSTOM);
$v['url'] = $this->user['domain'].$v['route'];
if($this->user['is_upgrade'] == 1){
if($v['route'] != $moduleInfo['route']){
$v['url'] = $this->user['domain'].$moduleInfo['route']."_catalog/".$v['route'];
}
}
$list[$k] = $v;
}
}
... ...
... ... @@ -135,7 +135,7 @@ class InquiryController extends BaseController
{
if(!empty($this->param['form_id'])){
$data = $logic->getFormDataList(true);
$field = InquiryForm::getField($this->param['form_id']);
$field = InquiryForm::getField($this->param['form_id'], $this->user['project_id']);
$map = [
'submit_time' => '询盘发送时间',
];
... ... @@ -168,10 +168,10 @@ class InquiryController extends BaseController
$data = $data['list'] ?? [];
foreach ($data as &$item){
//非正常登录的
if($this->param['login_source'] != 2){
if($this->param['login_source']??0 != 2){
//脱敏
$item['email'] = email_desensitize($item['email']);
$item['phone'] = substr($item['phone'], 0, -4) . '****';
!empty($item['email']) && $item['email'] = email_desensitize($item['email']);
!empty($item['phone']) && $item['phone'] = substr($item['phone'], 0, -4) . '****';
}
$item['ip_address'] = "{$item['country']}({$item['ip']})";
... ... @@ -179,8 +179,11 @@ class InquiryController extends BaseController
if(!empty($this->param['form_id'])){
$item = array_merge($item, $item['data']);
}
foreach ($map as $field => $name) {
if(empty($item[$field])){
$item[$field] = '';
continue;
}
if(is_array($item[$field])){
$item[$field] = implode(',',$item[$field]);
}
... ...
... ... @@ -152,7 +152,10 @@ class LoginController extends BaseController
],[
'str.required' => '翻译字符串不能为空',
]);
$str = Translate::tran($this->param['str'], 'en');
$str = Translate::tran($this->param['str'], 'en') ?? '';
if(is_array($str)){
$str = $str[0];
}
$this->response('success',Code::SUCCESS,strtolower($str));
}
... ...
... ... @@ -96,6 +96,7 @@ class ProjectLogic extends BaseLogic
if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){
$info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']);
}
//is_product:"0",is_news:"0",is_blogs:"0",is_module:"0"
//获取小语种
$info['minor_languages'] = $this->getProjectMinorLanguages($id);
//升级项目采集完成时间
... ...
... ... @@ -40,10 +40,11 @@ class InquiryLogic extends BaseLogic
}
$search = $this->request['search'] ?: '';
$page = $this->request['page'] ?: 1;
$ids = $this->request['ids'] ?: [];
$project = (new ProjectLogic())->getProjectInfo($this->user['project_id']);
$domain = (!empty(
$project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '');
$list = $this->form_globalso_api->getInquiryList($domain, $search, $page, $page_size);
$list = $this->form_globalso_api->getInquiryList($domain, $search, $page, $page_size, $ids);
//处理格式 免得前端又改
$data = [
"list" => [],
... ... @@ -66,10 +67,14 @@ class InquiryLogic extends BaseLogic
$page_size = $export ? 1000 : 20;
$search = $this->request['search'] ?: '';
$page = $this->request['page'] ?: 1;
$ids = $this->request['ids'] ?? [];
$map = [];
if($search){
$map['email'] = ['like','%'.$search.'%'];
}
if ($ids) {
$map['id'] = ['in', $ids];
}
$data = (new InquiryOther())->lists($map,$page,$page_size,'id',
['id', 'email', 'ip', 'country', 'domain', DB::raw('referer as refer'), DB::raw('status as read_status'), 'submit_time']
... ... @@ -83,15 +88,19 @@ class InquiryLogic extends BaseLogic
$search = $this->request['search'] ?: '';
$page = $this->request['page'] ?: 1;
$form_id = $this->request['form_id'] ?? '';
$field = InquiryForm::getField($form_id);
$ids = $this->request['ids'] ?? [];
$field = InquiryForm::getField($form_id, $this->user['project_id']);
$fields = ['id', 'data', 'ip', 'country', 'domain', DB::raw('referer as refer'), DB::raw('status as read_status'), DB::raw('submit_at as submit_time')];
$lists = InquiryFormData::where('form_id', $form_id)
->where(function ($query) use ($search, $field){
->where(function ($query) use ($search, $field,$ids){
if($search){
foreach ($field as $v){
$query->orWhere('data->' . $v, $search);
}
}
if($ids){
$query->whereIn('ids', $ids);
}
})
->select($fields)->orderBy('id', 'desc')->paginate($page_size, ['*'], 'page', $page);
$data = $lists->toArray();
... ... @@ -190,7 +199,7 @@ class InquiryLogic extends BaseLogic
if($data === false){
$url = 'https://fob.ai.cc/api/mobile_verify_data/'.$num_phone;
$data = http_get($url);
if(!empty($data)){
if(!empty($data) && ((strpos($data['wa_profile_pic'], 'pps.whatsapp.net') === false))){
$param = [
'phone'=>$phone,
'num_phone'=>$num_phone,
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Http\Logic\Bside\News;
use App\Enums\Common\Code;
use App\Helper\Arr;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\News\News;
use App\Models\News\NewsCategory;
... ... @@ -185,9 +186,7 @@ class NewsLogic extends BaseLogic
if(isset($param['image'])){
$param['image'] = str_replace_url($param['image'] ?? '');
}
if(isset($param['related_news_id'])){
$param['related_news_id'] = implode(',',$param['related_news_id']);
}
if(isset($this->param['id'])){
$param['operator_id'] = $this->user['id'];
}else{
... ... @@ -204,6 +203,9 @@ class NewsLogic extends BaseLogic
$this->fail('发布时间需大于当天');
}
}
if(isset($param['related_news_id'])){
$param['related_news_id'] = implode(',',$param['related_news_id']);
}
return $this->success($param);
}
... ...
... ... @@ -185,6 +185,7 @@ class UserLoginLogic
$info['open_export_product'] = $project['open_export_product'];
$info['is_update_language'] = $project['is_update_language'];
$info['is_watermark'] = $project['is_watermark'];
$project['deploy_build']['configuration']['is_product'] = $project['deploy_build']['configuration']['is_news'] = $project['deploy_build']['configuration']['is_blogs'] = $project['deploy_build']['configuration']['is_module'] = "1";
$info['configuration'] = $project['deploy_build']['configuration'];
$info['file_cdn'] = $project['deploy_build']['file_cdn'];
$info['project_type'] = $project['type'];
... ... @@ -292,6 +293,7 @@ class UserLoginLogic
$info['uptime'] = $project['uptime'];
$info['is_update_language'] = $project['is_update_language'];
$info['is_watermark'] = $project['is_watermark'];
$project['deploy_build']['configuration']['is_product'] = $project['deploy_build']['configuration']['is_news'] = $project['deploy_build']['configuration']['is_blogs'] = $project['deploy_build']['configuration']['is_module'] = "1";
$info['configuration'] = $project['deploy_build']['configuration'];
$info['project_type'] = $project['type'];
$info['storage_type'] = $project['storage_type'];
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Models\Com;
use App\Helper\Arr;
use App\Models\Base;
class KeywordVideoTask extends Base
... ... @@ -17,4 +18,10 @@ class KeywordVideoTask extends Base
const STATUS_CLOSE = 1;//停止
protected $table = 'gl_keyword_video_task';
public function getTemplateDataAttribute($value)
{
$value = Arr::s2a($value);
return $value;
}
}
... ...
... ... @@ -50,8 +50,8 @@ class InquiryForm extends Base
* @author zbj
* @date 2023/12/5
*/
public static function getField($form_id){
$cache_key = 'inquiry_form_field_' . $form_id;
public static function getField($form_id, $project_id){
$cache_key = 'inquiry_form_field_' . $project_id . '_' . $form_id;
$field = Cache::get($cache_key);
if(!$field){
$field = self::where('id', $form_id)->value('field');
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Models\Inquiry;
use App\Helper\Arr;
use App\Helper\QuanqiusouApi;
use App\Models\Base;
use App\Models\Domain\DomainInfo;
use App\Models\Project\Project;
use App\Models\Task\TaskOwner;
... ... @@ -15,7 +16,7 @@ use Illuminate\Database\Eloquent\Model;
* @author zbj
* @date 2024/10/25
*/
class ReInquiryCount extends Model
class ReInquiryCount extends Base
{
/**
* @var string
... ... @@ -66,9 +67,10 @@ class ReInquiryCount extends Model
}
public function getTasksAttribute(){
$tasks = ReInquiryTask::whereIn('id', $this->task_ids)->select(['title', 'industry','target'])->get()->toArray();
$tasks = ReInquiryTask::whereIn('id', $this->task_ids)->select(['title', 'industry','target', 'status'])->get()->toArray();
foreach ($tasks as &$task){
$target = collect($task['target'])->where('url', $this->domain)->first();
$task['is_del'] = $target ? 0 : 1;
$task['agent'] = $target['agent'] ?? '';
$task['is_v6'] = $target['is_v6'] ?? '';
$task['agent_group'] = $target['agent_group'] ?? '';
... ...
... ... @@ -28,6 +28,7 @@ Route::post('inquiry_submit', [\App\Http\Controllers\Api\InquiryController::clas
Route::post('editInquiryStatus', [\App\Http\Controllers\Api\InquiryController::class, 'editInquiryStatus'])->name('api.inquiry_editInquiryStatus');
Route::any('get_inquiry_random_ip', [\App\Http\Controllers\Api\InquiryController::class, 'getRandomIp'])->name('api.inquiry_getRandomIp');
Route::any('get_visit_url', [\App\Http\Controllers\Api\InquiryController::class, 'getVisitUrl'])->name('api.inquiry_getVisitUrl');
Route::any('get_fb_inquiry', [\App\Http\Controllers\Api\InquiryController::class, 'getFbInquiry'])->name('api.fb_inquiry');
Route::any('getOptimizationReport', [\App\Http\Controllers\Api\OptimizationReportController::class, 'getOptimizationReport'])->name('api.getOptimizationReport');
// 视频任务回调信息
Route::post('video_task_callback', [\App\Http\Controllers\Api\NoticeController::class, 'videoTaskCallback'])->name('api.video_task_callback');
... ...
... ... @@ -348,12 +348,13 @@ Route::middleware(['aloginauth'])->group(function () {
* 生成视频的项目
*/
Route::prefix('keyword_video')->group(function () {
Route::any('/', [Aside\Com\KeywordVideoController::class, 'lists'])->name('keyword_video_lists');
Route::any('/createKeywordTask', [Aside\Com\KeywordVideoController::class, 'createKeywordTask'])->name('keyword_video_createKeywordTask');
Route::any('/edit', [Aside\Com\KeywordVideoController::class, 'edit'])->name('keyword_video_edit');
Route::any('/getVideoTaskLog', [Aside\Com\KeywordVideoController::class, 'getVideoTaskLog'])->name('keyword_video_getVideoTaskLog');
Route::any('/taskNum', [Aside\Com\KeywordVideoController::class, 'taskNum'])->name('keyword_video_taskNum');
Route::any('/getVideoCount', [Aside\Com\KeywordVideoController::class, 'getVideoCount'])->name('keyword_video_getVideoCount');
Route::any('/', [Aside\KeywordVideo\KeywordVideoController::class, 'lists'])->name('keyword_video_lists');
Route::any('/createKeywordTask', [Aside\KeywordVideo\KeywordVideoController::class, 'createKeywordTask'])->name('keyword_video_createKeywordTask');
Route::any('/edit', [Aside\KeywordVideo\KeywordVideoController::class, 'edit'])->name('keyword_video_edit');
Route::any('/getVideoTaskLog', [Aside\KeywordVideo\KeywordVideoController::class, 'getVideoTaskLog'])->name('keyword_video_getVideoTaskLog');
Route::any('/taskNum', [Aside\KeywordVideo\KeywordVideoController::class, 'taskNum'])->name('keyword_video_taskNum');
Route::any('/getVideoCount', [Aside\KeywordVideo\KeywordVideoController::class, 'getVideoCount'])->name('keyword_video_getVideoCount');
Route::any('/get_template', [Aside\KeywordVideo\KeywordVideoController::class, 'get_template'])->name('keyword_get_template');
});
// 公共主题模版
... ...
... ... @@ -638,7 +638,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::group([], function () {
Route::any('/login', [\App\Http\Controllers\Bside\LoginController::class, 'login'])->name('login');
Route::any('/projectLogin', [\App\Http\Controllers\Bside\LoginController::class, 'projectLogin'])->name('projectLogin');
Route::any('/ceshi', [\App\Http\Controllers\Bside\LoginController::class, 'ceshi'])->name('ceshi');
Route::any('/ceshi', [\App\Http\Controllers\Bside\TestController::class, 'ceshi'])->name('ceshi');
Route::any('/file_manager_downLoad', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'downLoad'])->name('file_manager_downLoad');
Route::any('/stringTranslation', [\App\Http\Controllers\Bside\LoginController::class, 'stringTranslation'])->name('stringTranslation');
Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\LoginController::class, 'sendLoginSms'])->name('sendLoginSms');
... ...