作者 赵彬吉
... ... @@ -143,6 +143,7 @@ class VideoTask extends Command
],
'task_id' => $task_id,
'callback_url' => env('APP_URL') . '/api/video_task_callback',
'is_ytb'=>true
];
$result = Http::post('http://216.250.255.116:7866/create_task', $data);
$val->task_id = $task_id;
... ... @@ -215,28 +216,33 @@ class VideoTask extends Command
$productIds[] = $item->id;
}
if (count($productIds)<7){
$product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",1)->pluck('id')->toArray();
$product_id = array_rand($product_all_id, 13-count($productIds));
$product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
$number = 40;
$product_id = array_rand($product_all_id, min(count($product_all_id, $number-count($productIds))));
$randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
$products = $productsQuery->merge($randomData);
}else{
$products = $productsQuery;
}
}else{
$product_all_id = Product::where("project_id", $project_id)->where("status",1)->pluck('id')->toArray();
$product_id = array_rand($product_all_id, 13);
$product_all_id = Product::where("project_id", $project_id)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
$product_id = array_rand($product_all_id, 40);
$products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
}
}
$data = [];
if (!empty($products)){
foreach ($products as $item){
$data[] = !empty($item->thumb) && $item->thumb['url'] != "" ? getImageUrl($item->thumb['url']) : "";
if(empty($item->thumb) || ($item->thumb['url'] == "")){
continue;
}
if(count($data) > 13){
break;
}
$data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title];
}
}
return $data;
}
}
... ...
<?php
/**
* @remark :
* @name :Notice.php
* @author :lyh
* @method :post
* @time :2024/3/6 16:01
*/
namespace App\Console\Commands\Notice;
use App\Models\Com\KeywordVideoTaskLog;
use App\Models\Domain\DomainInfo;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
/**
* @remark :通知C端生成界面
* @name :Notice
* @author :lyh
* @method :post
* @time :2024/3/6 16:01
*/
class Notice extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'notice_c';
/**
* The console command description.
*
* @var string
*/
protected $description = '通知C端生成界面';
/**
* @remark :通知C端生成界面
* @name :handle
* @author :lyh
* @method :post
* @time :2023/11/20 15:13
*/
public function handle(){
$yesterday = date('Y-m-d', strtotime('yesterday'));
$keywordVideoModel = new KeywordVideoTaskLog();
$list = $keywordVideoModel->select('project_id')
->groupBy('project_id')->whereBetween('created_at', [$yesterday.' 00:00:00',$yesterday.' 23:59:59'])->get()->toArray();
$project_arr = [];
if(empty($list)){
echo date('Y-m-d H:i:s') . '无需通知' . PHP_EOL;
return false;
}
foreach ($list as $k => $v){
$project_arr[] = $v['project_id'];
}
$domainModel = new DomainInfo();
$domainList = $domainModel->formatQuery(['project_id'=>['in',$project_arr]])->get()->toArray();
if(empty($domainList)){
echo date('Y-m-d H:i:s') . '无域名:'.json_encode($domainList) . PHP_EOL;
return false;
}
foreach ($domainList as $v1){
//TODO::通知C端
$this->curlDelRoute($v1['domain'],$v1['project_id']);
}
return true;
}
/**
* @remark :删除路由通知C端
* @name :curlDelRoute
* @author :lyh
* @method :post
* @time :2023/11/30 14:43
*/
public function curlDelRoute($domain,$project_id){
if (strpos($domain, 'https://') === false) {
$domain = 'https://' . $domain . '/';
}
$url = $domain.'api/update_page/?project_id='.$project_id.'&route=6';
shell_exec('curl -k "'.$url.'"');
return true;
}
}
... ...
... ... @@ -44,6 +44,7 @@ class Kernel extends ConsoleKernel
$schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次
$schedule->command('recommended_suppliers')->dailyAt('01:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
$schedule->command('notice_c')->dailyAt('02:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
}
/**
... ...
... ... @@ -211,7 +211,7 @@ class OptimizeController extends BaseController
$query = $query->whereRaw("FIND_IN_SET(?, gl_project.level) > 0", [$this->map['level']]);
}
if(isset($this->map['online_updated_at']) && !empty($this->map['online_updated_at']) && is_array($this->map['online_updated_at'])){
$query = $query->whereBetween('gl_project_deploy_optimize.updated_at', $this->map['online_updated_at']);
$query = $query->where('gl_project_deploy_optimize.start_date','>=' ,$this->map['online_updated_at'][0])->where('gl_project_deploy_optimize.start_date','<' ,$this->map['online_updated_at'][1]);
}
if(isset($this->map['special'])){
$query = $query->whereRaw("FIND_IN_SET(?, gl_project_deploy_optimize.special) > 0", [$this->map['special']]);
... ...
... ... @@ -328,25 +328,5 @@ class ComController extends BaseController
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :推荐采购商
* @name :recommendedPurchaser
* @author :lyh
* @method :post
* @time :2024/3/4 10:10
*/
public function recommendedPurchaser(){
$purchaserModel = new Purchaser();
$data = [];
$lists = $purchaserModel->list(['project_id'=>$this->user['project_id']]);
if(!empty($lists)){
foreach ($lists as $v){
$resultData = json_decode($v['data']);
foreach ($resultData as $value){
$data[] = $value;
}
}
}
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Aside\Domain\DomainInfoLogic;
use App\Http\Logic\Bside\Setting\ProjectCountryLogic;
/**
... ... @@ -32,4 +33,59 @@ class ProjectCountryController extends BaseController
$projectCountryLogic->country_save();
$this->response('success');
}
/**
* 设置语种自定义跳转链接
* @param DomainInfoLogic $domainInfoLogic
* @author Akun
* @date 2024/03/05 9:47
*/
public function custom_save(DomainInfoLogic $domainInfoLogic){
$this->request->validate([
'language_id'=>'required',
'custom_domain'=>'required',
'is_create'=>'required'
],[
'language_id.required' => 'language_id不能为空',
'custom_domain.required' => 'custom_domain不能为空',
'is_create.required' => 'is_create不能为空'
]);
$domainInfoLogic->country_custom($this->user['project_id']);
$this->response('success');
}
/**
* 清除语种自定义跳转链接
* @param ProjectCountryLogic $projectCountryLogic
* @author Akun
* @date 2024/03/05 10:20
*/
public function custom_del(ProjectCountryLogic $projectCountryLogic){
$this->request->validate([
'language_id'=>'required'
],[
'language_id.required' => 'language_id不能为空'
]);
$projectCountryLogic->country_custom_del();
$this->response('success');
}
/**
* 获取语种自定义跳转链接详情
* @param ProjectCountryLogic $projectCountryLogic
* @author Akun
* @date 2024/03/06 14:37
*/
public function custom_info(ProjectCountryLogic $projectCountryLogic){
$this->request->validate([
'language_id'=>'required'
],[
'language_id.required' => 'language_id不能为空'
]);
$info = $projectCountryLogic->country_custom_info();
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -29,7 +29,7 @@ class WebSettingReceivingController extends BaseController
* @time :2023/5/8 16:23
*/
public function save(WebSettingReceivingLogic $webSettingReceivingLogic){
$webSettingReceivingLogic->setting_receiving_save();
$this->response('success');
$result = $webSettingReceivingLogic->setting_receiving_save();
$this->response('success',Code::SUCCESS,$result);
}
}
... ...
<?php
/**
* @remark :
* @name :SuppliersController.php
* @author :lyh
* @method :post
* @time :2024/3/7 9:23
*/
namespace App\Http\Controllers\Bside\Suppliers;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Models\Com\Purchaser;
/**
* @remark :推荐采购商
* @name :SuppliersController
* @author :lyh
* @method :post
* @time :2024/3/7 9:23
*/
class SuppliersController extends BaseController
{
public $domain = 'https://admin.hagro.cn/';
/**
* @remark :推荐采购商
* @name :recommendedPurchaser
* @author :lyh
* @method :post
* @time :2024/3/4 10:10
*/
public function recommendedPurchaser(){
$purchaserModel = new Purchaser();
$data = [];
$lists = $purchaserModel->list(['project_id'=>$this->user['project_id']]);
if(!empty($lists)){
foreach ($lists as $v){
$resultData = json_decode($v['data']);
foreach ($resultData as $value){
$data[] = $value;
}
}
}
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :请求黑格公共方法
* @name :_action
* @author :lyh
* @method :post
* @time :2024/3/7 9:30
*/
public function _action($api_url,$action_name,$param){
$url = $this->domain.$api_url;
ksort($param);
$token = $action_name. '+' .date('Y-m-d'). '+' .http_build_query($param);
$param['token'] = md5($token);
$res = http_post($url,json_encode($param));
if($res['code'] != 200){
$this->response($res['message'],Code::SYSTEM_ERROR);
}
return $this->success($res['data']);
}
/**
* @remark :按名字搜索公司
* @name :company_domain
* @author :lyh
* @method :post
* @time :2024/3/7 9:27
*/
public function company_domain(){
$api_url = 'api/company_domain';
$action_name = 'company_domain';
$param = [
'search'=>$this->param['search'],
];
$res = $this->_action($api_url,$action_name,$param ?? []);
$this->response('success',Code::SUCCESS,$res);
}
/**
* @remark :通过域名获取公司信息
* @name :company_detail
* @author :lyh
* @method :post
* @time :2024/3/7 9:46
*/
public function company_detail(){
$api_url = 'api/company_detail';
$action_name = 'company_detail';
$param = [
'domain'=>$this->param['domain'],
];
$res = $this->_action($api_url,$action_name,$param);
$this->response('success',Code::SUCCESS,$res);
}
/**
* @remark :领英决策人员
* @name :company_linked
* @author :lyh
* @method :post
* @time :2024/3/7 9:48
*/
public function company_linked(){
$api_url = 'api/company_linked';
$action_name = 'company_linked';
$param = [
'domain'=>$this->param['domain'],
'page'=>$this->page,
'page_size'=>$this->row,
];
if(isset($this->param['keyword'])){
$param['keyword'] = $this->param['keyword'];
}
if(isset($this->param['position'])){
$param['position'] = $this->param['position'];
}
$res = $this->_action($api_url,$action_name,$param);
$this->response('success',Code::SUCCESS,$res);
}
/**
* @remark :海关数据信息
* @name :trade_trend
* @author :lyh
* @method :post
* @time :2024/3/7 9:51
*/
public function trade_trend(){
$api_url = 'api/trade_trend';
$action_name = 'trade_trend';
$param = [
'prod_desc'=>$this->param['prod_desc'] ?? '',
];
$res = $this->_action($api_url,$action_name,$param);
$this->response('success',Code::SUCCESS,$res);
}
/**
* @remark :供应商区域分布
* @name :supplier_area
* @author :lyh
* @method :post
* @time :2024/3/7 9:52
*/
public function supplier_area(){
$api_url = 'api/supplier_area';
$action_name = 'supplier_area';
$param = [
'prod_desc'=>$this->param['prod_desc'] ?? '',
'start_date'=>$this->param['start_date'] ?? '',
'end_date'=>$this->param['end_date'] ?? '',
];
$res = $this->_action($api_url,$action_name,$param);
$this->response('success',Code::SUCCESS,$res);
}
/**
* @remark :贸易伙伴
* @name :trade_partner
* @author :lyh
* @method :post
* @time :2024/3/7 9:54
*/
public function trade_partner(){
$api_url = 'api/trade_partner';
$action_name = 'trade_partner';
$param = [
'com_id'=>$this->param['com_id'] ?? '',
'com_role'=>$this->param['com_role'] ?? '',
];
$res = $this->_action($api_url,$action_name,$param);
$this->response('success',Code::SUCCESS,$res);
}
/**
* @remark :贸易明细
* @name :trade_detail
* @author :lyh
* @method :post
* @time :2024/3/7 9:55
*/
public function trade_detail(){
$api_url = 'api/trade_detail';
$action_name = 'trade_detail';
$param = [
'prod_desc'=>$this->param['prod_desc'] ?? '',
];
$res = $this->_action($api_url,$action_name,$param);
$this->response('success',Code::SUCCESS,$res);
}
/**
* @remark :提单详情
* @name :bill_detail
* @author :lyh
* @method :post
* @time :2024/3/7 9:56
*/
public function bill_detail(){
$api_url = 'api/bill_detail';
$action_name = 'bill_detail';
$param = [
'prod_desc'=>$this->param['prod_desc'] ?? '',
'page'=>$this->page,
'page_size'=>$this->row,
];
$res = $this->_action($api_url,$action_name,$param);
$this->response('success',Code::SUCCESS,$res);
}
/**
* @remark :进口产品信息
* @name :import_product
* @author :lyh
* @method :post
* @time :2024/3/7 9:59
*/
public function import_product(){
$api_url = 'api/import_product';
$action_name = 'import_product';
$param = [
'com_id'=>$this->param['com_id'] ?? '',
'com_role'=>$this->param['com_role'] ?? '',
];
$res = $this->_action($api_url,$action_name,$param);
$this->response('success',Code::SUCCESS,$res);
}
}
... ...
... ... @@ -6,6 +6,7 @@ namespace App\Http\Logic\Aside\Domain;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Devops\ServerConfig;
use App\Models\Domain\DomainInfo;
use App\Models\Project\CountryCustom;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Utils\HttpUtils;
... ... @@ -350,4 +351,68 @@ class DomainInfoLogic extends BaseLogic
}
return false;
}
/**
* 设置语种自定义跳转链接
* @param $project_id
* @return array
* @author Akun
* @date 2024/03/05 9:48
*/
public function country_custom($project_id){
$project_model = new Project();
$project_info = $project_model->read(['id'=>$project_id],'serve_id');
if($project_info === false){
$this->fail('获取项目数据失败');
}
$custom_model = new CountryCustom();
if($this->param['is_create']){
//需要创建站点
$server_model = new ServerConfig();
$server_info = $server_model->read(['id'=>$project_info['serve_id']],['init_domain', 'host']);
if($server_info === false){
$this->fail('获取服务器数据失败');
}
//域名是否都已经解析
if(strpos($this->param['custom_domain'],'//') === false){
$this->param['custom_domain'] = '//'.$this->param['custom_domain'];
}
$domain_arr = parse_url($this->param['custom_domain']);
if(!isset($domain_arr['host'])){
$this->fail('自定义域名填写错误');
}
$this->param['custom_domain'] = $domain_arr['host'];
//判断域名是否已经被使用
$has_info = $custom_model->read(['custom_domain'=>$this->param['custom_domain']]);
if($has_info && ($has_info['project_id'] != $project_id || $has_info['language_id'] != $this->param['language_id'])){
$this->fail('自定义域名已被使用');
}
if(!$this->check_cname($this->param['custom_domain'], $server_info)){
$this->fail('域名' . $this->param['custom_domain'] . '未解析至目标服务器');
}
}else{
$this->param['custom_domain'] = str_replace('https://','',$this->param['custom_domain']);
$this->param['custom_domain'] = str_replace('http://','',$this->param['custom_domain']);
$this->param['custom_domain'] = str_replace('//','',$this->param['custom_domain']);
}
$info = $custom_model->read(['project_id'=>$project_id,'language_id'=>$this->param['language_id']]);
if($info === false){
$this->param['project_id'] = $project_id;
$custom_model->add($this->param);
}else{
$custom_model->edit($this->param,['id'=>$info['id']]);
}
if($this->param['is_create']){
//创建站点,设置证书
$this->param['key'] = $this->param['private_key'] ?? '';
$this->param['cert'] = $this->param['private_cert'] ?? '';
$this->setDomainSsl($server_info['init_domain'],$this->param['custom_domain'],[],[],0);
}
return $this->success();
}
}
... ...
... ... @@ -4,6 +4,8 @@ namespace App\Http\Logic\Bside\Setting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Project\Country as CountryModel;
use App\Models\Project\CountryCustom;
use App\Models\WebSetting\WebLanguage;
class ProjectCountryLogic extends BaseLogic
{
... ... @@ -24,8 +26,11 @@ class ProjectCountryLogic extends BaseLogic
$lists = $this->model->read(['project_id'=>$this->user['project_id']]);
if (empty($lists)){
$lists['country_lists'] = '';
$lists['country_sort'] = '';
}
$lists['country_lists'] = $this->countryListsFormat($lists['country_lists']);
$lists['country_sort'] = $this->countrySortFormat($lists['country_sort']);
return $this->success($lists);
}
... ... @@ -41,6 +46,12 @@ class ProjectCountryLogic extends BaseLogic
$this->param['country_lists'] = '';
}
$this->param['country_lists'] = $this->countryListsFormat($this->param['country_lists']);
if(!isset($this->param['country_sort']) || empty($this->param['country_sort'])){
$this->param['country_sort'] = '';
}
$this->param['country_sort'] = $this->countrySortFormat($this->param['country_sort']);
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$this->param['project_id'] = $this->user['project_id'];
... ... @@ -51,9 +62,45 @@ class ProjectCountryLogic extends BaseLogic
if($rs === false){
$this->fail('当前数据不存在');
}
$custom_model = new CountryCustom();
//将未勾选的设置了自定义跳转的语种,置为不可用
$custom_model->edit(['status'=>0],['project_id'=>$this->user['project_id'],'language_id'=>['not in',explode(',',$this->param['country_lists'])]]);
//将勾选的设置了自定义跳转的语种,置为可用
$custom_model->edit(['status'=>1],['project_id'=>$this->user['project_id'],'language_id'=>['in',explode(',',$this->param['country_lists'])]]);
return $this->success();
}
/**
* 删除语种自定义跳转
* @return array
* @author Akun
* @date 2024/03/05 10:18
*/
public function country_custom_del(){
$custom_model = new CountryCustom();
$rs = $custom_model->del(['project_id'=>$this->user['project_id'],'language_id'=>$this->param['language_id']]);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
/**
* 获取语种自定义跳转详情
* @return array|bool
* @author Akun
* @date 2024/03/06 14:38
*/
public function country_custom_info(){
$custom_model = new CountryCustom();
$info = $custom_model->read(['project_id'=>$this->user['project_id'],'language_id'=>$this->param['language_id']],['language_id','custom_domain','is_create','type','private_key','private_cert']);
return $this->success($info?:[]);
}
protected function countryListsFormat($country_lists)
{
if(empty($country_lists)){
... ... @@ -68,4 +115,14 @@ class ProjectCountryLogic extends BaseLogic
}
return implode(',', $country_lists);
}
protected function countrySortFormat($country_sort){
if(empty($country_sort)){
$webLanguageModel = new WebLanguage();
$all_language_ids = array_column($webLanguageModel->list([],'id',['id'],'asc'),'id');
$country_sort = implode(',',$all_language_ids);
}
return $country_sort;
}
}
... ...
... ... @@ -28,11 +28,15 @@ class WebSettingAmpLogic extends BaseLogic
return $this->success();
}
//log图处理
$info['top_logo'] = getImageUrl($info['top_logo'],$this->user['storage_type'],$this->user['project_location']);
$info['top_logo'] = Arr::s2a($info['top_logo']);
if(!empty($info['top_logo'])){
$info['top_logo']['url'] = getImageUrl($info['top_logo']['url'], $this->user['storage_type'], $this->user['project_location']);
}
//banner处理
$info['index_banner'] = Arr::s2a($info['index_banner']);
if (!empty($info['index_banner'])) {
foreach ($info['index_banner'] as &$v) {
$v = getImageUrl($v,$this->user['storage_type'],$this->user['project_location']);
$v['url'] = getImageUrl($v['url'], $this->user['storage_type'], $this->user['project_location']);
}
}
return $this->success($info);
... ... @@ -48,12 +52,16 @@ class WebSettingAmpLogic extends BaseLogic
{
try {
//log图处理
$this->param['top_logo'] = str_replace_url($this->param['top_logo'] ?? '');
if (isset($this->param['top_logo']) && $this->param['top_logo']) {
$this->param['top_logo']['url'] = str_replace_url($this->param['top_logo']['url'] ?? '');
}
$this->param['top_logo'] = Arr::a2s($this->param['top_logo'] ?? []);
//banner处理
$index_banner = [];
if (isset($this->param['index_banner']) && $this->param['index_banner']) {
foreach ($this->param['index_banner'] as $v) {
$index_banner[] = str_replace_url($v);
$v['url'] = str_replace_url($v['url'] ?? '');
$index_banner[] = $v;
}
}
$this->param['index_banner'] = Arr::a2s($index_banner);
... ...
... ... @@ -6,6 +6,7 @@ use App\Http\Logic\Bside\BaseLogic;
use App\Models\WebSetting\WebSettingReceiving;
use App\Models\WebSetting\WebSettingText;
use App\Services\SyncService;
use Illuminate\Support\Facades\DB;
class WebSettingReceivingLogic extends BaseLogic
{
... ... @@ -34,24 +35,37 @@ class WebSettingReceivingLogic extends BaseLogic
* @time :2023/5/8 16:26
*/
public function setting_receiving_save(){
try {
$this->model->del(['project_id'=>$this->user['project_id']]);
foreach ($this->param['data'] as $k => $v){
$data = [];
foreach ($this->param['data'] as $v){
if($v['type'] == 1){
// 使用正则表达式匹配中国大陆手机号
$pattern = '/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/';
if (!preg_match($pattern, $v['values'])) {
$this->fail('当前数据不符合规则:'.$v['values']);
}
}
if($v['type'] == 2){
// 使用正则表达式匹配中国大陆手机号
$pattern = '/^1[3456789]\d{9}$/';
if (!preg_match($pattern, $v['values'])) {
continue;
$this->fail('当前数据不符合规则:'.$v['values']);
}
}
$v['project_id'] = $this->user['project_id'];
$v['created_at'] = date('Y-m-d H:i:s');
$v['updated_at'] = date('Y-m-d H:i:s');
$this->param['data'][$k] = $v;
$data[] = $v;
}
DB::connection('custom_mysql')->beginTransaction();
try {
$this->model->del(['project_id'=>$this->user['project_id']]);
if(!empty($data)){
$this->model->insert($data);
}
$this->model->insert($this->param['data']);
DB::connection('custom_mysql')->commit();
}catch (\Exception $e){
$this->fail('error');
DB::connection('custom_mysql')->rollBack();
$this->fail('编辑失败,请联系管理员');
}
(new SyncService())->projectAcceptAddress($this->user['project_id']);
return $this->success();
... ...
... ... @@ -37,14 +37,14 @@ class WebSettingServiceLogic extends BaseLogic
* @time :2023/5/4 11:10
*/
public function setting_service_save(){
DB::beginTransaction();
DB::connection('custom_mysql')->beginTransaction();
try {
$this->param['data'] = Common::uniqueMultiArray($this->param['data']);
//删除以前的数据
$this->model->del(['project_id'=>$this->user['project_id']]);
$data = [];
foreach ($this->param['data'] as $k => $v){
if(isset($v['values']) && empty($v['values'])){
if(isset($v['values']) && !empty($v['values'])){
$v['project_id'] = $this->user['project_id'];
$v['created_at'] = date('Y-m-d H:i:s');
$v['updated_at'] = date('Y-m-d H:i:s');
... ... @@ -54,10 +54,9 @@ class WebSettingServiceLogic extends BaseLogic
if(!empty($data)){
$this->model->insert($data);
}
DB::commit();
DB::connection('custom_mysql')->commit();
}catch (\Exception $e){
DB::rollBack();
DB::connection('custom_mysql')->rollBack();
$this->fail('系统错误,请联系管理员');
}
return $this->success();
... ...
... ... @@ -55,7 +55,7 @@ class UserLoginLogic
$projectArr[] = $v['project_id'];
}
$projectModel = new Project();
$project_list = $projectModel->list(['id'=>['in',$projectArr],['delete_status'=>0]],'id',['id','title']);
$project_list = $projectModel->list(['id'=>['in',$projectArr],'delete_status'=>0],'id',['id','title']);
//登录选择项目的有效时间
Cache::add('login-project-'.$this->param['mobile'],1,300);
return $this->success($project_list);
... ...
<?php
namespace App\Models\Project;
use App\Models\Base;
use Illuminate\Database\Eloquent\SoftDeletes;
class CountryCustom extends Base
{
use SoftDeletes;
protected $table = 'gl_project_country_custom';
}
... ...
... ... @@ -20,7 +20,19 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/generateToken', [\App\Http\Controllers\Bside\BCom\ComController::class, 'generateToken'])->name('generateToken');
Route::any('/getLink', [\App\Http\Controllers\Bside\BCom\ComController::class, 'getLink'])->name('getLink');
Route::any('/getMobileProject', [\App\Http\Controllers\Bside\BCom\ComController::class, 'getMobileProject'])->name('getMobileProject');
Route::any('/recommendedPurchaser', [\App\Http\Controllers\Bside\BCom\ComController::class, 'recommendedPurchaser'])->name('recommendedPurchaser');
//黑格数据
Route::prefix('suppliers')->group(function () {
Route::any('/recommendedPurchaser', [\App\Http\Controllers\Bside\Suppliers\SuppliersController::class, 'recommendedPurchaser'])->name('suppliers_recommendedPurchaser');
Route::any('/company_domain',[\App\Http\Controllers\Bside\Suppliers\SuppliersController::class, 'company_domain'])->name('suppliers_company_domain');
Route::any('/company_detail',[\App\Http\Controllers\Bside\Suppliers\SuppliersController::class, 'company_detail'])->name('suppliers_company_detail');
Route::any('/company_linked',[\App\Http\Controllers\Bside\Suppliers\SuppliersController::class, 'company_linked'])->name('suppliers_company_linked');
Route::any('/trade_trend',[\App\Http\Controllers\Bside\Suppliers\SuppliersController::class, 'trade_trend'])->name('suppliers_trade_trend');
Route::any('/supplier_area',[\App\Http\Controllers\Bside\Suppliers\SuppliersController::class, 'supplier_area'])->name('suppliers_supplier_area');
Route::any('/trade_partner',[\App\Http\Controllers\Bside\Suppliers\SuppliersController::class, 'trade_partner'])->name('suppliers_trade_partner');
Route::any('/trade_detail',[\App\Http\Controllers\Bside\Suppliers\SuppliersController::class, 'trade_detail'])->name('suppliers_trade_detail');
Route::any('/bill_detail',[\App\Http\Controllers\Bside\Suppliers\SuppliersController::class, 'bill_detail'])->name('suppliers_bill_detail');
Route::any('/import_product',[\App\Http\Controllers\Bside\Suppliers\SuppliersController::class, 'import_product'])->name('suppliers_import_product');
});
//用户相关路由
Route::prefix('user')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\User\UserController::class, 'lists'])->name('user_lists');
... ... @@ -156,6 +168,9 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('country')->group(function () {
Route::any('/info', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'info'])->name('web_setting_country_info');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'save'])->name('web_setting_country_save');
Route::any('/custom_save', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'custom_save'])->name('web_setting_country_custom_save');
Route::any('/custom_del', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'custom_del'])->name('web_setting_country_custom_del');
Route::any('/custom_info', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'custom_info'])->name('web_setting_country_custom_info');
});
//客服设置
Route::prefix('service')->group(function () {
... ...