1,"iflogin"=>1, "info" => "未登录")); exit ; } //$userid=1; $order_no = isset($_POST['order_no']) ? $_POST['order_no'] : false; $phone_no = isset($_POST['phone_no']) ? $_POST['phone_no'] : false; if( $order_no == false || $phone_no == false ){ echo json_encode(array("code" => '1', "info" => "请输入正确的订单号和联系人手机号")); exit ; } $pdo=conn(); $sql = "SELECT ID,OPENID FROM wechat_user WHERE ID = {$member_id}"; $result=$pdo->query($sql); if( $result ) { $rowset = $result->fetchAll(PDO::FETCH_ASSOC); $user_info = $rowset[0]; $result->closeCursor(); } else { echo json_encode(array("code" => 1,"iflogin"=>1, "info" => "未登录")); exit ; } $sql="CALL DRIVER_WEICHAT_BOND(".$order_no.",".$phone_no.",'".$user_info['OPENID']."')"; $result=$pdo->query($sql); if( $result ) { $rowset = $result->fetchAll(PDO::FETCH_ASSOC); $result->closeCursor(); } else { $rowset = false; } if ( $rowset == false || $rowset[0]['code'] != 0){ $contentStr = "绑定订单失败"; if( $rowset != false && isset($rowset[0]['info']) ) { $contentStr .= ":".$rowset[0]['info']; } echo json_encode(array("code" => '1', "info" => $contentStr )); exit ; } $update_sql = "UPDATE order_main SET MEMBER_ID = (SELECT id FROM wechat_user WHERE OPENID = '{$user_info['OPENID']}' ) WHERE order_id = {$order_no} OR parent_order_id = {$phone_no}"; $pdo_update = conn(); $pdo_update->exec($update_sql); echo json_encode(array("code" => '0', "info" => "绑定订单成功" )); exit ;