作者 赵彬吉

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :DomainInfo.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/9/11 14:37
  8 + */
  9 +
  10 +namespace App\Console\Commands\Domain;
  11 +
  12 +use Illuminate\Console\Command;
  13 +use App\Models\Domain\DomainInfo as DomainInfoModel;
  14 +
  15 +class DomainInfo extends Command
  16 +{
  17 + /**
  18 + * The name and signature of the console command.
  19 + *
  20 + * @var string
  21 + */
  22 + protected $signature = 'domain_info';
  23 +
  24 + /**
  25 + * The console command description.
  26 + *
  27 + * @var string
  28 + */
  29 + protected $description = '域名相关';
  30 +
  31 + public function handle(){
  32 + $domainModel = new DomainInfoModel();
  33 + $map = [];
  34 + $list = $domainModel->list($map);
  35 + $context = stream_context_create([
  36 + 'ssl' => [
  37 + 'capture_peer_cert' => true,
  38 + 'capture_peer_cert_chain' => false,
  39 + ],
  40 + ]);
  41 + $stream = stream_socket_client('ssl://oa.quanqiusou.cn:443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);
  42 + if(!$stream) {
  43 + die("Failed to connect: $errno - $errstr");
  44 + }
  45 + $remote_cert = stream_context_get_params($stream)['options']['ssl']['peer_certificate'];
  46 + if(!$remote_cert) {
  47 + die("Failed to retrieve certificate");
  48 + }
  49 + $valid_from = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validFrom_time_t']);
  50 + $valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']);
  51 + fclose($stream);
  52 + echo "Certificate Valid From: $valid_from<br>";
  53 + echo "Certificate Valid To: $valid_to<br>";
  54 + }
  55 +}
@@ -125,17 +125,30 @@ class ComController extends BaseController @@ -125,17 +125,30 @@ class ComController extends BaseController
125 * @method 125 * @method
126 */ 126 */
127 public function edit_info(){ 127 public function edit_info(){
128 - $this->request->validate([  
129 - 'password'=>['required'],  
130 - 'name'=>['required'],  
131 - ],[  
132 - 'password.required'=>'密码必须填写',  
133 - 'name.required'=>'名称必须填写',  
134 - ]);  
135 - $userLogic = new UserLogic();  
136 - $this->param['id'] = $this->uid;  
137 - $userLogic->edits();  
138 - $this->response('编辑成功'); 128 + $this->request->validate([
  129 + 'oldPassword'=>'required',
  130 + 'password' => 'required',
  131 + 'confirm'=>'required',
  132 + ], [
  133 + 'oldPassword.required' => '请输入原密码',
  134 + 'password.required' => '请输入新密码',
  135 + 'confirm.required' => '请再次输入新密码',
  136 + ]);
  137 + //查询员密码是否正确
  138 + $userModel = new User();
  139 + $info = $userModel->read(['id'=>$this->user['id']]);
  140 + if($info['password'] != base64_encode(md5($this->param['oldPassword']))){
  141 + $this->response('原密码错误',Code::USER_ERROR);
  142 + }
  143 + if($this->param['password'] != $this->param['confirm']){
  144 + $this->response('两次密码不一致');
  145 + }
  146 + $rs = $userModel->edit(['password'=>base64_encode(md5($this->param['password']))],['id'=>$this->user['id']]);
  147 + if($rs === false){
  148 + $this->response('系统错误',Code::SYSTEM_ERROR);
  149 + }
  150 + Cache::pull($info['token']);
  151 + $this->response('success',Code::USER_LOGIN_ERROE);
139 } 152 }
140 153
141 /** 154 /**
@@ -43,9 +43,9 @@ class UserLoginLogic @@ -43,9 +43,9 @@ class UserLoginLogic
43 $this->fail('当前用户不存在或者被禁用',Code::USER_REGISTER_ERROE); 43 $this->fail('当前用户不存在或者被禁用',Code::USER_REGISTER_ERROE);
44 } 44 }
45 //查看当前账号下有几个项目 45 //查看当前账号下有几个项目
46 - if($this->param['password'] == '123456' && $this->param['mobile'] != '15680871314'){  
47 - $this->fail('请使用短信登录,修改初始密码');  
48 - } 46 +// if($this->param['password'] == '123456' && $this->param['mobile'] != '15680871314'){
  47 +// $this->fail('请使用短信登录,修改初始密码');
  48 +// }
49 $password = base64_encode(md5($this->param['password'])); 49 $password = base64_encode(md5($this->param['password']));
50 $list = $this->model->list(['mobile'=>$this->param['mobile'], 50 $list = $this->model->list(['mobile'=>$this->param['mobile'],
51 'password'=>$password,'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']); 51 'password'=>$password,'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']);