'e.WriteString(e.PlainText)
'Return Nothing
Dim jopost As JObject = JObject.Parse(e.PlainText)
Dim gdbh As String = jopost("gdbh")
Dim gcsunionid As String = jopost("gcsunionid")
Dim yonghuunionid As String = jopost("unionid")
Dim yonghuopenid As String = jopost("openid")
Dim jo As New JObject
'工程师判断
Dim yg As DataRow = DataTables("员工资料").SQLFind("员工类型 = '工程师' and uni")
If yg IsNot Nothing Then
If yg("移动办公") <> "允许登录" Then
jo = New JObject
jo("no") = New JObject
jo("no")("title") = "工程师已被禁止使用移动端"
e.WriteString(CompressJson(jo))
Return Nothing
End If
Else
jo = New JObject
jo("no") = New JObject
jo("no")("title") = "工程师已被禁用"
e.WriteString(CompressJson(jo))
Return Nothing
End If
'工单判断
Dim name As String = yg("员工姓名")
Dim gd As DataRow = DataTables("维修工单").SQLFind("工单编号 = '" & gdbh & "'")
If gd IsNot Nothing Then
If gd("处理状态") <> "正在处理" Then
'处理状态错误
jo = New JObject
jo("no") = New JObject
jo("no")("title") = "处理状态不是正在处理"
e.WriteString(CompressJson(jo))
Return Nothing
End If
If gd("工程师") <> name Then
'工程师不对
jo = New JObject
jo("no") = New JObject
jo("no")("title") = "此单不属于这个工程师"
e.WriteString(CompressJson(jo))
Return Nothing
End If
'If gd("unionid") <> "" Then
' '已绑定
' jo = New JObject
' jo("no") = New JObject
' jo("no")("title") = "此单已绑定过了"
' e.WriteString(CompressJson(jo))
' Return Nothing
'End If
Else
'单号不存在
jo = New JObject
jo("no") = New JObject
jo("no")("title") = "工单编号不存在"
e.WriteString(CompressJson(jo))
Return Nothing
End If
'绑定
gd("unionid") = yonghuunionid
gd("xcx_openid") = yonghuopenid
gd.Save()
'返回成功
jo("no") = New JObject '这个要加上返回一个空值便于后面判断
jo("no") = "" '这个空千万不能省略
jo("yes") = New JObject
e.WriteString(CompressJson(jo))