作者 李宇航

合并分支 'master-server' 到 'master'

Master server



查看合并请求 !781
@@ -275,7 +275,11 @@ class VideoTask extends Command @@ -275,7 +275,11 @@ class VideoTask extends Command
275 } 275 }
276 }else{ 276 }else{
277 $product_all_id = Product::where('thumb','!=',null)->where("status",Product::STATUS_ON)->inRandomOrder()->take(20)->pluck('id')->toArray(); 277 $product_all_id = Product::where('thumb','!=',null)->where("status",Product::STATUS_ON)->inRandomOrder()->take(20)->pluck('id')->toArray();
278 - $products = Product::whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get(); 278 + if(empty($product_all_id)){
  279 + $products = [];
  280 + }else{
  281 + $products = Product::whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get();
  282 + }
279 } 283 }
280 $data = []; 284 $data = [];
281 if (!empty($products)){ 285 if (!empty($products)){
@@ -12,6 +12,8 @@ namespace App\Http\Controllers\Bside\BCom; @@ -12,6 +12,8 @@ namespace App\Http\Controllers\Bside\BCom;
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\Log\OperationHeartbeat; 14 use App\Models\Log\OperationHeartbeat;
  15 +use App\Models\Manage\Manage;
  16 +use App\Models\User\User;
15 17
16 class OperationHeartbeatController extends BaseController 18 class OperationHeartbeatController extends BaseController
17 { 19 {
@@ -36,6 +38,7 @@ class OperationHeartbeatController extends BaseController @@ -36,6 +38,7 @@ class OperationHeartbeatController extends BaseController
36 'is_custom.required' => '是否为扩展模版', 38 'is_custom.required' => '是否为扩展模版',
37 'is_template.required' => '详情页/可视化', 39 'is_template.required' => '详情页/可视化',
38 ]); 40 ]);
  41 +
39 $condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'], 42 $condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'],
40 'is_list'=>$this->param['is_list'],'is_custom'=>$this->param['is_custom'],'is_template'=>$this->param['is_template']]; 43 'is_list'=>$this->param['is_list'],'is_custom'=>$this->param['is_custom'],'is_template'=>$this->param['is_template']];
41 $operationHeartbeatModel = new OperationHeartbeat(); 44 $operationHeartbeatModel = new OperationHeartbeat();
@@ -44,9 +47,11 @@ class OperationHeartbeatController extends BaseController @@ -44,9 +47,11 @@ class OperationHeartbeatController extends BaseController
44 if($info === false){ 47 if($info === false){
45 $condition['operator_id'] = $this->user['id']; 48 $condition['operator_id'] = $this->user['id'];
46 $condition['project_id'] = $this->user['project_id']; 49 $condition['project_id'] = $this->user['project_id'];
  50 + $condition['ip'] = $this->request->ip();
  51 + $condition['manager_id'] = $this->user['manager_id'] ?? 0;
47 $operationHeartbeatModel->addReturnId($condition); 52 $operationHeartbeatModel->addReturnId($condition);
48 }else{ 53 }else{
49 - $operationHeartbeatModel->edit(['status'=>$condition['status'] ?? 0],['id'=>$info['id']]); 54 + $operationHeartbeatModel->edit(['status'=>$condition['status'] ?? 0,'ip'=>$this->request->ip(),'manager_id'=> $this->user['manager_id'] ?? 0],['id'=>$info['id']]);
50 } 55 }
51 $this->response('success'); 56 $this->response('success');
52 } 57 }
@@ -81,10 +86,28 @@ class OperationHeartbeatController extends BaseController @@ -81,10 +86,28 @@ class OperationHeartbeatController extends BaseController
81 }else{ 86 }else{
82 $date_time = strtotime($info['updated_at']) + 7200; 87 $date_time = strtotime($info['updated_at']) + 7200;
83 if($date_time < time()){ 88 if($date_time < time()){
84 - $operationHeartbeatModel->edit(['status'=>0],$condition); 89 + $operationHeartbeatModel->edit(['status'=>0,'ip'=>'127.0.0.1'],$condition);
85 $info['status'] = 0; 90 $info['status'] = 0;
86 } 91 }
87 } 92 }
  93 + if($info['status'] == 1){
  94 + //当前登录为切入登录
  95 + if(isset($this->user['manager_id']) && !empty($this->user['manager_id'])){
  96 + //上一次验证也是切入登录
  97 + if($info['manager_id'] != 0){
  98 + $managerModel = new Manage();
  99 + $managerInfo = $managerModel->read(['id'=>$info['manager_id']],['name']);
  100 + $info['message'] = '此页面数据已有人在编辑,请勿重复操作!操作人ip:'.$info['ip'].'操作的管理员为:'.$managerInfo['name'];
  101 + }else{
  102 + //账号密码登录
  103 + $userModel = new User();
  104 + $userInfo = $userModel->read(['id'=>$info['operator_id']],['name']);
  105 + $info['message'] = '此页面数据已有人在编辑,请勿重复操作!'.$userInfo['name'].'用户登录在操作。';
  106 + }
  107 + }else{
  108 + $info['message'] = '此页面数据已有人在编辑,请勿重复操作!';
  109 + }
  110 + }
88 $this->response('success',Code::SUCCESS,$info); 111 $this->response('success',Code::SUCCESS,$info);
89 } 112 }
90 } 113 }
@@ -186,8 +186,8 @@ class InquiryLogic extends BaseLogic @@ -186,8 +186,8 @@ class InquiryLogic extends BaseLogic
186 public function sendMobileVerifyData($phone){ 186 public function sendMobileVerifyData($phone){
187 $phoneDataModel = new PhoneData(); 187 $phoneDataModel = new PhoneData();
188 $num_phone = preg_replace('/\D/', '',$phone) ?? ''; // \D 匹配所有非数字字符 188 $num_phone = preg_replace('/\D/', '',$phone) ?? ''; // \D 匹配所有非数字字符
189 - $info = $phoneDataModel->read(['phone'=>$num_phone]);  
190 - if($info === false){ 189 + $data = $phoneDataModel->read(['phone'=>$num_phone]);
  190 + if($data === false){
191 $url = 'https://fob.ai.cc/api/mobile_verify_data/'.$phone; 191 $url = 'https://fob.ai.cc/api/mobile_verify_data/'.$phone;
192 $data = http_get($url); 192 $data = http_get($url);
193 if(!empty($data)){ 193 if(!empty($data)){