wang hou sheng 8 months ago
parent f61441bcba
commit 463bea6903
  1. 43
      app/common/library/wxserver/Server.php

@ -649,7 +649,12 @@ class Server
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));
if (!empty($data['item_list'])) {
$data = '{}';
} else {
$data = json_encode($data);
}
$result = $this->curlPost($url, $data);
$result = json_decode($result, true);
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($result), 'created_at' => date('Y-m-d H:i:s')]);
if (!empty($result) && intval($result['errcode']) == 0 && !empty($result['auditid'])) {
@ -717,20 +722,28 @@ class Server
if ($result && !empty($result['category_list'])) {
$category_list = $result['category_list'];
foreach ($category_list as $value) {
$first_class = !empty($value['first_class']) ? $value['first_class'] : '';
$second_class = !empty($value['second_class']) ? $value['second_class'] : '';
$third_class = !empty($value['third_class']) ? $value['third_class'] : '';
$first_id = !empty($value['first_id']) ? $value['first_id'] : '';
$second_id = !empty($value['second_id']) ? $value['second_id'] : '';
$third_id = !empty($value['third_id']) ? $value['third_id'] : '';
$data[] = [
'first_class' => $first_class,
'second_class' => $second_class,
'third_class' => $third_class,
'first_id' => $first_id,
'second_id' => $second_id,
'third_id' => $third_id,
];
$arr = [];
if (!empty($value['first_class'])) {
$arr['first_class'] = $value['first_class'];
}
if (!empty($value['second_class'])) {
$arr['second_class'] = $value['second_class'];
}
if (!empty($value['third_class'])) {
$arr['third_class'] = $value['third_class'];
}
if (!empty($value['first_id'])) {
$arr['first_id'] = $value['first_id'];
}
if (!empty($value['second_id'])) {
$arr['second_id'] = $value['second_id'];
}
if (!empty($value['third_id'])) {
$arr['third_id'] = $value['third_id'];
}
if ($arr) {
$data[] = $arr;
}
}
}
}

Loading…
Cancel
Save