作者 李宇航

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

Master server



查看合并请求 !665
@@ -59,102 +59,4 @@ class Demo extends Command @@ -59,102 +59,4 @@ class Demo extends Command
59 } 59 }
60 return true; 60 return true;
61 } 61 }
62 -  
63 -// public function handle(){  
64 -// $keywordVideoModel = new KeywordVideoTask();  
65 -// $project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray();  
66 -// //查看是否有子记录  
67 -// foreach ($project_id_arr as $values){  
68 -// $logModel = new KeywordVideoTaskLog();  
69 -// $logInfo = $logModel->read(['project_id'=>$values]);  
70 -// if($logInfo === false){  
71 -// echo date('Y-m-d H:i:s') . '开启的项目project_id:'.$values . PHP_EOL;  
72 -// $keywordVideoModel->edit(['status'=>0],['project_id'=>$values]);  
73 -// }  
74 -// }  
75 -// $projectModel = new Project();  
76 -// $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]);  
77 -// $data = [];  
78 -// foreach ($list as $v){  
79 -// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;  
80 -// ProjectServer::useProject($v['id']);  
81 -// $this->getProductList();  
82 -// DB::disconnect('custom_mysql');  
83 -// }  
84 -// echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;  
85 -// }  
86 -  
87 -// public function getProductList(){  
88 -// $productModel = new Product();  
89 -// $product_all_id = $productModel::whereRaw('LENGTH(keyword_id) > 50')->pluck('id')->toArray();  
90 -// if(empty($product_all_id)){  
91 -// return true;  
92 -// }  
93 -// $lists = $productModel->whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get()->toArray();  
94 -// foreach ($lists as $k => $v){  
95 -// echo date('Y-m-d H:i:s') . '项目id:'.$v['project_id'].'+产品product_id:'.$v['id'] . PHP_EOL;  
96 -// $str = ',';  
97 -// shuffle($v['keyword_id']);  
98 -// foreach ($v['keyword_id'] as $key => $value){  
99 -// if($key == 6){  
100 -// break;  
101 -// }  
102 -// $str .= $value.',';  
103 -// }  
104 -// $productModel->edit(['keyword_id'=>$str],['id'=>$v['id']]);  
105 -// }  
106 -// return true;  
107 -// }  
108 -//  
109 -// /**  
110 -// * @remark :关键字有视频的改为1  
111 -// * @name :getProductKeywordInfo  
112 -// * @author :lyh  
113 -// * @method :post  
114 -// * @time :2024/5/31 9:54  
115 -// */  
116 -// public function saveKeyword(){  
117 -// $keywordModel = new Keyword();  
118 -// $rs = $keywordModel->edit(['is_video_keyword'=>0],['video'=>'']);  
119 -// echo date('Y-m-d H:i:s') . 'end'.$rs . PHP_EOL;  
120 -// return true;  
121 -// }  
122 -  
123 -// public function handle(){  
124 -// //切换数据库配置  
125 -// ProjectServer::useProject(1862);  
126 -// return $this->initTable(1380,1862);  
127 -// }  
128 -//  
129 -// public function initTable($project_id, $news_project_id)  
130 -// {  
131 -// config(['database.connections.custom_tmp_mysql_copy.database' => 'gl_data_' . $project_id]);  
132 -// $database_name = DB::connection('custom_tmp_mysql_copy')->getDatabaseName();  
133 -// $tables = Schema::connection('custom_tmp_mysql_copy')->getAllTables();  
134 -// $tables = array_column($tables, 'Tables_in_' . $database_name);  
135 -// foreach ($tables as $table) {  
136 -// $has_table = Schema::connection('custom_mysql')->hasTable($table);  
137 -// if (!$has_table) {  
138 -// $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}");  
139 -// DB::connection('custom_mysql')->statement(array_values((array)$sql[0])[0]); // 修正此处的sql语句获取方式  
140 -// }  
141 -//  
142 -// if ($table == 'gl_customer_visit' || $table == 'gl_customer_visit_item' || $table == 'gl_inquiry_other' || $table == 'gl_inquiry_form_data' || $table == 'gl_inquiry_form') {  
143 -// continue;  
144 -// }  
145 -// DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据  
146 -// DB::connection('custom_mysql')->table($table)->insertUsing(  
147 -// [], // 列名数组,留空表示插入所有列  
148 -// function ($query) use ($table, $project_id) {  
149 -// $name = 'gl_data_' . $project_id . '.' . $table;  
150 -// $query->select('*')->from("{$name}");  
151 -// }  
152 -// );  
153 -//  
154 -// if (Schema::connection('custom_mysql')->hasColumn($table, 'project_id')) {  
155 -// DB::connection('custom_mysql')->table($table)->update(['project_id' => $news_project_id]);  
156 -// }  
157 -// }  
158 -// return true;  
159 -// }  
160 } 62 }
@@ -39,7 +39,8 @@ class HrLogic extends BaseLogic @@ -39,7 +39,8 @@ class HrLogic extends BaseLogic
39 * @time :2023/9/6 10:17 39 * @time :2023/9/6 10:17
40 */ 40 */
41 public function hrSave(){ 41 public function hrSave(){
42 - //处理参数 42 + $this->handleParam();
  43 + //处理参数
43 foreach ($this->model::specieField() as $v){ 44 foreach ($this->model::specieField() as $v){
44 $this->param = $this->setJson($v,$this->param); 45 $this->param = $this->setJson($v,$this->param);
45 } 46 }
@@ -52,6 +53,22 @@ class HrLogic extends BaseLogic @@ -52,6 +53,22 @@ class HrLogic extends BaseLogic
52 } 53 }
53 54
54 /** 55 /**
  56 + * @remark :处理字段
  57 + * @name :handleParam
  58 + * @author :lyh
  59 + * @method :post
  60 + * @time :2024/7/10 16:32
  61 + */
  62 + public function handleParam(){
  63 + $this->param['status'] = empty($this->param['status']) ? 1 : $this->param['status'];
  64 + $this->param['education'] = empty($this->param['education']) ? 1 : $this->param['education'];
  65 + $this->param['entry_position'] = empty($this->param['entry_position']) ? 1 : $this->param['entry_position'];
  66 + $this->param['p_level'] = empty($this->param['p_level']) ? 1 : $this->param['p_level'];
  67 + $this->param['dept_id'] = empty($this->param['dept_id']) ? 1 : $this->param['dept_id'];
  68 + $this->param['belong_group'] = empty($this->param['belong_group']) ? 1 : $this->param['belong_group'];
  69 + }
  70 +
  71 + /**
55 * @remark :添加人事信息时 同步添加管理员账号 72 * @remark :添加人事信息时 同步添加管理员账号
56 * @name :addManager 73 * @name :addManager
57 * @author :lyh 74 * @author :lyh
@@ -70,18 +87,18 @@ class HrLogic extends BaseLogic @@ -70,18 +87,18 @@ class HrLogic extends BaseLogic
70 'password'=>Hash::make('globalsov6'), 87 'password'=>Hash::make('globalsov6'),
71 'gid'=>4, 88 'gid'=>4,
72 ]; 89 ];
73 -// DB::beginTransaction();  
74 -// try { 90 + DB::beginTransaction();
  91 + try {
75 $managerModel = new Manage(); 92 $managerModel = new Manage();
76 $this->param['manage_id'] = $managerModel->addReturnId($data); 93 $this->param['manage_id'] = $managerModel->addReturnId($data);
77 $this->model->add($this->param); 94 $this->model->add($this->param);
78 //同步到B端演示项目 95 //同步到B端演示项目
79 $this->syncBProjectUser($this->param['mobile'], $this->param['mobile'], $this->param['name'], $this->param['status']); 96 $this->syncBProjectUser($this->param['mobile'], $this->param['mobile'], $this->param['name'], $this->param['status']);
80 -// DB::commit();  
81 -// }catch (\Exception $e){  
82 -// DB::rollBack();  
83 -// $this->fail('系统错误请联系管理员');  
84 -// } 97 + DB::commit();
  98 + }catch (\Exception $e){
  99 + DB::rollBack();
  100 + $this->fail('系统错误请联系管理员');
  101 + }
85 return $this->success(); 102 return $this->success();
86 } 103 }
87 104