Browse Source

throw new提示修改

master
李可松 4 years ago
parent
commit
b11bb67194
  1. 12
      app/Service/UploadMiniProgram.php

12
app/Service/UploadMiniProgram.php

@ -49,7 +49,7 @@ class UploadMiniProgram
$commit = $code->commit($templateId, $extJson, $version, $description);
if (!isset($commit['errcode'], $commit['errmsg']) || $commit['errcode'] != 0 || $commit['errmsg'] != 'ok') {
throw new Exception(isset($commit['errmsg']) ? $commit['errmsg'] : join(',', $commit));
throw new Exception($commit['errmsg'] ?? join(',', $commit));
}
//提交审核,文档:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/submit_audit.html
@ -94,19 +94,19 @@ class UploadMiniProgram
$domain->modify($param); //服务器域名,服务器域名多次设置仅第一次成功,这里不校验返回结果正确性
$res = $domain->setWebviewDomain([$host]); //业务域名
if (!isset($res['errcode'], $res['errmsg']) || $res['errcode'] != 0 || $res['errmsg'] != 'ok') {
throw new Exception("设置业务域名{$host}失败,原因:" . $res['errmsg'] ?? (is_array($res) ? join(',', $res) : '未知'));
throw new Exception($agent->appid . "设置业务域名{$host}失败,原因:" . $res['errmsg'] ?? (is_array($res) ? join(',', $res) : '未知'));
}
Redis::hset($redis_key, $agent->appid, 1);
}
throw new Exception("上传成功,并已提交审核");
echo "上传成功,并已提交审核";
} else if (isset($audit_err_code[$res['errcode']])) {
throw new Exception($audit_err_code[$res['errcode']]);
throw new Exception($agent->appid . $audit_err_code[$res['errcode']]);
} else {
throw new Exception($res['errmsg'] ?? join(',', $res));
throw new Exception($agent->appid . $res['errmsg'] ?? join(',', $res));
}
} catch (Exception $e) {
throw new Exception($e->getMessage());
throw new Exception($agent->appid . $e->getMessage());
}
}

Loading…
Cancel
Save