| 
						
						
						
					 | 
				
				 | 
				
					@ -1,6 +1,7 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					<?php | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					namespace App\Service; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\AdminSetting; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\Agent; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\MiniProgramTemplate; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\MiniProgramUploadLog; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -99,6 +100,34 @@ class UploadMiniProgram | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										Redis::hset($redis_key, $agent->appid, 1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									//配置小程序用户隐私保护指引:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									$redis_key = 'mini_program_set_privacy'; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									if (!Redis::hget($redis_key, $agent->appid)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										$data = [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											'privacy_ver' => 2, //1表示现网版本;2表示开发版。默认是2开发版
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											'owner_setting' => [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												'contact_phone' => AdminSetting::val('service_component_phone'), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												'notice_method' => '系统公告', | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											'setting_list' => [ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												[ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
													"privacy_key" => "Location", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
													"privacy_desc" => "位置信息", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												[ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
													"privacy_key" => "PhoneNumber", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
													"privacy_desc" => "手机号", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											], | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										]; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										$res = $code->httpPostJson('cgi-bin/component/setprivacysetting', $data); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										if (!isset($res['errcode'], $res['errmsg']) || $res['errcode'] != 0 || $res['errmsg'] != 'ok') { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											throw new Exception('配置小程序用户隐私保护指引失败,原因:' . $res['errmsg'] ?? (is_array($res) ? join(',', $res) : '未知')); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										Redis::hset($redis_key, $agent->appid, 1); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									echo "上传成功,并已提交审核"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								} else if (isset($audit_err_code[$res['errcode']])) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									throw new Exception($audit_err_code[$res['errcode']]); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |