|
|
|
@ -513,6 +513,51 @@ class Server |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function submitAudit($appid): bool |
|
|
|
|
{ |
|
|
|
|
$access_token = $this->authorizerAccessToken($appid); |
|
|
|
|
if ($access_token) { |
|
|
|
|
$url = 'https://api.weixin.qq.com/wxa/submit_audit?access_token=' . $access_token; |
|
|
|
|
$data['item_list'] = $this->getAllCategory($appid); |
|
|
|
|
$result = $this->curlPost($url, json_encode($data)); |
|
|
|
|
$result = json_decode($result, true); |
|
|
|
|
if (!empty($result) && intval($result['errcode']) == 0 && !empty($result['auditid'])) { |
|
|
|
|
$model = new WxserverAccount(); |
|
|
|
|
$up['audit_status'] = 1; |
|
|
|
|
$up['audit_time'] = date('Y-m-d H:i:s'); |
|
|
|
|
$up['audit_id'] = $result['auditid']; |
|
|
|
|
$model->update($up, ['appid' => $appid]); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function getAllCategory($appid): array |
|
|
|
|
{ |
|
|
|
|
$data = []; |
|
|
|
|
$access_token = $this->authorizerAccessToken($appid); |
|
|
|
|
if ($access_token) { |
|
|
|
|
$url = 'https://api.weixin.qq.com/wxa/get_category?access_token=' . $access_token; |
|
|
|
|
$result = $this->curlGet($url); |
|
|
|
|
$result = json_decode($result, true); |
|
|
|
|
if ($result && !empty($result['category_list'])) { |
|
|
|
|
$category_list = $result['category_list']; |
|
|
|
|
foreach ($category_list as $value) { |
|
|
|
|
$data[] = [ |
|
|
|
|
'first_class' => $value['first_class'], |
|
|
|
|
'second_class' => $value['second_class'], |
|
|
|
|
'third_class' => $value['third_class'], |
|
|
|
|
'first_id' => $value['first_id'], |
|
|
|
|
'second_id' => $value['second_id'], |
|
|
|
|
'third_id' => $value['third_id'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function curlPost($url, $post_data, $timeout = 5) |
|
|
|
|
{ |
|
|
|
|
$ch = curl_init(); |
|
|
|
|