Android 应为字符串,但在第1行第93列处为BEGIN_对象。路径$。详细信息[0]。消息
我有下面这节课Android 应为字符串,但在第1行第93列处为BEGIN_对象。路径$。详细信息[0]。消息,android,json,gson,Android,Json,Gson,我有下面这节课 public class InstallationRequest { @SerializedName("install_id") @Expose private String installId; @SerializedName("ref_no") @Expose private String refNo; @SerializedName("billing_msn") @Expose private String existingSrNo; @SerializedName("
public class InstallationRequest {
@SerializedName("install_id")
@Expose
private String installId;
@SerializedName("ref_no")
@Expose
private String refNo;
@SerializedName("billing_msn")
@Expose
private String existingSrNo;
@SerializedName("meter_msn")
@Expose
private String smartMsn;
@SerializedName("site_issues")
@Expose
private String siteIssue;
@SerializedName("istallation_status")
@Expose
private String installStatus;
@SerializedName("latitude")
@Expose
private String latitude;
@SerializedName("longitude")
@Expose
private String longitude;
@SerializedName("comm_status")
@Expose
private String commStatus;
@SerializedName("so_person_name")
@Expose
private String personName;
@SerializedName("so_phone_number")
@Expose
private String personPhone;
@SerializedName("so_person_designation")
@Expose
private String personPhoneDesig;
@SerializedName("customer_id")
@Expose
private String customerId;
@SerializedName("consumer_name")
@Expose
private String consumerName;
@SerializedName("consumer_address")
@Expose
private String consumerAddress;
@SerializedName("tarrif")
@Expose
private String tarrif;
@SerializedName("s_load")
@Expose
private String sLoad;
@SerializedName("auth_key")
@Expose
private String authKey;
@SerializedName("imsi_no")
@Expose
private String imsiNo;
@SerializedName("ct_ratio")
@Expose
private String ctRatio;
@SerializedName("old_meter_power")
@Expose
private String oldMeterPower;
@SerializedName("old_meter_reactive_power")
@Expose
private String oldMeterReactivePower;
@SerializedName("new_meter_power")
@Expose
private String newMeterPower;
@SerializedName("new_meter_reactive_power")
@Expose
private String newMeterReactivePower;
@SerializedName("created_date")
@Expose
private String createdDate;
@SerializedName("site_images_name")
@Expose
private List<ImageName> siteImagesName = null;
@SerializedName("doc_images_name")
@Expose
private List<ImageName> docImagesName = null;
public String getInstallId() {
return installId;
}
public void setInstallId(String installId) {
this.installId = installId;
}
public String getRefNo() {
return refNo;
}
public void setRefNo(String refNo) {
this.refNo = refNo;
}
public String getExistingSrNo() {
return existingSrNo;
}
public void setExistingSrNo(String existingSrNo) {
this.existingSrNo = existingSrNo;
}
public String getSmartMsn() {
return smartMsn;
}
public void setSmartMsn(String smartMsn) {
this.smartMsn = smartMsn;
}
public String getSiteIssue() {
return siteIssue;
}
public void setSiteIssue(String siteIssue) {
this.siteIssue = siteIssue;
}
public String getInstallStatus() {
return installStatus;
}
public void setInstallStatus(String installStatus) {
this.installStatus = installStatus;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getCommStatus() {
return commStatus;
}
public void setCommStatus(String commStatus) {
this.commStatus = commStatus;
}
public String getPersonName() {
return personName;
}
public void setPersonName(String personName) {
this.personName = personName;
}
public String getPersonPhone() {
return personPhone;
}
public void setPersonPhone(String personPhone) {
this.personPhone = personPhone;
}
public String getPersonPhoneDesig() {
return personPhoneDesig;
}
public void setPersonPhoneDesig(String personPhoneDesig) {
this.personPhoneDesig = personPhoneDesig;
}
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getConsumerName() {
return consumerName;
}
public void setConsumerName(String consumerName) {
this.consumerName = consumerName;
}
public String getConsumerAddress() {
return consumerAddress;
}
public void setConsumerAddress(String consumerAddress) {
this.consumerAddress = consumerAddress;
}
public String getTarrif() {
return tarrif;
}
public void setTarrif(String tarrif) {
this.tarrif = tarrif;
}
public String getSLoad() {
return sLoad;
}
public void setSLoad(String sLoad) {
this.sLoad = sLoad;
}
public String getCreatedDate() {
return createdDate;
}
public void setCreatedDate(String createdDate) {
this.createdDate = createdDate;
}
public List<ImageName> getSiteImagesName() {
return siteImagesName;
}
public void setSiteImagesName(List<ImageName> siteImagesName) {
this.siteImagesName = siteImagesName;
}
public List<ImageName> getDocImagesName() {
return docImagesName;
}
public void setDocImagesName(List<ImageName> docImagesName) {
this.docImagesName = docImagesName;
}
public InstallationRequest(InstallationDetails installationDetails,List<ImageName> siteImagesName,List<ImageName> docImagesName) {
this.refNo = installationDetails.getReferenceNo();
this.smartMsn = installationDetails.getMsn();
this.existingSrNo = installationDetails.getExistingSrNo();
this.latitude = installationDetails.getLatitude();
this.longitude = installationDetails.getLongitude();
this.tarrif = installationDetails.getTarrif();
this.sLoad = installationDetails.getsLoad();
this.personName = installationDetails.getPersonName();
this.personPhone = installationDetails.getPersonPhone();
this.personPhoneDesig = installationDetails.getPersonPhoneDesig();
this.customerId = installationDetails.getCustomerId();
this.installStatus = installationDetails.getInstallStatus();
this.siteIssue = installationDetails.getSiteIssue();
this.installId = installationDetails.getInstallId();
this.createdDate = installationDetails.getCreatedDate();
this.consumerName = installationDetails.getConsumerName();
this.consumerAddress = installationDetails.getConsumerAddress();
this.commStatus= installationDetails.getCommStatus();
this.authKey = installationDetails.getUserAuthKey();
this.imsiNo = installationDetails.getIMSI_NO();
//this.ctRatio = installationDetails.getCT_RATIO();
this.oldMeterPower = installationDetails.getOldMeterPower();
this.oldMeterReactivePower = installationDetails.getOldMeterReactivePower();
this.newMeterPower = installationDetails.getNewMeterPower();
this.newMeterReactivePower = installationDetails.getNewMeterReactivePower();
this.siteImagesName = siteImagesName;
this.docImagesName = docImagesName;
Log.d("zed",createdDate);
}
}
在《邮递员》一书中,我发现了以下错误
{
“名称”:“PHP通知”,
“消息”:“正在尝试获取非对象的属性”,
“代码”:8,
“类型”:“yii\base\ErrorException”,
“文件”:“E:\xampp\htdocs\common\models\Installations.php”,
“行”:116,
“堆栈跟踪”:[
“#0 E:\xampp\htdocs\common\models\Installations.php(116):yii\base\ErrorHandler->handleError(8,'尝试获取p…,'E:\\xampp\\htdocs…',116,数组)”,
“#1 E:\xampp\htdocs\api\modules\v1\controllers\InstallationController.php(29):common\models\Installations::saveAll(对象(stdClass))”,
“#2[内部函数]:api\modules\v1\controllers\InstallationController->actionAddnew()”,
“#3 E:\xampp\htdocs\vendor\yiisoft\yii2\base\InlineAction.php(57):调用_user\u func_array(array,array)”,
“#4 E:\xampp\htdocs\vendor\yiisoft\yii2\base\Controller.php(156):yii\base\InlineAction->runWithParams(数组)”,
“#5 E:\xampp\htdocs\vendor\yiisoft\yii2\base\Module.php(523):yii\base\Controller->runAction('addnew',Array)”,
“#6 E:\xampp\htdocs\vendor\yiisoft\yii2\web\Application.php(102):yii\base\Module->runAction('v1/installation…',Array'),
“#7 E:\xampp\htdocs\vendor\yiisoft\yii2\base\Application.php(380):yii\web\Application->handleRequest(对象(yii\web\Request))”,
“#8 E:\xampp\htdocs\api\web\index.php(35):yii\base\Application->run()”,
“#9{main}”
]
}
在查看myYii2
代码中的第116行时,异常出现在下面一点
if (Installations::find()->where(['ref_no' => $input->ref_no])->exists()) {
$arr_status[] = ['install_id' => $input->install_id, 'status' => 2, 'messages' => "Ref # Already exists"];
continue;
}
我不知道为什么会出现异常,因为它一天前还在工作,我一点也没有修改代码
非常感谢您的帮助。问题在于ImageName对象
@SerializedName("site_images_name")
@Expose
private List<String> siteImagesName = null;
@SerializedName("doc_images_name")
@Expose
private List<String> docImagesName = null;
@SerializedName(“站点图片名称”)
@暴露
私有列表siteImagesName=null;
@SerializedName(“文档图像名称”)
@暴露
私有列表docImagesName=null;
试着这样做。或者在ImageName中进行更改,在其中放入一个字符串成员。您的问题缺少一个ApiResponse
类,该类中存在错误starts@cricket_007我已经提到过,错误开始于public void onFailure(Call Call,Throwable t)
No,No。您已经显示了一个InstallationRequest
类。改装正在抱怨ApiResponse
类。请编辑您的问题以显示它错误提到了一个消息
键,关于imagesmessages键的任何内容我想都没有提到
if (Installations::find()->where(['ref_no' => $input->ref_no])->exists()) {
$arr_status[] = ['install_id' => $input->install_id, 'status' => 2, 'messages' => "Ref # Already exists"];
continue;
}
@SerializedName("site_images_name")
@Expose
private List<String> siteImagesName = null;
@SerializedName("doc_images_name")
@Expose
private List<String> docImagesName = null;