load->helper('array'); $this->load->library('trippest'); $this->load->model('BIZ_Orders_model'); $this->load->model('Group_model'); } public function index() { $vendor_plan = $this->Group_model->get_vendor_plan_info(214600, 1343); return $this->output->set_content_type('application/json')->set_output(json_encode($vendor_plan)); } public function push($COLI_ID) { $orderinfo = $this->BIZ_Orders_model->get_orderinfo_detail($COLI_ID); if(empty($orderinfo)) {return;} return $this->output->set_content_type('application/json')->set_output(json_encode($orderinfo)); } /** * 接收地接社的信息上报 * * 信息类型代码: * * * 1000 已接收变更,未确认 * * * 2000 已确认计划/变更 * * * 3001 导游信息变更 * * * 4001 已确认取消 * * * 4002 订单已删除 * @date 2018-11-14 */ public function uploadOperation() { $ret['status'] = -1; $ret['errMsg'] = "未知错误"; $input = $this->input->post(); $vendorID = $input['openId']; $validate = $this->calc_key($vendorID, $input['key']); if ($validate !== TRUE) { $ret['errMsg'] = "身份验证失败."; return $this->output->set_content_type('application/json')->set_output(json_encode($ret)); } $vps = $this->Group_model->get_sync_info_by_vendororder($input['orderId']); if (empty($vps)) { $ret['errMsg'] = "未找到相应的订单."; return $this->output->set_content_type('application/json')->set_output(json_encode($ret)); } $vendor_order_id = $input['orderId']; $action_code = $input['operationTypeCode']; switch ($action_code) { case '1000': # code... break; case '2000': $ret = $this->plan_confirm($input, $vps); break; case '3001': $ret = $this->fill_tourguide($input, $vps); break; case '4001': # code... break; case '4002': # code... break; default: # code... break; } return $this->output->set_content_type('application/json')->set_output(json_encode($ret)); } public function plan_confirm($input, $vps) { $ret['status'] = -1; $ret['errMsg'] = ""; $vendor_manager = $this->Group_model->get_vendorContact($input['openId']); /** VendorArrangeState */ $VAS_ConfirmInfo = $input['operationRemark'] . "\r\n======确认人: " . $input['operator'] . ", 确认时间: " . $input['operateTime']; $VAS_ConfirmInfo .= "\r\n" . $vps->VAS_ConfirmInfo; $update_vas = $this->Group_model->set_plan_confirm($vps->VAS_SN, $vendor_manager->LMI_SN, $VAS_ConfirmInfo); if ($update_vas === TRUE) { $ret['status'] = 1; $ret['errMsg'] = ""; $sync_arr = array( "VPS_externalorderState" => 2 ,"VPS_latestTime" => date('Y-m-d H:i:s') ); /** VendorPlanSync */ $this->Group_model->update_VendorPlanSync($vps->VPS_SN, $sync_arr); // 邮件外联 $sender_name = "中华游供应商合作平台"; $sender_mail = "info@chinahighlights.net"; $from_name = $vendor_manager->LMI2_Name; $from_mail = $vendor_manager->LMI_ListMail; $to_name = $vps->OPI_Name; $to_mail = $vps->OPI_Email; $subject = $vps->GRI_Name . "团已确认: " . $vendor_manager->VEI2_CompanyBN; $mail_body = $vendor_manager->VEI2_CompanyBN . "对团" . $vps->GRI_Name . "的计划在" . $input['operateTime'] . "已确认。
"; $mail_body .= "确认说明:" . $input['operationRemark'] . "
"; $mail_body .= "确认人:$vendor_manager->LMI2_Name $vendor_manager->LMI_ListMail 固定电话: $vendor_manager->LMI_Telephone 移动电话:$vendor_manager->LMI_Mobile
"; $mail_body .= "变更内容: " . $vps->VAS_ChangeText . "
"; $this->Group_model->save_automail($sender_name, $sender_mail, $from_name, $from_mail, $to_name, $to_mail, $subject, $mail_body, $sender_name); } else { log_message('error','图兰朵确认上报更新状态失败. POST RAW: ' . raw_json_encode($input) ); } return $ret; } public function fill_tourguide($input, $vps) { $ret['status'] = -1; $ret['errMsg'] = ""; $eva = $this->Group_model->get_plan_eva($vps->VAS_SN); if (empty($eva)) { $ret['errMsg'] = "未找到相应的订单."; return $this->output->set_content_type('application/json')->set_output(json_encode($ret)); } if (intval($eva[0]->need_tourguide)===0) { // 不需要设置导游 $ret['status'] = 1; $ret['errMsg'] = ""; return $ret; } // 需要填写导游, 则根据不同的供应商调用相应的方法 if (in_array($input['openId'], $this->trippest->tulanduo_vei_sn)) { require_once('Tulanduo.php'); $tulanduo_fun = new Tulanduo(); return $tulanduo_fun->tourguide_update($input, $vps, $eva); } return $ret; } public function calc_key($userId, $key) { $default = "b825e39422a54875a95752fc7ed6f5d2"; $ret = md5(hash("sha256", $userId.$default)); return $ret===$key; } } /* End of file index.php */ /* Location: ./third_party/vendorPlanSync/controllers/index.php */