0 and order_prod_type in ($prod_list)"; $groupBy = ' GROUP BY PARENT_ORDER_ID'; $orderBy = ' ORDER BY RUN_DATE, RUN_TIME,MINUTES'; $sql = '' . "select $select from $from where $where $groupBy $orderBy"; $result = $this->fetchAll($sql); $return_result = array(); foreach ($result as $order_info) { $diff_time = (strtotime($order_info["prod_end_station_time"]) - strtotime($order_info["prod_start_station_time"])) / 60; $diff_hour = floor($diff_time / 60); $diff_minuts = $diff_time - $diff_hour * 60; $disp_minutes = $diff_hour . "小时"; if ($diff_minuts > 0) { $disp_minutes .= $diff_minuts . "分"; } $order_info["minutes"] = $disp_minutes; $return_result[] = $order_info; } return $return_result; } /** * Des:绑定订单,用原微信接口逻辑 * Name: bindOrder * @param $para_order_id * @param $para_tel * @param $para_open_id * @param $user_id * @return array * @author 倪宗锋 */ public function bindOrder($para_order_id, $para_tel, $para_open_id, $user_id) { $sql = "CALL DRIVER_WEICHAT_BOND($para_order_id, '$para_tel', '$para_open_id')"; $result = $this->fetchAll($sql); $update_sql = '' . "UPDATE order_main SET MEMBER_ID = {$user_id} WHERE ORDER_ID = {$para_order_id} OR PARENT_ORDER_ID = {$para_order_id}"; $this->execSql($update_sql); return $result; } public function getWeChatOpenId($user_id) { $sql = '' . "select openid from wechat_user where id=$user_id"; $openid = $this->fetchOne($sql); if (empty($openid)) $openid = 0; return $openid; } /** * Des:我要找车 * Name: getCar * @param $order_id * @param $date * @return array * @author 张帅 */ public function getCar($order_id, $date) { $sql = '' . "SELECT b.send_bus_res_id as bus_id, b.send_bus_org_id as bus_org_id, b.send_driver_name as driver_name, b.send_driver_mobile as driver_mobile, (SELECT bus_no from base_bus WHERE bus_id = b.send_bus_res_id) as bus_no, m.res_id, (SELECT res_name from base_resource where res_id = m.res_id) as res_name, (SELECT property from base_resource_property where cancel_flag = 0 and res_id = m.res_id and type_id = 212) as res_x, (SELECT property from base_resource_property where cancel_flag = 0 and res_id = m.res_id and type_id = 213) as res_y, (SELECT property from base_resource_property where cancel_flag = 0 and res_id = m.res_id and type_id = 279 limit 1) as address, a.res_name as bus_name, ifnull((select res_name from base_resource where res_id=c.bus_color),'暂无') as color, if(c.bus_img_path='','http://img.zhizhuchuxing.cn/zzwx/busimg/no_bus_img.png',c.bus_img_path) as img_url FROM run_bus AS b, ( SELECT run_id, run_bus_order_id AS bus_order_id, prod_start_station_res_id as res_id FROM order_main WHERE parent_order_id = $order_id AND prod_start_station_date ='$date' GROUP BY run_id, run_bus_order_id ) AS m,base_resource a,base_bus c WHERE c.bus_id=b.send_bus_res_id and a.id=c.brand_id and b.run_id = m.run_id AND b.bus_order_id = m.bus_order_id"; $result = $this->fetchRow($sql); if ($result) { return Util::returnArrSu('', $result); } else { return Util::returnArrEr('数据库错误'); } } }