作者 lyh

gx

@@ -127,15 +127,10 @@ class Common @@ -127,15 +127,10 @@ class Common
127 * @method :post 127 * @method :post
128 * @time :2023/5/9 10:47 128 * @time :2023/5/9 10:47
129 */ 129 */
130 - public static function uniqueMultiArray($multiArray) {  
131 - $flatArray = array();  
132 - foreach ($multiArray as $item) {  
133 - if (is_array($item)) {  
134 - $flatArray = array_merge($flatArray, self::uniqueMultiArray($item));  
135 - } else {  
136 - $flatArray[] = $item;  
137 - }  
138 - }  
139 - return array_map("unserialize", array_unique(array_map("serialize", $flatArray))); 130 + public static function uniqueMultiArray($arr) {
  131 + $arr = array_map('serialize', $arr);
  132 + $arr = array_unique($arr);
  133 + $arr = array_map('unserialize', $arr);
  134 + return $arr;
140 } 135 }
141 } 136 }
@@ -36,19 +36,18 @@ class WebSettingServiceLogic extends BaseLogic @@ -36,19 +36,18 @@ class WebSettingServiceLogic extends BaseLogic
36 * @time :2023/5/4 11:10 36 * @time :2023/5/4 11:10
37 */ 37 */
38 public function setting_service_save(){ 38 public function setting_service_save(){
39 - try { 39 +// try {
40 $this->param['data'] = Common::uniqueMultiArray($this->param['data']); 40 $this->param['data'] = Common::uniqueMultiArray($this->param['data']);
41 //删除以前的数据 41 //删除以前的数据
42 $this->model->del(['project_id'=>$this->user['project_id']]); 42 $this->model->del(['project_id'=>$this->user['project_id']]);
43 foreach ($this->param['data'] as $k => $v){ 43 foreach ($this->param['data'] as $k => $v){
44 - //查询数据是否在数组中存在  
45 $v['project_id'] = $this->user['project_id']; 44 $v['project_id'] = $this->user['project_id'];
46 $this->param['data'][$k] = $v; 45 $this->param['data'][$k] = $v;
47 } 46 }
48 $this->model->add_all($this->param['data']); 47 $this->model->add_all($this->param['data']);
49 - }catch (\Exception $e){  
50 - $this->fail('error');  
51 - } 48 +// }catch (\Exception $e){
  49 +// $this->fail('error');
  50 +// }
52 return $this->success(); 51 return $this->success();
53 } 52 }
54 } 53 }