作者 zhl

Merge remote-tracking branch 'origin/develop' into develop

正在显示 43 个修改的文件 包含 728 行增加266 行删除
... ... @@ -3,7 +3,6 @@
namespace App\Console\Commands\MonthlyCount;
use App\Helper\FormGlobalsoApi;
use App\Models\Project\DeployBuild;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
... ... @@ -74,24 +73,27 @@ class InquiryMonthlyCount extends Command
public function inquiryCount(&$arr,&$startTime,&$endTime,$domain){
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
//总数
$arr['total'] = $inquiry_list['data']['total'];
$arr['total'] = $inquiry_list['data']['total'] ?? 0;
//数据详情
$data = $inquiry_list['data']['data'];
$data = $inquiry_list['data']['data'] ?? 0;
$arr['month_total'] = 0;
$countryArr = [];
foreach ($data as $v){
if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
$arr['month_total']++;
}
if(isset($countryArr[$v['country']])){
$countryArr[$v['country']]++;
}else{
$countryArr[$v['country']] = 0;
$arr['country'] = "";
if(!empty($data)){
foreach ($data as $v){
if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
$arr['month_total']++;
}
if(isset($countryArr[$v['country']])){
$countryArr[$v['country']]++;
}else{
$countryArr[$v['country']] = 0;
}
}
arsort($countryArr);
$top20 = array_slice($countryArr, 0, 15, true);
$arr['country'] = json_encode($top20);
}
arsort($countryArr);
$top20 = array_slice($countryArr, 0, 15, true);
$arr['country'] = json_encode($top20);
return $arr;
}
... ...
... ... @@ -6,6 +6,7 @@ use App\Helper\Arr;
use App\Helper\SemrushApi;
use App\Models\RankData\ExternalLinks as ExternalLinksModel;
use App\Models\Project\DeployOptimize;
use App\Utils\LogUtils;
/**
* Class ExternalLinks
... ... @@ -39,7 +40,7 @@ class ExternalLinks extends BaseCommands
$semrushApi = new SemrushApi();
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray();
LogUtils::info('start rank_data_external_links:' . count($list));
foreach ($list as $project_id => $domain) {
if(!$domain){
continue;
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Console\Commands\RankData;
use App\Helper\QuanqiusouApi;
use App\Models\Project\DeployOptimize;
use App\Models\RankData\IndexedPages as IndexedPagesModel;
use App\Utils\LogUtils;
/**
* Class IndexedPages
... ... @@ -38,7 +39,7 @@ class IndexedPages extends BaseCommands
$api = new QuanqiusouApi();
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray();
LogUtils::info('start rank_data_indexed_pages:' . count($list));
foreach ($list as $project_id => $api_no) {
$model = IndexedPagesModel::where('project_id', $project_id)->first();
if($model && $model->updated_date == getThisWeekStarDate()){
... ...
... ... @@ -7,6 +7,7 @@ use App\Helper\QuanqiusouApi;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\RankData\RankData as GoogleRankModel;
use App\Utils\LogUtils;
/**
* Class GoogleRank
... ... @@ -41,6 +42,7 @@ class RankData extends BaseCommands
$api = new QuanqiusouApi();
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>' , 0)->select('api_no','minor_languages','project_id')->get();
LogUtils::info('start rank_data:' . count($list));
//当日所有站点谷歌收录数据
$site_res = $api->getSiteRes();
if(!$site_res){
... ...
... ... @@ -7,6 +7,7 @@ use App\Helper\Arr;
use App\Helper\QuanqiusouApi;
use App\Models\Project\DeployOptimize;
use App\Models\RankData\RankWeek as RankWeekModel;
use App\Utils\LogUtils;
/**
* Class WeekRank
... ... @@ -49,7 +50,7 @@ class RankWeek extends BaseCommands
$res = Arr::s2a($res);
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray();
LogUtils::info('start rank_data_week:' . count($list));
foreach ($list as $project_id => $api_no) {
$rank_week = RankWeekModel::where('project_id', $project_id)->first();
if ($rank_week && $rank_week->updated_date == getThisWeekStarDate()) {
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Console\Commands\RankData;
use App\Helper\SemrushApi;
use App\Models\RankData\RecommDomain as RecommDomainModel;
use App\Models\Project\DeployOptimize;
use App\Utils\LogUtils;
/**
* Class RecommDomain
... ... @@ -38,7 +39,7 @@ class RecommDomain extends BaseCommands
$semrushApi = new SemrushApi();
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray();
LogUtils::info('start rank_data_recomm_domain:' . count($list));
foreach ($list as $project_id => $domain) {
if(!$domain){
continue;
... ...
... ... @@ -6,6 +6,7 @@ use App\Helper\Arr;
use App\Helper\GoogleSpeedApi;
use App\Models\Project\DeployOptimize;
use App\Models\RankData\Speed as GoogleSpeedModel;
use App\Utils\LogUtils;
/**
* Class GoogleSpeed
... ... @@ -42,7 +43,7 @@ class Speed extends BaseCommands
//有排名api编号的项目
$list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray();
LogUtils::info('start rank_data_speed:' . count($list));
foreach ($list as $project_id => $domain) {
$model = GoogleSpeedModel::where('project_id', $project_id)->first();
if ($model && $model->updated_date == getThisWeekStarDate()) {
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Console\Commands;
use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\OaGlobalsoApi;
use App\Models\Channel\Channel;
use App\Models\Com\NoticeLog;
... ... @@ -16,6 +17,7 @@ use App\Utils\LogUtils;
use Hashids\Hashids;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
/**
* 同步项目信息
... ... @@ -60,13 +62,21 @@ class SyncProject extends Command
try {
$api = new OaGlobalsoApi();
$data = $api->order_info($item['data']['order_id']);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($data['data'], true) . PHP_EOL, FILE_APPEND);
if(!$data || empty($data['data'])){
LogUtils::error('OaGlobalsoApi order_info error', $data);
$this->retry($item);
}
if($data['data']['order_type'] == '首次'){
$this->sync($data['data']);
//同步aicc
if($data['data']['exclusive_aicc']){
$this->toAicc($data['data']);
}
//同步hagro
if($data['data']['exclusive_hagro']){
$this->toHagro($data['data']);
}
}
if($data['data']['order_type'] == '续费'){
$this->renewSync($data['data']);
... ... @@ -112,7 +122,7 @@ class SyncProject extends Command
'cooperate_date' => date('Y-m-d', $param['create_time']),
'service_duration' => $param['years'],
'plan' => $this->versionData($param['plan_marketing']),
'api_no' => $param['id'],
// 'api_no' => $param['id'], //改手动填
'amount' => $param['plan_price'],
'contract' => json_encode($param['files']),
'bill' => json_encode($param['images']),
... ... @@ -164,7 +174,9 @@ class SyncProject extends Command
'cooperate_date' => date('Y-m-d', $param['create_time']),
'from_order_id' => $param['from_order_id'],
'aicc' => $param['exclusive_aicc'],
"exclusive_aicc_day" => $param['exclusive_aicc_day'],
'hagro' => $param['exclusive_hagro'],
"exclusive_hagro_day" => $param['exclusive_hagro_day'],
'notice_order_id' => $param['id'],
],
'deploy_build' => [
... ... @@ -178,26 +190,22 @@ class SyncProject extends Command
'project_after' => [],
'payment' => [
'amount' => $param['plan_price'],
'contract' => !empty($param['files']) ? json_encode($param['files']) : " ",
'bill' => !empty($param['images']) ? json_encode($param['images']) : " ",
],
];
if(!empty($param['files'])){
$data['payment']['contract'] = json_encode($param['files']);
}
if(!empty($param['images'])){
$data['payment']['bill'] = json_encode($param['images']);
}
DB::beginTransaction();
try {
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(1111, true) . PHP_EOL, FILE_APPEND);
$id = $this->saveProject($data['project']);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($id, true) . PHP_EOL, FILE_APPEND);
$this->setPostId($data['deploy_build']['plan'],$id);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(222, true) . PHP_EOL, FILE_APPEND);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($data['payment'], true) . PHP_EOL, FILE_APPEND);
$this->setPostId($data['deploy_build']['plan'],$id);;
$this->savePayment($data['payment'],$id);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(444, true) . PHP_EOL, FILE_APPEND);
$this->saveDeployBuild($data['deploy_build'],$id);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(555, true) . PHP_EOL, FILE_APPEND);
$this->saveDeployOptimize($data['deploy_optimize'],$id);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(666, true) . PHP_EOL, FILE_APPEND);
$this->saveAfter($data['project_after'],$id);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export(777, true) . PHP_EOL, FILE_APPEND);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ... @@ -230,24 +238,9 @@ class SyncProject extends Command
* @time :2023/8/30 15:53
*/
public function saveProject($param){
if(isset($param['level']) && !empty($param['level'])){
$param['level'] = Arr::arrToSet($param['level']);
}
if(isset($param['channel']) && !empty($param['channel'])){
$param['channel'] = Arr::a2s($param['channel']);
}
if(isset($param['notice_file']) && !empty($param['notice_file'])){
foreach ($param['notice_file'] as &$v1) {
$v1['url'] = basename($v1['url']);
}
$param['notice_file'] = Arr::a2s($param['notice_file']);
}
if(isset($param['confirm_file']) && !empty($param['confirm_file'])){
foreach ($param['confirm_file'] as &$v2) {
$v2['url'] = basename($v2['url']);
}
$param['confirm_file'] = Arr::a2s($param['confirm_file']);
}
$projectModel = new Project();
return $projectModel->addReturnId($param);
}
... ... @@ -274,9 +267,6 @@ class SyncProject extends Command
protected function savePayment($param,$id){
$param['project_id'] = $id;
$paymentModel= new Payment();
if(isset($param['renewal_record']) && !empty($param['renewal_record'])){
$param['renewal_record'] = Arr::a2s($param['renewal_record']);
}
if(isset($param['contract']) && !empty($param['contract'])){
$param['contract'] = Arr::a2s($param['contract']);
}
... ... @@ -311,13 +301,63 @@ class SyncProject extends Command
*/
protected function saveDeployOptimize($param,$id){
$param['project_id'] = $id;
if(isset($param['minor_languages']) && !empty($param['minor_languages'])){
$param['minor_languages'] = Arr::a2s($param['minor_languages']);
}
if(isset($param['minor_keywords']) && !empty($param['minor_keywords'])){
$param['minor_keywords'] = Arr::a2s($param['minor_keywords']);
}
$deployOptimizeModel = new DeployOptimize();
return $deployOptimizeModel->add($param);
}
/**
* 同步到AICC
* @param $data
* @author zbj
* @date 2023/9/1
*/
protected function toAicc($data){
$url = 'https://biz.ai.cc/api/sync_company_for_order';
$param = [
'company_name' => $data['company_name'],
'company_address' => '',
'company_tel' => $data['principal_mobile'],
'company_email' => '',
'remark' => $data['remark'],
'level_id' => 6,
'level_day' => $data['exclusive_aicc_day'] ?: 1,
'from_order_id' => $data['from_order_id'],
];
//sign
ksort($param);
$tem = [];
foreach ($param as $key => $val) {
$tem[] = $key . '=' . urlencode($val);
}
$string = implode('&', $tem);
$key = md5('quanqiusou.com');
$param['sign'] = md5($string . $key);
$res = Http::withoutVerifying()->post($url, $param)->json();
if(empty($res['status']) || $res['status'] != 200){
LogUtils::error('ProjectToAicc error', $res);
}
}
/**
* 同步到Hagro
* @param $data
* @author zbj
* @date 2023/9/1
*/
protected function toHagro($data){
$url = 'https://beta.hagro.cn/globalso/create_project';
$param = [
'company' => $data['company_name'],
'phone' => $data['principal_mobile'],
'planday' => $data['exclusive_aicc_day'] ?: 1,
'from_order_id' => $data['from_order_id'],
];
$common = new Common();
$token = $common->encrypt($param);
$res = Http::withoutVerifying()->get($url, ['token' => $token])->json();
if(empty($res['code']) || $res['code'] != 200){
LogUtils::error('ProjectToHagro error', $res);
}
}
}
... ...
... ... @@ -20,7 +20,7 @@ class Kernel extends ConsoleKernel
$schedule->command('rank_data_speed')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次
$schedule->command('rank_data_external_links')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
$schedule->command('rank_data_indexed_pages')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次
// $schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
$schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
$schedule->command('rank_data_week')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
$schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
$schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
... ...
... ... @@ -437,7 +437,7 @@ if (!function_exists('getImageUrl')) {
$cosCdn = $cos['cdn'];
$url = $cosCdn.$info['path'];
}else{
$url = url('upload'.$info['path']);
$url = url($info['path']);
}
}else{
$url = $hash;
... ... @@ -470,7 +470,7 @@ if (!function_exists('getFileUrl')) {
if($info['is_cos'] == 1){
$cos = config('filesystems.disks.cos');
$cosCdn = $cos['cdn'];
$url = $cosCdn.$info['path'];
$url = $cosCdn.'/upload'.$info['path'];
}else{
$url = url('upload'.$info['path']);
}
... ... @@ -526,7 +526,7 @@ if (!function_exists('str_replace_url')) {
$urlParts = parse_url($url);
// 检查是否存在 host(域名)部分
if (isset($urlParts['path'])) {
$urlWithoutDomain = str_replace('/upload', '', $urlParts['path']);
$urlWithoutDomain = $urlParts['path'];
return $urlWithoutDomain;
} else {
return $url;
... ...
<?php
/**
* @remark :
* @name :UpdateController.php
* @author :lyh
* @method :post
* @time :2023/8/19 9:08
*/
namespace App\Http\Controllers\Aside\Com;
use App\Helper\Common;
use App\Http\Controllers\Bside\BaseController;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
/**
* @remark :b端网站更新相关
* @name :UpdateController
* @author :lyh
* @method :post
* @time :2023/8/19 9:08
*/
class UpdateController extends BaseController
{
/**
* @remark :一键更新所有tdk
* @name :updateSeoTdk
* @author :lyh
* @method :post
* @time :2023/8/19 9:25
*/
public function updateSeoTdk(){
$this->request->validate([
'project_id'=>'required',
],[
'project_id.required' => 'project_id不能为空',
]);
ProjectServer::useProject($this->param['project_id']);
$this->updateProduct($this->param['project_id']);
$this->updateBlogs($this->param['project_id']);
$this->updateNews($this->param['project_id']);
DB::disconnect('custom_mysql');
$this->response('success');
}
/**
* @remark :更新产品tdk
* @name :updateProduct
* @author :lyh
* @method :post
* @time :2023/8/19 9:25
*/
public function updateProduct($project_id){
$list = DB::connection('custom_mysql')->table('gl_product')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray();
if(!empty($list)){
foreach ($list as $v){
if(!empty($v['seo_mate'])){
$seo_arr = $v['seo_mate'];
//更新seo_title
if(!isset($seo_arr['title'])){
//生成seo_title
$seo_arr['title'] = $this->ai_send('product_seo_title',$v['title']);
}
//更新seo_keyword
if(!isset($seo_arr['keyword'])){
$seo_arr['keyword'] = $this->ai_send('product_seo_keyword',$v['title']);
}
//更新seo_keyword
if(!isset($seo_arr['description'])){
$seo_arr['description'] = $this->ai_send('product_seo_description',$v['title']);
}
$ser_str = json_encode($seo_arr,true);
DB::connection('custom_mysql')->table('gl_product')->where(['id'=>$v['id']])->update(['seo_mate'=>$ser_str]);
}
}
}
return true;
}
/**
* @remark :更新新闻Tdk
* @name :updateNews
* @author :lyh
* @method :post
* @time :2023/8/19 10:06
*/
public function updateNews($project_id){
$list = DB::connection('custom_mysql')->table('gl_news')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray();
if(!empty($list)){
foreach ($list as $k => $v){
$data = [];
if(empty($v['seo_title'])){
$data['seo_title'] = $this->ai_send('news_seo_title',$v['name']);
}
if(empty($v['seo_keywords'])){
$data['seo_keywords'] = $this->ai_send('news_seo_keyword',$v['name']);
}
if(empty($v['seo_description'])){
$data['seo_description'] = $this->ai_send('news_seo_description',$v['name']);
}
DB::connection('custom_mysql')->table('gl_news')->where(['id'=>$v['id']])->update($data);
}
}
return true;
}
/**
* @remark :更新blogTdk
* @name :updateBlogs
* @author :lyh
* @method :post
* @time :2023/8/19 10:07
*/
public function updateBlogs($project_id){
$list = DB::connection('custom_mysql')->table('gl_blog')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray();
if(!empty($list)){
foreach ($list as $k => $v){
$data = [];
if(empty($v['seo_title'])){
$data['seo_title'] = $this->ai_send('blog_seo_title',$v['name']);
}
if(empty($v['seo_keywords'])){
$data['seo_keywords'] = $this->ai_send('blog_seo_keyword',$v['name']);
}
if(empty($v['seo_description'])){
$data['seo_description'] = $this->ai_send('blog_seo_description',$v['name']);
}
DB::connection('custom_mysql')->table('gl_product')->where(['id'=>$v['id']])->update($data);
}
}
return true;
}
/**
* @remark :AI发送
* @name :ai_send
* @author :lyh
* @method :post
* @time :2023/8/19 10:40
*/
public function ai_send($key,$keywords){
$chat_url = 'v2/openai_chat';
$param = [
'key'=>$key,
'keywords'=>$keywords,
];
$data = Common::send_openai_msg($chat_url,$param);
return $data['text'];
}
}
... ...
... ... @@ -104,8 +104,10 @@ class ManageController extends BaseController
public function setSort(ManageLogic $logic){
$this->request->validate([
'id'=>'required',
'sort'=>'required',
],[
'id.required' => 'ID不能为空',
'sort.required' => 'sort不能为空',
]);
$logic->setParamStatus();
$this->response('success');
... ...
<?php
/**
* @remark :
* @name :KeywordsController.php
* @author :lyh
* @method :post
* @time :2023/9/4 10:12
*/
namespace App\Http\Controllers\Aside\Optimize;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
class KeywordsController extends BaseController
{
/**
* @remark :关键字查案例
* @name :lists
* @author :lyh
* @method :post
* @time :2023/9/4 10:13
*/
public function lists(){
$projectDeployOptimizeModel = new DeployOptimize();
$ids = $projectDeployOptimizeModel->where('customer_keywords','like','%'.$this->map['search'].'%')
->orWhere('main_keywords', 'like' , '%'.$this->map['search'].'%')->pluck('project_id')->toArray();
$projectModel = new Project();
$lists = $projectModel->formatQuery(['id'=>['in',$ids]])->with('payment')->with('deploy_build')
->with('deploy_optimize')->get()->toArray();
$this->response('success',Code::SUCCESS,$lists);
}
}
... ...
... ... @@ -41,8 +41,10 @@ class TaskController extends BaseController
$lists = [];
//获取所有人员
$taskOwnerModel = new TaskOwner();
$manager_list = $taskOwnerModel->select('manage_id', DB::raw('COUNT(*) as count'))
$map = $this->searchParam($task,$taskOwnerModel);
$manager_list = $taskOwnerModel->formatQuery($map)->select('manage_id', DB::raw('COUNT(*) as count'))
->groupBy('manage_id')->get()->toArray();
$managerModel = new Manage();
foreach ($manager_list as $k => $v){
$ids = $taskOwnerModel->where('manage_id', $v['manage_id'])->pluck('task_id')->toArray();
... ... @@ -55,6 +57,47 @@ class TaskController extends BaseController
}
/**
* @remark :
* @name :searchParam
* @author :lyh
* @method :post
* @time :2023/9/1 15:37
*/
public function searchParam(&$task,&$taskOwnerModel){
$map = [];
if(isset($this->map['type']) && !empty($this->map['type'])){
if(isset($this->map['manage_id']) && !empty($this->map['manage_id'])){
if($this->map['type'] == 1){
$ids = $task->where('created_manage_id', $this->map['manage_id'])->pluck('id')->toArray();
$manage_ids = $taskOwnerModel->formatQuery(['task_id'=>['in',$ids]])->pluck('manage_id')->toArray();
$map['manage_id'] = ['in',$manage_ids];
}else{
$map['manage_id'] = $this->map['manage_id'];
}
}
}elseif (isset($this->map['search_type']) && !empty($this->map['search_type'])){
if(isset($this->map['search']) && !empty($this->map['search'])) {
$projectModel = new Project();
if($this->map['search_type'] == 'project'){
$ids = $projectModel->where('title', 'like', '%' . $this->map['search'] . '%')->pluck('id')->toArray();
$manage_ids = $taskOwnerModel->formatQuery(['project'=>['in',$ids]])->pluck('manage_id')->toArray();
$map['manage_id'] = ['in',$manage_ids];
}else{
$ids = $task->where('content', 'like','%'.$this->map['search'].'%')->pluck('id')->toArray();
$manage_ids = $taskOwnerModel->formatQuery(['task_id'=>['in',$ids]])->pluck('manage_id')->toArray();
$map['manage_id'] = ['in',$manage_ids];
}
}
}else{
if(isset($this->map['search_type']) && !empty($this->map['search_type'])){
$map['manage_id'] = $this->map['manage_id'];
}
}
return $map;
}
/**
* @remark :获取详情
* @name :info
* @author :lyh
... ... @@ -162,4 +205,29 @@ class TaskController extends BaseController
}
return $v;
}
/**
* @remark :获取我的任务列表
* @name :getUserTaskList
* @author :lyh
* @method :post
* @time :2023/9/4 9:14
*/
public function getUserTaskList(){
$taskOwnerModel = new TaskOwner();
$this->map['manage_id'] = $this->manage['id'];
$lists = $taskOwnerModel->lists($this->map,$this->page,$this->row,$this->order);
if(!empty($lists) && !empty($lists['list'])){
$taskModel = new Task();
$managerModel = new Manage();
foreach ($lists['list'] as $k => $v){
$taskInfo = $taskModel->read(['id'=>$v['task_id']]);
$taskInfo = $this->getFileUrl($taskInfo);
$v["manage_id_text"] = $managerModel->getName($v['manage_id']);
$v['task_info'] = $taskInfo;
$lists['list'][$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
}
}
... ...
... ... @@ -30,7 +30,8 @@ class ProjectMenuController extends BaseController
* @time :2023/6/21 17:24
*/
public function lists(ProjectMenuLogic $projectMenuLogic){
$lists = $projectMenuLogic->MenuList($this->map);
$this->order = 'sort';
$lists = $projectMenuLogic->MenuList($this->map,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
... ... @@ -137,4 +138,21 @@ class ProjectMenuController extends BaseController
$list = $projectMenuLogic->roleMenuInfo();
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :排序
* @name :setSort
* @author :lyh
* @method :post
* @time :2023/8/10 16:40
*/
public function sort(ProjectMenuLogic $projectMenuLogic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$projectMenuLogic->setParamStatus();
$this->response('success');
}
}
... ...
... ... @@ -145,4 +145,21 @@ class ProjectUserController extends BaseController
$list = $roleModel->list($this->map);
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :排序
* @name :setSort
* @author :lyh
* @method :post
* @time :2023/8/10 16:40
*/
public function sort(UserLogic $userLogic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$userLogic->setParamStatus();
$this->response('success');
}
}
... ...
... ... @@ -9,6 +9,7 @@ use App\Http\Logic\Bside\User\UserLogic;
use App\Models\Project\Project;
use App\Models\User\ProjectMenu as ProjectMenuModel;
use App\Models\User\ProjectRole as ProjectRoleModel;
use App\Models\User\User;
use Illuminate\Support\Facades\Cache;
/***
... ... @@ -72,7 +73,7 @@ class ComController extends BaseController
]);
$userLogic = new UserLogic();
$this->param['id'] = $this->uid;
$userLogic->edits($this->param);
$userLogic->edits();
$this->response('编辑成功');
}
... ... @@ -92,6 +93,22 @@ class ComController extends BaseController
}
/**
* @remark :微信解绑
* @name :unbindWechat
* @author :lyh
* @method :post
* @time :2023/9/1 16:47
*/
public function unbindWechat(){
$userModel = new User();
$rs = $userModel->edit(['wechat'=>''],['id'=>$this->user['id']]);
if($rs === false){
$this->response('error',Code::USER_ERROR);
}
$this->response('success');
}
/**
* @remark :生成token
* @name :generateToken
* @author :lyh
... ... @@ -101,7 +118,7 @@ class ComController extends BaseController
public function generateToken(){
$data = [
'phone' => $this->user['mobile'],
'from_order_id' => $this->param['from_order_id'] ?? '5a179274si3j8z', // 提单系统 同步到个项目的唯一凭证(数字或者字符串)
'from_order_id' => $this->user['from_order_id'] ?? '5a179274si3j8z', // 提单系统 同步到个项目的唯一凭证(数字或者字符串)
'timestamp' => time(), // 接收到字符串解密出来以后需要 验证时间不超过30秒 超过时间视为无效授权
];
$common = new Common();
... ...
... ... @@ -27,7 +27,7 @@ class MonthCountController extends BaseController
* @time :2023/6/30 17:58
*/
public function lists(MonthCountLogic $monthCountLogic){
$lists = $monthCountLogic->getCountLists($this->map,$this->page,$this->row = 10,$this->order);
$lists = $monthCountLogic->getCountLists($this->map,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
... ...
... ... @@ -12,20 +12,23 @@ namespace App\Http\Controllers\Bside;
use App\Enums\Common\Code;
use App\Events\WebSocketMessage;
use App\Events\WebSocketMessageSent;
use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\Socket;
use App\Helper\Translate;
use App\Helper\Wechat;
use App\Http\Logic\Bside\User\UserLogic;
use App\Http\Logic\Bside\User\UserLoginLogic;
use App\Models\File\Image;
use App\Models\File\Image as ImageModel;
use App\Models\Project\Project;
use App\Models\Service\Service;
use App\Models\Sms\SmsLog;
use App\Models\Template\Template;
use App\Models\Template\TemplateModule;
use App\Models\User\DeptUser;
use App\Models\User\ProjectRole;
use App\Models\User\User;
use App\Models\User\User as UserModel;
use App\Utils\EncryptUtils;
use Illuminate\Database\Eloquent\Model;
use \Illuminate\Support\Facades\Cache;
use Mrgoon\AliSms\AliSms;
... ... @@ -152,9 +155,17 @@ class LoginController extends BaseController
* @time :2023/8/23 18:46
*/
public function qrcode(){
$this->request->validate([
'type' => 'required',
],[
'type.required' => '请选择项目',
]);
if(!isset($this->param['id'])){
$this->param['id'] = 0;
}
$wechat = new Wechat();
$accessToken = $wechat->getAccessToken();
$data = $wechat->setQrcode('global-v6',$accessToken);
$data = $wechat->setQrcode('global-v6_'.$this->param['type'].'_'.$this->param['id'],$accessToken);
if(!empty($data)){
$data['url'] = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=".$data['ticket'];
}
... ... @@ -171,27 +182,44 @@ class LoginController extends BaseController
public function eventMessage(){
$message = file_get_contents("php://input");
$message = simplexml_load_string($message, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOERROR);
$data = $this->wechatLogin($message->FromUserName);
$socket = new Socket();
$socket->socket(json_encode($data));
$arr = [
'ToUserName' => 'gh_27174ac5c9d8',
'FromUserName' => 'oMbcI6gRzvfrU8ssGsEyvzXOO94w',
'CreateTime' => '1693385898',
'MsgType' => 'event',
'Event' => 'subscribe',
'EventKey' => 'qrscene_global-v6_v6',
'Ticket' => 'gQF27zwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyWnppdHhWTlRjOEcxTlBpTE5BY2IAAgRjBO9kAwQQDgAA',
];
$jsonData = json_encode($message);
$arrayData = json_decode($jsonData, true);
$data = $this->setWechat($arrayData['ToUserName'],$arrayData['EventKey']);
if($data['code'] == 0){//登录失败,请先绑定
$resMessage = $data['message'];
}elseif($data['code'] == 1){
$resMessage = $data['message'];
}elseif($data['code'] == 2){
$resMessage = $data['message'];
}else{
$resMessage = $data['message'];
}
Cache::add($arrayData['Ticket'],$data,300);
return "<xml>
<ToUserName><![CDATA[$message->FromUserName]]></ToUserName>
<FromUserName><![CDATA[$message->ToUserName]]></FromUserName>
<CreateTime>".time()."</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[扫码成功了]]></Content>
<Content><![CDATA[$resMessage]]></Content>
</xml>";
}
/**
* @remark :登录成功响应
* @name :getWechatLoginInfo
* @author :lyh
* @method :post
* @time :2023/9/1 10:12
*/
public function getWechatLoginInfo(){
$this->request->validate([
'ticket' => 'required',
],[
'ticket.required' => 'ticket不能为空',
]);
$info = Cache::get($this->param['ticket']);
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :解token
... ... @@ -202,19 +230,45 @@ class LoginController extends BaseController
*/
public function globalSo_v6_login(UserLoginLogic $logic){
$common = new Common();
$arr = $common->decrypt($this->param['token']);
$arr = $common->decrypt(urldecode($this->param['token']));
if(empty($arr)){
$this->response('登录失败',Code::USER_ERROR);
}
$userModel = new UserModel();
$info = $userModel->read(['mobile'=>$arr['phone']]);
if($info === false){
$this->response('当前用户不存在请联系管理员',Code::USER_ERROR);
//没有from_order_id的项目 进入演示版 运营中心
$arr['from_order_id'] = 0;
if(!$arr['from_order_id']){
//有账号就直接登录, 没有账号创建账号登录
$user = (new User())->where('project_id', Project::DEMO_PROJECT_ID)->where('mobile', $arr['phone'])->first();
if(!$user){
$user = new User();
$user->project_id = Project::DEMO_PROJECT_ID;
$user->role_id = ProjectRole::OPERATION_CENTER_ID;
$user->mobile = $arr['phone'];
$user->password = base64_encode(md5('v6.' . substr($arr['phone'], -6)));
$user->name = $arr['name'] ?? $arr['phone'];
$user->save();
//运营中心组织
$dept_user = new DeptUser();
$dept_user->dept_id = DeptUser::OPERATION_CENTER_ID;
$dept_user->project_id = Project::DEMO_PROJECT_ID;
$dept_user->user_id = $user->id;
$dept_user->save();
}
$data = [
'user_id'=>$user['id'],
'manager_id'=>0,
];
}else{
//有from_order_id, 找到对应的项目并登录主账号
$project = (new Project())->read(['from_order_id'=>$arr['from_order_id']]);
if(!$project){
$this->response('项目不存在,请联系管理员',Code::USER_ERROR);
}
$data = [
'project_id'=>$project['id'],
'manager_id'=>0,
];
}
$data = [
'user_id'=>$info['id'],
'manager_id'=>0,
];
$info = $logic->autologin($data);
$this->response('success',Code::SUCCESS,['info'=>$info]);
}
... ... @@ -226,96 +280,37 @@ class LoginController extends BaseController
* @method :post
* @time :2023/8/31 9:13
*/
public function wechatLogin($wechat){
//查看当前账户是否绑定
$userModel = new UserModel();
$info = $userModel->read(['wechat'=>$wechat]);
if($info === false){
$data = [
'code'=>Code::USER_LOGIN_ERROE,
'message'=>'当前用户未绑定账户,请绑定后',
];
}else {
//获取项目详情
$info = $this->assembleParam($info['mobile'],$info['project_id']);
if(isset($info['token']) && !empty($info['token'])){
//清除上一次用户缓存
Cache::pull($info['token']);
}
//生成新token
$token = md5(uniqid().$info['id']);
//存储缓存
$info['token'] = $token;
Cache::add($token,$info,3600);
//更新用户信息
$this->model->edit(['token'=>$token],['id'=>$info['id']]);
public function setWechat($wechat,$eventKey){
$userLoginLogic = new UserLoginLogic();
$key = explode("_",$eventKey);
if($key[1] == 'login'){
$data = $userLoginLogic->wechatLogin($wechat);
}elseif($key[1] == 'bind'){
$data = $userLoginLogic->wechatBind($wechat,$key[2]);
}else{
$data = [
'code'=>Code::SUCCESS,
'message'=>'当前用户未绑定账户,请绑定后',
'data'=>$info
'code'=>0,
'message'=>'关注成功,请登录后绑定账号后扫码,如已绑定,请再次扫码',
];
}
return $data;
}
public function ceshi(){
}
public function daoru(){
$templateModel = new Template();
$list = $templateModel->list();
foreach ($list as $k => $v){
preg_match_all('/\(https:\/\/admin.item.globalso.site\/a\/image\/(.*?)\)/', $v['html'], $matches);
if (!empty($matches[1])) {
$srcValues = $matches[1];
$imageModel = new Image();
$html = $v['html'];
foreach ($srcValues as $srcValue) {
$image_info = $imageModel->read(['hash' => $srcValue]);
if ($image_info !== false) {
$path = $image_info['path'];
$html = $this->re($html, '/a/image/'.$srcValue, $path);
}
}
$templateModel->edit(['html'=>$html],['id'=>$v['id']]);
}
}
return 1;
}
public function re(&$html,$srcValue,$path){
$html = str_replace(
$srcValue,
$path,
$html
);
return $html;
}
public function updateHtml(){
$html = $this->re($v['html'],'https://develop.globalso.com/a/image/','https://ecdn6.globalso.com/public/template/');
$html = $this->re($v['html'],'https://develop.globalso.com/b/image/','https://ecdn6.globalso.com/public/template/');
}
public function updateCe(){
$templateModel = new TemplateModule();
$list = [];
foreach ($list as $k => $v){
preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches);
if (!empty($matches[1])) {
$srcValues = $matches[1];
$imageModel = new Image();
$html = $v['html'];
foreach ($srcValues as $srcValue) {
$image_info = $imageModel->read(['hash' => $srcValue]);
if ($image_info !== false) {
$path = basename($image_info['path']);
$html = $this->re($html, $srcValue, $path);
}
$list = $templateModel->list();
$imageModel = new ImageModel();
foreach ($list as $k=>$v){
if (strpos($v['image'], '.') !== false) {
$v['image'] = '/upload'.$v['image'];
}else{
$info = $imageModel->read(['hash'=>$v['image']]);
if($info !== false){
$v['image'] = $info['path'];
}
}
$templateModel->edit(['html'=>$html],['id'=>$v['id']]);
$templateModel->edit(['image'=>$v['image']],['id'=>$v['id']]);
}
$this->response('success');
}
}
... ...
... ... @@ -62,6 +62,9 @@ class RankDataController extends BaseController
$data = $googleSpeedApi->run($domain);
if($data){
$model = GoogleSpeedModel::where('project_id', $project_id)->first();
if(!$model){
$model = new GoogleSpeedModel();
}
$model->project_id = $project_id;
$model->data = $data;
$model->updated_date = date('Y-m-d');
... ...
... ... @@ -54,7 +54,7 @@ class UserController extends BaseController
* @author :liyuhang
* @method
*/
public function edit(UserRequest $request,UserLogic $userLogic){
public function edit(Request $request,UserLogic $userLogic){
$request->validate([
'id'=>['required']
],[
... ...
... ... @@ -23,7 +23,7 @@ class FileController
public $token = '';//token
public $cache = '';//缓存数据
public $upload_location = 0;
public $upload_location = 1;
public $file_type = [
2 => 'other',//其他
1 => 'video',//视频
... ... @@ -222,7 +222,7 @@ class FileController
*/
public function downLoad(){
$file_model = new File();
$info = $file_model->read(['hash' => $this->param['hash']]);
$info = $file_model->read(['path' => $this->param['path']]);
if ($info === false) {
$this->response('指定文件不存在!', Code::USER_ERROR);
}
... ... @@ -265,8 +265,8 @@ class FileController
//根据项目上传标识区分上传到cos/本地
$projectModel = new Project();
$project_info = $projectModel->read(['id' => $this->cache['project_id']], ['project_location']);
if ($project_info['project_location'] == 0) {//通项目时 上传到cos
$this->upload_location = 1;//1:上传到本地
if ($project_info['project_location'] != 0) {//通项目时 上传到cos
$this->upload_location = 0;//1:上传到本地
}
}
$this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m');
... ... @@ -314,11 +314,11 @@ class FileController
*/
public function getDownloadUrl(){
$fileModel = new File();
$info = $fileModel->read(['hash' => $this->param['hash']]);
$info = $fileModel->read(['path' => $this->param['path']]);
if ($info === false) {
$this->response('指定文件不存在!', Code::USER_ERROR);
}
$data = ['file_download'=>url('a/downLoad/files?hash='.$this->param['hash'])];
$data = ['file_download'=>url('a/downLoad/files?path='.$this->param['path'])];
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -16,7 +16,7 @@ use Intervention\Image\Facades\Image;
class ImageController extends Controller
{
public $path = '';//路径
public $path = '/upload';//路径
public $config = '';//存储默认配置
... ... @@ -35,7 +35,7 @@ class ImageController extends Controller
public $map = [];
public $upload_location = 0;//是否同步到cos
public $upload_location = 1;//是否同步到cos
//上传图片类型
public $image_type = [
1 => 'image_product',
... ... @@ -291,7 +291,7 @@ class ImageController extends Controller
*/
public function download(){
$imageModel = new ImageModel();
$info = $imageModel->read(['hash' => $this->param['hash']]);
$info = $imageModel->read(['path' => $this->param['path']]);
if ($info === false) {
$this->response('指定文件不存在!', Code::USER_ERROR);
}
... ... @@ -372,8 +372,8 @@ class ImageController extends Controller
//根据项目上传标识区分上传到cos/本地
$projectModel = new Project();
$project_info = $projectModel->read(['id'=>$this->cache['project_id']],['project_location']);
if ($project_info['project_location'] == 0) {//普通项目时 上传到cos
$this->upload_location = 1;//上传到cos
if ($project_info['project_location'] != 0) {//危险项目时 上传到本地
$this->upload_location = 0;//上传到cos
}
}
$this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->image_type[$this->param['refer']].'/'.date('Y-m');
... ... @@ -404,11 +404,11 @@ class ImageController extends Controller
*/
public function getDownloadUrl(){
$imageModel = new ImageModel();
$info = $imageModel->read(['hash' => $this->param['hash']]);
$info = $imageModel->read(['path' => $this->param['path']]);
if ($info === false) {
$this->response('指定文件不存在!', Code::USER_ERROR);
}
$data = ['image_download'=>url('a/downLoad/images?hash='.$this->param['hash'])];
$data = ['image_download'=>url('a/downLoad/images?path='.$this->param['path'])];
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Http\Logic\Aside\Domain;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Domain\DomainInfo;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
... ... @@ -109,7 +110,16 @@ class DomainInfoLogic extends BaseLogic
* @time :2023/8/1 15:41
*/
public function delDomain(){
$this->param['id'] = ['in',$this->param['id']];
$ids = $this->param['id'];
foreach ($ids as $k => $v){
$info = $this->model->read(['id'=>$v]);
$deployOptimizeModel = new DeployOptimize();
$domainInfo = $deployOptimizeModel->read(['domain'=>$info['domain']]);
if($domainInfo !== false){
$this->fail('当前域名正在使用中');
}
}
$this->param['id'] = ['in',$ids];
$rs = $this->model->del($this->param);
if($rs === false){
$this->fail('error');
... ...
... ... @@ -48,7 +48,7 @@ class ProjectLogic extends BaseLogic
*/
public function getProjectInfo($id){
// $info = Common::get_user_cache($this->model->getTable(),$id);
if(empty($info)){
// if(empty($info)){
$info = $this->model->with('payment')->with('deploy_build')->with('deploy_optimize')->with('online_check')
->with('project_after')->where(['id'=>$id])->first()->toArray();
if(!empty($info['online_check']['created_manage_id'])){
... ... @@ -64,7 +64,7 @@ class ProjectLogic extends BaseLogic
$info['type'] = $info['extend_type'];
}
// Common::set_user_cache($info,$this->model->getTable(),$id);
}
// }
return $this->success($info);
}
... ... @@ -117,13 +117,13 @@ class ProjectLogic extends BaseLogic
}
if(isset($param['notice_file']) && !empty($param['notice_file'])){
foreach ($param['notice_file'] as &$v1) {
$v1['url'] = basename($v1['url']);
$v1['url'] = str_replace_url($v1['url']);
}
$param['notice_file'] = Arr::a2s($param['notice_file']);
}
if(isset($param['confirm_file']) && !empty($param['confirm_file'])){
foreach ($param['confirm_file'] as &$v2) {
$v2['url'] = basename($v2['url']);
$v2['url'] = str_replace_url($v2['url']);
}
$param['confirm_file'] = Arr::a2s($param['confirm_file']);
}
... ... @@ -142,7 +142,12 @@ class ProjectLogic extends BaseLogic
*/
protected function saveProjectPayment($payment){
$paymentModel = new Payment();
// $payment['contract'] = Arr::a2s($payment['contract']);
if(isset($payment['contract']) && !empty($payment['contract'])){
$payment['contract'] = Arr::a2s($payment['contract']);
}
if(isset($payment['bill']) && !empty($payment['bill'])){
$payment['bill'] = Arr::a2s($payment['bill']);
}
if(isset($payment['renewal_record']) && !empty($payment['renewal_record'])){
$payment['renewal_record'] = Arr::a2s($payment['renewal_record']);
}
... ...
... ... @@ -29,17 +29,17 @@ class ServiceLogic extends BaseLogic
case 'images':
$arr = explode(',',$v['values']);
foreach ($arr as $k1 => $v1){
$v['images_link'][$k1] = url('a/image/'.$v1);
$v['images_link'][$k1] = getImageUrl($v1);
}
break;
case 'android':
$v['android_link'] = url('a/image/'.$v['values']);
$v['android_link'] = getImageUrl($v['values']);
break;
case 'official_account':
$v['android_link'] = url('a/image/'.$v['values']);
$v['android_link'] = getImageUrl($v['values']);
break;
case 'ios':
$v['ios_link'] = url('a/image/'.$v['values']);
$v['ios_link'] = getImageUrl($v['values']);
break;
}
$lists[$k] = $v;
... ...
... ... @@ -107,26 +107,11 @@ class ATemplateModuleLogic extends BaseLogic
*/
public function aTemplateModuleDel(){
//TODO::查看当前模板是否有模板在使用
$rs = $this->model->edit(['deleted_status'=>1,'deleted_at'=>date('Y-m-d H:i:s')],['id'=>$this->param['id']]);
$rs = $this->model->edit(['deleted_status'=>1],['id'=>$this->param['id']]);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
/**
* @remark :如果是图片名称返回图片hash值
* @name :imageName
* @author :lyh
* @method :post
* @time :2023/8/31 11:49
*/
public function imageName($string){
$imageModel = new Image();
if (strpos($string, '.') !== false) {
$info = $imageModel->read(['path'=>['like','%'.$string.'%']]);
$string = $info['hash'];
}
return $string;
}
}
... ...
... ... @@ -115,4 +115,19 @@ class ProjectMenuLogic extends BaseLogic
$list = $this->model->list(['pid'=>$this->param['id'], 'is_role'=>1]);
return $this->success($list);
}
/**
* @remark :设置排序
* @name :setSort
* @author :lyh
* @method :post
* @time :2023/8/10 16:42
*/
public function setParamStatus(){
$rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]);
if($rs === false){
$this->fail('修改失败');
}
return $this->success();
}
}
... ...
... ... @@ -159,4 +159,19 @@ class UserLogic extends BaseLogic
Common::del_user_cache($this->model, $ids, 'A');
return $this->success();
}
/**
* @remark :设置排序
* @name :setSort
* @author :lyh
* @method :post
* @time :2023/8/10 16:42
*/
public function setParamStatus(){
$rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]);
if($rs === false){
$this->fail('修改失败');
}
return $this->success();
}
}
... ...
... ... @@ -174,8 +174,8 @@ class BTemplateLogic extends BaseLogic
*/
public function templateSave(){
//查询当前模版是否已保存
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
$info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']);
//字符串截取
$this->param = $this->stringProcessing($this->param);
... ... @@ -186,11 +186,13 @@ class BTemplateLogic extends BaseLogic
$this->model->edit($this->param,['id'=>$info['id']]);
}
$this->setTemplateLog($this->param);
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('error');
// }
//路由映射
RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
//通知更新
$this->homeOrProduct($this->param['source'],$this->param['source_id']);
return $this->success();
... ...
... ... @@ -182,17 +182,17 @@ class CountLogic extends BaseLogic
case 'images':
$arr = explode(',',$v['values']);
foreach ($arr as $k1 => $v1){
$v['images_link'][$k1] = url('a/image/'.$v1);
$v['images_link'][$k1] = getImageUrl($v1);
}
break;
case 'android':
$v['android_link'] = url('a/image/'.$v['values']);
$v['android_link'] = getImageUrl($v['values']);
break;
case 'official_account':
$v['official_account_link'] = url('a/image/'.$v['values']);
$v['official_account_link'] = getImageUrl($v['values']);
break;
case 'ios':
$v['ios_link'] = url('a/image/'.$v['values']);
$v['ios_link'] = getImageUrl($v['values']);
break;
}
$lists[$k] = $v;
... ...
... ... @@ -26,12 +26,10 @@ class MonthCountLogic extends BaseLogic
* @method :post
* @time :2023/7/3 9:39
*/
public function getCountLists($map,$page,$row = 10,$order = 'created_at',$filed = ['*']){
public function getCountLists($map,$order = 'created_at',$filed = ['*']){
$map['project_id'] = $this->user['project_id'];
$lists = $this->model->lists($map,$page,$row,$order,$filed);
if(!empty($lists)){
$lists['list']['new'] = $this->currentMonthCount();
}
$lists = $this->model->list($map,$order,$filed);
$lists['new'] = $this->currentMonthCount();
return $this->success($lists);
}
... ... @@ -99,7 +97,7 @@ class MonthCountLogic extends BaseLogic
public function flowCount(&$arr,&$startTime,&$endTime,$project_id){
$pv_ip = DB::table('gl_count')
->where(['project_id'=>$project_id])
->whereBetween('date', [$startTime.' 00:00:00',$endTime.' 23:59:59'])
->whereBetween('date', [$startTime,$endTime])
->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))
->first();
$arr['pv'] = $pv_ip->pv_num;
... ... @@ -170,6 +168,9 @@ class MonthCountLogic extends BaseLogic
if(!isset($groupedData[$month])){
$groupedData[$month] = [];
}
if(empty($v['country'])){
$v['country'] = ['中国'=>0];
}
$groupedData[$month][] = $v;
}
return $this->success($groupedData);
... ...
... ... @@ -8,6 +8,7 @@ use App\Helper\QuanqiusouApi;
use App\Helper\Translate;
use App\Http\Logic\Aside\Project\DomainInfoLogic;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Models\Project\Project;
use App\Models\RankData\ExternalLinks;
use App\Models\RankData\IndexedPages;
use App\Models\RankData\RankData;
... ... @@ -58,7 +59,7 @@ class RankDataLogic extends BaseLogic
'domain' => $project['deploy_optimize']['domain'] ?? '',
'domain_info' => ($domain_info['domain_info']['creation_date'] ?? '') . ' - ' . ($domain_info['domain_info']['expiration_date'] ?? ''),
'cert_info' => ($domain_info['ssl']['start_time'] ?? '') . ' - ' . ($domain_info['ssl']['end_time'] ?? ''),
'plan' => str_replace('营销大师-', '全球搜-', $project['deploy_build']['plan'][0] ?? ''),
'plan' => Project::planMap()[$project['deploy_build']['plan']],
'keyword_num' => $project['deploy_build']['keyword_num'],
'compliance_day' => $rank['compliance_day'] ?? 0,
'remain_day' => $project['deploy_build']['service_duration'] - ($rank['compliance_day'] ?? 0),
... ...
... ... @@ -78,7 +78,7 @@ class WebSettingLogic extends BaseLogic
];
$string = http_build_query($param);
$urlStr = $this->user['domain'].'api/updateHtmlNotify/?' . $string;
http_get($urlStr);
http_get($urlStr,["charset = UTF-8"]);
return $this->success();
}
... ...
... ... @@ -74,7 +74,7 @@ class UserLogic extends BaseLogic
}
$this->param['type'] = 1;
$this->param['operator_id'] = $this->user['id'];
$this->edits($this->param);
$this->edits();
return $this->success();
}
... ... @@ -116,20 +116,24 @@ class UserLogic extends BaseLogic
* @method :post
* @time :2023/6/17 16:41
*/
public function edits($param){
//查看密码是否修改
$info = $this->model->read(['id'=>$param['id']]);
$param['password'] = base64_encode(md5($param['password']));
if($param['password'] == $info['password']){
unset($param['password']);
public function edits(){
if(!isset($this->param['password']) || empty($this->param['password'])){
unset($this->param['password']);
}else{
$this->param['password'] = base64_encode(md5($this->param['password']));
}
$info = $this->model->read(['mobile'=>$this->param['mobile'],
'project_id'=>$this->user['project_id'],'id'=>['!=',$this->param['id']]]);
if($info !== false){
$this->fail('当前手机号码已注册');
}
//密码加密
$rs = $this->model->edit($param,['id'=>$param['id']]);
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
//清空当前用户登录缓存
Cache::pull($info['token']);
Cache::pull($this->user['token']);
return $this->success();
}
}
... ...
... ... @@ -10,6 +10,7 @@ use App\Models\Project\Project;
use App\Models\Sms\SmsLog;
use App\Models\User\ProjectRole as ProjectRoleModel;
use App\Models\User\User;
use App\Models\User\User as UserModel;
use Illuminate\Support\Facades\Cache;
class UserLoginLogic
... ... @@ -96,7 +97,7 @@ class UserLoginLogic
{
//项目自动登录
if(isset($data['project_id']) && !empty($data['project_id'])){
$has_user = $this->model->read(['project_id'=>$data['project_id'],'role_id'=>0]);
$has_user = $this->model->read(['project_id'=>$data['project_id'],'role_id'=>$this->model::ROLE_MANAGER]);
}
//根据特定用户自动登录
if(isset($data['user_id']) && !empty($data['user_id'])){
... ... @@ -151,6 +152,9 @@ class UserLoginLogic
$project = $this->getProjectInfo($info['project_id']);
$info['title'] = $project['title'] ?? '';
$info['company'] = $project['company'] ?? '';
$info['from_order_id'] = $project['from_order_id'] ?? '';
$info['aicc'] = $project['aicc'] ?? '';
$info['hagro'] = $project['hagro'] ?? '';
$info['plan'] = Project::planMap()[$project['deploy_build']['plan']];
$info['domain'] = (!empty($project['deploy_optimize']['domain']) ?
$project['deploy_optimize']['domain'] : ($project['deploy_build']['test_domain'] ?? ''));
... ... @@ -172,6 +176,9 @@ class UserLoginLogic
$project = $this->getProjectInfo($project_id);
$info['title'] = $project['title'] ?? '';
$info['company'] = $project['company'] ?? '';
$info['from_order_id'] = $project['from_order_id'] ?? '';
$info['aicc'] = $project['aicc'] ?? '';
$info['hagro'] = $project['hagro'] ?? '';
$info['plan'] = Project::planMap()[$project['deploy_build']['plan']];
$info['domain'] = (!empty($project['deploy_optimize']['domain']) ?
$project['deploy_optimize']['domain'] : ($project['deploy_build']['test_domain'] ?? ''));
... ... @@ -197,6 +204,68 @@ class UserLoginLogic
}
return $this->success($info);
}
/**
* @remark :扫码登录
* @name :wechatLogin
* @author :lyh
* @method :post
* @time :2023/9/1 11:29
*/
public function wechatLogin($wechat){
$info = $this->model->read(['wechat'=>$wechat]);
if($info === false){
$data = [
'code'=>0,
'message'=>'当前用户未绑定账户,请绑定后登录',
];
}else {
//获取项目详情
$info = $this->autoAssembleParam($info);
if(isset($info['token']) && !empty($info['token'])){
//清除上一次用户缓存
Cache::pull($info['token']);
}
//生成新token
$token = md5(uniqid().$info['id']);
//存储缓存
$info['token'] = $token;
Cache::add($token,$info,3600);
//更新用户信息
$this->model->edit(['token'=>$token],['id'=>$info['id']]);
$data = [
'code'=>1,
'message'=>'登陆成功',
'data'=>$info
];
}
return $this->success($data);
}
/**
* @remark :微信绑定
* @name :wechatBind
* @author :lyh
* @method :post
* @time :2023/9/1 11:43
*/
public function wechatBind($wechat,$id){
$info = $this->model->read(['wechat'=>$wechat]);
if($info !== false){
$data = [
'code'=>0,
'message'=>'当前微信已绑定其他微信,请解绑后再操作',
];
}else{
$this->model->edit(['wechat'=>$wechat],['id'=>(int)$id]);
$data = [
'code'=>2,
'message'=>'绑定成功',
];
}
return $this->success($data);
}
/**
* @notes: 请简要描述方法功能
* @param array $data
... ...
... ... @@ -16,6 +16,8 @@ class Project extends Base
const DATABASE_NAME_FIX = 'gl_data_';
const DEMO_PROJECT_ID = 1;
const STATUS_ONE = 1;//审核通过
const TYPE_ZERO = 0;//初始导入项目
const TYPE_ONE = 1;//建站中
... ... @@ -224,7 +226,7 @@ class Project extends Base
$value = Arr::s2a($value);
if(!empty($value)) {
foreach ($value as &$v) {
$v['url'] = getImageUrl($v['url']);
$v['url'] = getFileUrl($v['url']);
}
}
return $value;
... ... @@ -243,7 +245,7 @@ class Project extends Base
$value = Arr::s2a($value);
if(!empty($value)) {
foreach ($value as &$v) {
$v['url'] = getImageUrl($v['url']);
$v['url'] = getFileUrl($v['url']);
}
}
return $value;
... ...
... ... @@ -7,4 +7,7 @@ use App\Models\Base;
class DeptUser extends Base
{
protected $table = 'gl_project_dept_user';
//运营中心id
const OPERATION_CENTER_ID = 3;
}
... ...
... ... @@ -13,4 +13,7 @@ class ProjectRole extends Base
//A端添加还是B端添加
const TYPE_ONE = 1;
//运营中心角色id
const OPERATION_CENTER_ID = 3;
}
... ...
... ... @@ -18,26 +18,6 @@ class User extends Base
protected $table = 'gl_project_user';
//自动维护create_at创建时间 updated_at修改时间
public $timestamps = true;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
// 'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
// 'password',
'remember_token',
];
/**
* The attributes that should be cast.
... ...
... ... @@ -19,15 +19,15 @@ return [
'size' => [
'max' => 1024*1024*2, // 2M
],
'path_b' => '/p',
'path_a' => '/m',
'path_b' => '/upload/p',
'path_a' => '/upload/m',
],
//默认视频
'default_file' =>[
'size' => [
'max' => 1024*1024*20, // 2M
],
'path_b' => '/p',
'path_a' => '/m',
'path_b' => '/upload/p',
'path_a' => '/upload/m',
],
];
... ...
... ... @@ -20,6 +20,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/save', [Aside\User\ProjectUserController::class, 'save'])->name('admin.user_save');
Route::any('/del', [Aside\User\ProjectUserController::class, 'del'])->name('admin.user_del');
Route::any('/getRole', [Aside\User\ProjectUserController::class, 'getRole'])->name('admin.user_getRole');
Route::any('/sort', [Aside\User\ProjectUserController::class, 'sort'])->name('admin.user_sort');
//角色管理
Route::prefix('role')->group(function () {
... ... @@ -41,6 +42,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/del', [Aside\User\ProjectMenuController::class, 'del'])->name('admin.user_menu_del');
Route::any('/getSonMenu', [Aside\User\ProjectMenuController::class, 'getSonMenu'])->name('admin.user_menu_getSonMenu');
Route::any('/routes', [Aside\User\ProjectMenuController::class, 'routes'])->name('admin.user_menu_routes');
Route::any('/sort', [Aside\User\ProjectMenuController::class, 'sort'])->name('admin.user_menu_sort');
});
//用户组
... ... @@ -156,6 +158,8 @@ Route::middleware(['aloginauth'])->group(function () {
Route::prefix('keyword')->group(function () {
Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix');
});
//更新项目tdk
Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk');
});
//续费
... ... @@ -173,6 +177,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::post('/save', [Aside\Task\TaskController::class, 'save'])->name('admin.task_save');
Route::post('/status', [Aside\Task\TaskController::class, 'status'])->name('admin.task_status');
Route::post('/save_follow', [Aside\Task\TaskController::class, 'save_follow'])->name('admin.task_save_follow');
Route::any('/getUserTaskList', [Aside\Task\TaskController::class, 'getUserTaskList'])->name('admin.task_getUserTaskList');
});
//服务器配置
Route::prefix('devops')->group(function () {
... ... @@ -222,6 +227,11 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/', [Aside\Optimize\OptimizeController::class, 'lists'])->name('admin.optimize_lists');//优化中台
});
//优化中台
Route::prefix('keyword')->group(function () {
Route::any('/', [Aside\Optimize\KeywordsController::class, 'lists'])->name('admin.optimize_keywords_lists');//优化中台
});
//上线审核列表
Route::prefix('online')->group(function () {
Route::any('/', [Aside\Optimize\OnlineController::class, 'lists'])->name('admin.online_lists');//上线审核列表
... ...
... ... @@ -10,6 +10,7 @@ Route::middleware(['bloginauth'])->group(function () {
//登录用户编辑个人资料
Route::any('/edit_info', [\App\Http\Controllers\Bside\BCom\ComController::class, 'edit_info'])->name('edit_info');
Route::any('/logout', [\App\Http\Controllers\Bside\BCom\ComController::class, 'logout'])->name('logout');
Route::any('/unbindWechat', [\App\Http\Controllers\Bside\BCom\ComController::class, 'unbindWechat'])->name('unbindWechat');
//获取当前登录用户菜单
Route::any('/get_menu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'get_menu'])->name('get_menu');
//获取当前登录用户项目详情
... ... @@ -344,4 +345,5 @@ Route::group([], function () {
Route::any('/autologin', [\App\Http\Controllers\Bside\LoginController::class, 'autologin'])->name('autologin');
Route::any('/qrcode', [\App\Http\Controllers\Bside\LoginController::class, 'qrcode'])->name('qrcode');
Route::any('/globalSo_v6_login', [\App\Http\Controllers\Bside\LoginController::class, 'globalSo_v6_login'])->name('globalSo_v6_login');
Route::any('/getWechatLoginInfo', [\App\Http\Controllers\Bside\LoginController::class, 'getWechatLoginInfo'])->name('getWechatLoginInfo');
});
... ...