Merge remote-tracking branch 'origin/master' into akun
正在显示
12 个修改的文件
包含
94 行增加
和
51 行删除
| @@ -119,18 +119,21 @@ class RecommendedSuppliers extends Command | @@ -119,18 +119,21 @@ class RecommendedSuppliers extends Command | ||
| 119 | * @time :2024/5/29 16:38 | 119 | * @time :2024/5/29 16:38 |
| 120 | */ | 120 | */ |
| 121 | public function savePurchaserInfo($project_id,$keyword,$data){ | 121 | public function savePurchaserInfo($project_id,$keyword,$data){ |
| 122 | - $param = []; | 122 | + $purchaserInfoModel = new PurchaserInfo(); |
| 123 | foreach ($data as $k =>$v){ | 123 | foreach ($data as $k =>$v){ |
| 124 | $v['project_id'] = $project_id; | 124 | $v['project_id'] = $project_id; |
| 125 | $v['keyword'] = $keyword; | 125 | $v['keyword'] = $keyword; |
| 126 | $v['email'] = json_encode($v['email'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); | 126 | $v['email'] = json_encode($v['email'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
| 127 | $v['mobile'] = json_encode($v['mobile'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); | 127 | $v['mobile'] = json_encode($v['mobile'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
| 128 | $v['social_media'] = json_encode($v['social_media'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); | 128 | $v['social_media'] = json_encode($v['social_media'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
| 129 | - $v['created_at'] = date('Y-m-d H:i:s'); | ||
| 130 | - $v['updated_at'] = $v['created_at']; | ||
| 131 | - $param[] = $v; | 129 | +// $v['created_at'] = date('Y-m-d H:i:s'); |
| 130 | +// $v['updated_at'] = $v['created_at']; | ||
| 131 | + $param = $v; | ||
| 132 | + $info = $purchaserInfoModel->read(['keyword'=>$keyword,'buyer'=>$v['buyer'],'project_id'=>$project_id],['id']); | ||
| 133 | + if($info === false){ | ||
| 134 | + $purchaserInfoModel->add($param); | ||
| 135 | + } | ||
| 132 | } | 136 | } |
| 133 | - $purchaserInfoModel = new PurchaserInfo(); | ||
| 134 | - return $purchaserInfoModel->insert($param); | 137 | + return true; |
| 135 | } | 138 | } |
| 136 | } | 139 | } |
| @@ -82,12 +82,22 @@ class SyncSubmitTask extends Command | @@ -82,12 +82,22 @@ class SyncSubmitTask extends Command | ||
| 82 | public function getTaskId() | 82 | public function getTaskId() |
| 83 | { | 83 | { |
| 84 | $task_id = Redis::rpop('sync_submit_task'); | 84 | $task_id = Redis::rpop('sync_submit_task'); |
| 85 | + $lockKey = 'lock_sync_submit_task'; | ||
| 85 | if (empty($task_id)) { | 86 | if (empty($task_id)) { |
| 86 | - $ids = SyncSubmitTaskModel::where('status', 0)->limit(100)->pluck('id'); | ||
| 87 | - foreach ($ids as $id) { | ||
| 88 | - Redis::lpush('sync_submit_task', $id); | 87 | + // 获取锁 |
| 88 | + if (Redis::setnx($lockKey, 1)) { | ||
| 89 | + // 设置锁的过期时间,防止死锁 | ||
| 90 | + Redis::expire($lockKey, 10); | ||
| 91 | + $ids = SyncSubmitTaskModel::where('status', 0)->limit(100)->pluck('id'); | ||
| 92 | + foreach ($ids as $id) { | ||
| 93 | + Redis::lpush('sync_submit_task', $id); | ||
| 94 | + } | ||
| 95 | + $task_id = Redis::rpop('sync_submit_task'); | ||
| 96 | + Redis::del($lockKey); | ||
| 97 | + } else { | ||
| 98 | + // 未获取到锁 | ||
| 99 | + return ''; | ||
| 89 | } | 100 | } |
| 90 | - $task_id = Redis::rpop('sync_submit_task'); | ||
| 91 | } | 101 | } |
| 92 | return $task_id; | 102 | return $task_id; |
| 93 | } | 103 | } |
| @@ -22,6 +22,7 @@ use App\Models\Product\Product; | @@ -22,6 +22,7 @@ use App\Models\Product\Product; | ||
| 22 | use App\Models\Project\DeployOptimize; | 22 | use App\Models\Project\DeployOptimize; |
| 23 | use App\Models\Project\MinorLanguages; | 23 | use App\Models\Project\MinorLanguages; |
| 24 | use App\Models\Project\Project; | 24 | use App\Models\Project\Project; |
| 25 | +use App\Models\Purchaser\PurchaserInfo; | ||
| 25 | use App\Services\AmazonS3Service; | 26 | use App\Services\AmazonS3Service; |
| 26 | use App\Services\ProjectServer; | 27 | use App\Services\ProjectServer; |
| 27 | use App\Utils\EncryptUtils; | 28 | use App\Utils\EncryptUtils; |
| @@ -47,11 +48,14 @@ class Demo extends Command | @@ -47,11 +48,14 @@ class Demo extends Command | ||
| 47 | protected $description = 'demo'; | 48 | protected $description = 'demo'; |
| 48 | 49 | ||
| 49 | public function handle(){ | 50 | public function handle(){ |
| 50 | - $serverIpModel = new ServersIp(); | ||
| 51 | - $lists = $serverIpModel->list(); | 51 | + $p = new PurchaserInfo(); |
| 52 | + $lists = $p->list(); | ||
| 52 | foreach ($lists as $k => $v){ | 53 | foreach ($lists as $k => $v){ |
| 53 | - $domain = strtolower($v['domain']); | ||
| 54 | - $serverIpModel->edit(['domain'=>$domain],['id'=>$v['id']]); | 54 | + $info = $p->read(['project_id'=>$v['project_id'],'keyword'=>$v['keyword'],'buyer'=>$v['buyer']]); |
| 55 | + if($info === false){ | ||
| 56 | + continue; | ||
| 57 | + } | ||
| 58 | + $p->del(['project_id'=>$v['project_id'],'keyword'=>$v['keyword'],'buyer'=>$v['buyer'],'id'=>['!=',$v['id']]]); | ||
| 55 | } | 59 | } |
| 56 | return true; | 60 | return true; |
| 57 | } | 61 | } |
| @@ -46,12 +46,12 @@ class ReplaceHtmlController extends BaseController | @@ -46,12 +46,12 @@ class ReplaceHtmlController extends BaseController | ||
| 46 | public function replaceTemplateMainHtml(ReplaceHtmlLogic $logic){ | 46 | public function replaceTemplateMainHtml(ReplaceHtmlLogic $logic){ |
| 47 | $this->request->validate([ | 47 | $this->request->validate([ |
| 48 | 'name'=>'required', | 48 | 'name'=>'required', |
| 49 | - 'html'=>'required', | 49 | +// 'html'=>'required', |
| 50 | 'old_html'=>'required', | 50 | 'old_html'=>'required', |
| 51 | 'project_id'=>'required', | 51 | 'project_id'=>'required', |
| 52 | ],[ | 52 | ],[ |
| 53 | 'name.required' => '需替换页面标识不能为空', | 53 | 'name.required' => '需替换页面标识不能为空', |
| 54 | - 'html.required' => 'html不能为空', | 54 | +// 'html.required' => 'html不能为空', |
| 55 | 'old_html.required' => '替换前的html不能为空', | 55 | 'old_html.required' => '替换前的html不能为空', |
| 56 | 'project_id.required' => 'project_id不能为空', | 56 | 'project_id.required' => 'project_id不能为空', |
| 57 | ]); | 57 | ]); |
| @@ -88,10 +88,7 @@ class AyrReleaseController extends BaseController | @@ -88,10 +88,7 @@ class AyrReleaseController extends BaseController | ||
| 88 | } | 88 | } |
| 89 | //发送请求发布社交文章 | 89 | //发送请求发布社交文章 |
| 90 | $res = $ayrShare->post_send_msg($param,$share_info['profile_key']); | 90 | $res = $ayrShare->post_send_msg($param,$share_info['profile_key']); |
| 91 | - //保存数据库 | ||
| 92 | - if($res){ | ||
| 93 | - $ayrReleaseLogic->release_add($res); | ||
| 94 | - } | 91 | + $ayrReleaseLogic->release_add($res); |
| 95 | //保存返回的内容 | 92 | //保存返回的内容 |
| 96 | $this->response('success',Code::SUCCESS,json_decode($res)); | 93 | $this->response('success',Code::SUCCESS,json_decode($res)); |
| 97 | } | 94 | } |
| @@ -59,7 +59,7 @@ class ProductController extends BaseController | @@ -59,7 +59,7 @@ class ProductController extends BaseController | ||
| 59 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id | 59 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id |
| 60 | $userModel = new User(); | 60 | $userModel = new User(); |
| 61 | foreach ($lists['list'] as $k=>$v){ | 61 | foreach ($lists['list'] as $k=>$v){ |
| 62 | - $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);; | 62 | + $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']); |
| 63 | $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); | 63 | $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); |
| 64 | $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); | 64 | $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); |
| 65 | $v['created_uid_text'] = $userModel->getName($v['created_uid']); | 65 | $v['created_uid_text'] = $userModel->getName($v['created_uid']); |
| @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\Suppliers; | @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\Suppliers; | ||
| 12 | use App\Enums\Common\Code; | 12 | use App\Enums\Common\Code; |
| 13 | use App\Http\Controllers\Bside\BaseController; | 13 | use App\Http\Controllers\Bside\BaseController; |
| 14 | use App\Models\Purchaser\Purchaser; | 14 | use App\Models\Purchaser\Purchaser; |
| 15 | +use App\Models\Purchaser\PurchaserInfo; | ||
| 15 | 16 | ||
| 16 | /** | 17 | /** |
| 17 | * @remark :推荐采购商 | 18 | * @remark :推荐采购商 |
| @@ -22,7 +23,7 @@ use App\Models\Purchaser\Purchaser; | @@ -22,7 +23,7 @@ use App\Models\Purchaser\Purchaser; | ||
| 22 | */ | 23 | */ |
| 23 | class SuppliersController extends BaseController | 24 | class SuppliersController extends BaseController |
| 24 | { | 25 | { |
| 25 | - public $domain = 'https://admin.hagro.cn/'; | 26 | + public $domain = 'https://fob.ai.cc/'; |
| 26 | 27 | ||
| 27 | /** | 28 | /** |
| 28 | * @remark :推荐采购商 | 29 | * @remark :推荐采购商 |
| @@ -32,21 +33,14 @@ class SuppliersController extends BaseController | @@ -32,21 +33,14 @@ class SuppliersController extends BaseController | ||
| 32 | * @time :2024/3/4 10:10 | 33 | * @time :2024/3/4 10:10 |
| 33 | */ | 34 | */ |
| 34 | public function recommendedPurchaser(){ | 35 | public function recommendedPurchaser(){ |
| 35 | - $purchaserModel = new Purchaser(); | ||
| 36 | - $data = []; | 36 | + $purchaserModel = new PurchaserInfo(); |
| 37 | $this->map['project_id'] = $this->user['project_id']; | 37 | $this->map['project_id'] = $this->user['project_id']; |
| 38 | - $lists = $purchaserModel->list($this->map); | ||
| 39 | - if(!empty($lists)){ | ||
| 40 | - foreach ($lists as $v){ | ||
| 41 | - if(!empty($v['data'])){ | ||
| 42 | - $resultData = json_decode($v['data'],true); | ||
| 43 | - foreach ($resultData as $value){ | ||
| 44 | - $value = (array)$value; | ||
| 45 | - $value['keyword'] = $v['keyword']; | ||
| 46 | - $data[] = $value; | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | - } | 38 | + $data = $purchaserModel->list($this->map); |
| 39 | + foreach ($data as $k => $v){ | ||
| 40 | + $v['email'] = json_decode($v['email'],true); | ||
| 41 | + $v['mobile'] = json_decode($v['mobile'],true); | ||
| 42 | + $v['social_media'] = json_decode($v['social_media'],true); | ||
| 43 | + $data[$k] = $v; | ||
| 50 | } | 44 | } |
| 51 | $this->response('success',Code::SUCCESS,$data); | 45 | $this->response('success',Code::SUCCESS,$data); |
| 52 | } | 46 | } |
| @@ -637,12 +637,21 @@ class ProjectLogic extends BaseLogic | @@ -637,12 +637,21 @@ class ProjectLogic extends BaseLogic | ||
| 637 | public function channelSource($param){ | 637 | public function channelSource($param){ |
| 638 | switch ($param['type']){ | 638 | switch ($param['type']){ |
| 639 | case Project::TYPE_ONE: | 639 | case Project::TYPE_ONE: |
| 640 | - return Zone::pluck('title', 'id')->toArray(); | 640 | + $data = [0=>'所有']; |
| 641 | + $list = (new Zone())->list([],'id',['id','title'],'asc'); | ||
| 642 | + foreach ($list as $v){ | ||
| 643 | + $data[$v['id']] = $v['title']; | ||
| 644 | + } | ||
| 645 | + return $data; | ||
| 641 | case Project::TYPE_TWO: | 646 | case Project::TYPE_TWO: |
| 642 | if(isset($param['alias'])){ | 647 | if(isset($param['alias'])){ |
| 643 | return Channel::where('alias', 'like' ,'%'.$param['alias'].'%')->pluck('alias', 'id')->toArray(); | 648 | return Channel::where('alias', 'like' ,'%'.$param['alias'].'%')->pluck('alias', 'id')->toArray(); |
| 644 | } | 649 | } |
| 645 | - return Channel::where('zone_id', $param['zone_id']??0)->pluck('alias', 'id')->toArray(); | 650 | + $map = []; |
| 651 | + if($param['zone_id'] != 0){ | ||
| 652 | + $map['zone_id'] = $param['zone_id']; | ||
| 653 | + } | ||
| 654 | + return Channel::where($map)->pluck('alias', 'id')->toArray(); | ||
| 646 | case Project::TYPE_THREE: | 655 | case Project::TYPE_THREE: |
| 647 | return User::where('channel_id', $param['channel_id']??0)->pluck('name', 'id')->toArray(); | 656 | return User::where('channel_id', $param['channel_id']??0)->pluck('name', 'id')->toArray(); |
| 648 | } | 657 | } |
| @@ -658,7 +667,18 @@ class ProjectLogic extends BaseLogic | @@ -658,7 +667,18 @@ class ProjectLogic extends BaseLogic | ||
| 658 | * @time :2023/9/4 14:29 | 667 | * @time :2023/9/4 14:29 |
| 659 | */ | 668 | */ |
| 660 | public function editDomainStatus($domain,$project_id){ | 669 | public function editDomainStatus($domain,$project_id){ |
| 670 | + | ||
| 671 | + $projectOptimize = new DeployOptimize(); | ||
| 672 | + $optimizeInfo = $projectOptimize->read(['project_id'=>$project_id],['domain']); | ||
| 673 | + if($optimizeInfo['domain'] == $domain){ | ||
| 674 | + return $this->success(); | ||
| 675 | + } | ||
| 661 | $domainModel = new DomainInfo(); | 676 | $domainModel = new DomainInfo(); |
| 677 | + //查看当前域名是否已使用 | ||
| 678 | + $domainInfo = $domainModel->read(['id'=>$domain,'project_id'=>['!=',0]]); | ||
| 679 | + if($domainInfo !== false){ | ||
| 680 | + $this->fail('当前域名已被其他服务器使用'); | ||
| 681 | + } | ||
| 662 | //先清空上一次所绑定的域名 | 682 | //先清空上一次所绑定的域名 |
| 663 | $info = $domainModel->read(['project_id'=>$project_id]); | 683 | $info = $domainModel->read(['project_id'=>$project_id]); |
| 664 | if($info !== false){ | 684 | if($info !== false){ |
| @@ -156,7 +156,7 @@ class ReplaceHtmlLogic extends BaseLogic | @@ -156,7 +156,7 @@ class ReplaceHtmlLogic extends BaseLogic | ||
| 156 | 'template_id'=>$template_id, | 156 | 'template_id'=>$template_id, |
| 157 | 'status'=>$this->model::STATUS, | 157 | 'status'=>$this->model::STATUS, |
| 158 | 'old_html'=>$param['old_html'], | 158 | 'old_html'=>$param['old_html'], |
| 159 | - 'html'=>$param['html'], | 159 | + 'html'=>$param['html'] ?? '', |
| 160 | 'project_id'=>$param['project_id'], | 160 | 'project_id'=>$param['project_id'], |
| 161 | 'total_num'=>0, | 161 | 'total_num'=>0, |
| 162 | 'operator_id'=>$this->manager['id'] | 162 | 'operator_id'=>$this->manager['id'] |
| @@ -47,10 +47,7 @@ class AyrReleaseLogic extends BaseLogic | @@ -47,10 +47,7 @@ class AyrReleaseLogic extends BaseLogic | ||
| 47 | $this->param['platforms'] = json_encode($this->param['platforms']); | 47 | $this->param['platforms'] = json_encode($this->param['platforms']); |
| 48 | $info = $this->model->read(['platforms'=>$this->param['platforms'],'operator_id'=>$this->param['operator_id'],'project_id'=>$this->param['project_id'],'title'=>$this->param['title']]); | 48 | $info = $this->model->read(['platforms'=>$this->param['platforms'],'operator_id'=>$this->param['operator_id'],'project_id'=>$this->param['project_id'],'title'=>$this->param['title']]); |
| 49 | if($info === false){ | 49 | if($info === false){ |
| 50 | - $rs = $this->model->add($this->param); | ||
| 51 | - if($rs === false){ | ||
| 52 | - $this->fail('error'); | ||
| 53 | - } | 50 | + $this->model->add($this->param); |
| 54 | } | 51 | } |
| 55 | return $this->success(); | 52 | return $this->success(); |
| 56 | } | 53 | } |
| @@ -28,9 +28,18 @@ class BTemplateModuleLogic extends BaseLogic | @@ -28,9 +28,18 @@ class BTemplateModuleLogic extends BaseLogic | ||
| 28 | $map['status'] = 0; | 28 | $map['status'] = 0; |
| 29 | $list = $this->model->list($map,$order,$filed); | 29 | $list = $this->model->list($map,$order,$filed); |
| 30 | $templateLabel = new TemplateLabel(); | 30 | $templateLabel = new TemplateLabel(); |
| 31 | - foreach ($list as $k => $v){ | ||
| 32 | - $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc'); | ||
| 33 | - $list[$k] = $v; | 31 | + $label = []; |
| 32 | + foreach ($list as $v){ | ||
| 33 | + $label[] = $v['id']; | ||
| 34 | + } | ||
| 35 | + $label_arr = $templateLabel->list(['template_id'=>['in',$label],'type'=>2],'id',['id','template_id','name'],'desc'); | ||
| 36 | + foreach ($list as $k1 => $v1){ | ||
| 37 | + foreach ($label_arr as $v2){ | ||
| 38 | + if($v2['template_id'] == $v1['id']){ | ||
| 39 | + $v1['label'][] = $v2; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + $list[$k1] = $v1; | ||
| 34 | } | 43 | } |
| 35 | return $this->success($list); | 44 | return $this->success($list); |
| 36 | } | 45 | } |
| @@ -33,13 +33,22 @@ class BTemplateModuleProjectLogic extends BaseLogic | @@ -33,13 +33,22 @@ class BTemplateModuleProjectLogic extends BaseLogic | ||
| 33 | public function ModuleList($map,$order = 'created_at',$filed = ['id','name','status','image','html','project_id']){ | 33 | public function ModuleList($map,$order = 'created_at',$filed = ['id','name','status','image','html','project_id']){ |
| 34 | $map['deleted_status'] = 0; | 34 | $map['deleted_status'] = 0; |
| 35 | $map['project_id'] = $this->user['project_id']; | 35 | $map['project_id'] = $this->user['project_id']; |
| 36 | - $lists = $this->model->list($map,$order,$filed); | 36 | + $list = $this->model->list($map,$order,$filed); |
| 37 | $templateLabel = new TemplateLabel(); | 37 | $templateLabel = new TemplateLabel(); |
| 38 | - foreach ($lists as $k => $v){ | ||
| 39 | - $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc'); | ||
| 40 | - $lists[$k] = $v; | 38 | + $label = []; |
| 39 | + foreach ($list as $v){ | ||
| 40 | + $label[] = $v['id']; | ||
| 41 | } | 41 | } |
| 42 | - return $this->success($lists); | 42 | + $label_arr = $templateLabel->list(['template_id'=>['in',$label],'type'=>2],'id',['id','template_id','name'],'desc'); |
| 43 | + foreach ($list as $k1 => $v1){ | ||
| 44 | + foreach ($label_arr as $v2){ | ||
| 45 | + if($v2['template_id'] == $v1['id']){ | ||
| 46 | + $v1['label'][] = $v2; | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + $list[$k1] = $v1; | ||
| 50 | + } | ||
| 51 | + return $this->success($list); | ||
| 43 | } | 52 | } |
| 44 | 53 | ||
| 45 | /** | 54 | /** |
-
请 注册 或 登录 后发表评论