|
- <?php
- /**
- *
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 张帅
- * PhpStorm SubmitGroupOrder.php
- * Create By 2017/4/14 15:31 $
- */
-
- namespace backend\modules\api\logic;
-
- use backend\modules\api\logic\SubmitBusAgentOrder;
- use backend\modules\api\models\BaseUniqueId2;
- use backend\modules\api\models\BaseUser;
- use yii\db\Exception;
- use yii\db\Query;
- use Yii;
- use backend\modules\api\models\OrderMain;
- use common\models\Msg;
- use backend\modules\api\models\BaseUniqueLog;
-
- class SubmitGroupOrder extends Query
- {
- public $order_title_base = [
- 'main_corp_id' => 0,//运营主体
- 'create_date' => '',
- 'create_user_id' => 0,
- 'create_time' => '',//下单时刻
- 'update_user_id' => 0,//最后更新人
- 'update_time' => '',//最后更新时刻
- 'confirm_time' => '',
- 'outside_sale_org_id' => 0,//渠道
- 'outside_order_no' => '',//渠道订单号
- 'order_title_prod_name' => '',//产品名(自动生成)
- 'order_title_prod_description' => '',//产品明细
- 'start_date' => '',//出发日期
- 'start_time' => '',//出发时刻
- 'cus_name' => '',//联系人
- 'cus_phone' => '',//联系手机
- 'cus_id_no' => '',//联系人身份证
- 'cus_remark' => '',//备注
- 'cus_id_type' => '',//联系人证件类型150身份证 153护照
- 'cus_num' => 0,//总人数
- 'order_title_all_price' => 0,//总收入
- 'order_title_per_price' => 0,//单人收入
- 'order_prod_type' => 0,//组合订单种类:[100]单车票[010]单酒店[001]单门票[110]车+酒[101]车+门[011]酒+门[111]车+酒+门
- 'order_pay_type' => '',//组合订单支付方式
- 'order_title_status' => 2,//组合订单整体状态, 1:待确认 2: 已确认 3:已完成 4: 已取消。
- 'cancel_flag' => 0,
- 'bus_order' => '',//对应子巴士产品订单号,多个用逗号隔开
- 'ticket_order' => '',//对应门票子产品订单号,多个用逗号隔开
- 'hotel_order' => '',//对应酒店子产品订单号,多个用逗号隔开
- 'order_title_type' => 1,//组合订单种类:1自由选择(CS) 2跟团游(微信商城)。。。
- 'tourist_id' => 0,//组合产品id,为0是自由组合的组合订单
- 'is_buy_insurance' => 0,//是否购买保险
- ];//组合订单数据配置
-
- public $order_group_connect_base = [
- 'order_title_id' => 0,
- 'order_main_id' => 0,
- 'order_type' => 0,
- 'cancel_flag' => 0,
- 'create_time' => '',
- 'update_time' => '',
- 'create_user_id' => 0,
- 'create_date' => '',
- ];//组合订单关联配置
-
- public $product_result = [];//产品数据
-
- public $order_main_base = [
- 'ID' => 1,
- 'CANCEL_FLAG' => 0,
- 'MAIN_CREATE_USER_ID' => 1,
- 'CREATE_USER_ID' => 1,
- 'CREATE_TIME' => '',
- 'UPDATE_USER_ID' => 1,
- 'UPDATE_TIME' => '',
- 'SALE_ORG_ID' => 0,
- 'SALE_TOP_ORG_ID' => 0,
- 'PROD_TOP_ORG_ID' => 0,
- 'ORDER_ID' => 0,
- 'ORDER_DESCRIPTION' => '',
- 'OUTSIDE_ORDER_NO' => '',
- 'ORDER_VALID_STATUS' => 1,
- 'ORDER_BOOK_STATUS' => 0,
- 'ORDER_PAY_STATUS' => 0,
- 'ORDER_PAY_MAIN_ID' => 0,
- 'ORDER_PAY_USER_ID' => 1,
- 'ORDER_PAY_TIME' => '',
- 'ORDER_PRINT_TIMES' => 0,
- 'PARENT_ORDER_ID' => 0,
- 'PROD_ID' => 0,
- 'PARENT_PROD_ID' => 0,
- 'PROD_NAME' => '',
- 'PARENT_PROD_NAME' => '',
- 'ORDER_PRICE' => 0,
- 'ORDER_PROD_TYPE' => 0,
- 'PROD_SUPPLY_ORG_NAME' => '',
- 'BASE_PRICE' => 0,
- 'MID_PRICE' => 0,
- 'RUN_ID' => 0,
- 'RUN_DATE' => '',
- 'RUN_DATE_NUM' => 0,
- 'RUN_TIME' => '',
- 'RUN_TIME_MINUTES' => 0,
- 'RUN_BUS_ORDER_ID' => 0,
- 'RUN_BUS_SEAT_TYPE' => 0,
- 'RUN_BUS_SEAT_SEQ_ID' => 0,
- 'RUN_BUS_SEAT_ID' => 0,
- 'RUN_BUS_SEAT_NAME' => '',
- 'PROD_START_STATION_RES_ID' => 0,
- 'PROD_START_STATION_RES_NAME' => '',
- 'PROD_START_STATION_CHECKPORT_RES_ID' => 0,
- 'PROD_START_STATION_CHECKPORT_RES_NAME' => '',
- 'PROD_START_STATION_SEQ_ID' => 0,
- 'PROD_START_STATION_DATE' => '',
- 'PROD_START_STATION_DATE_NUM' => 0,
- 'PROD_START_STATION_TIME' => '',
- 'PROD_START_STATION_TIME_MINUTES' => 0,
- 'PROD_START_STATION_AREA_ID' => 0,
- 'PROD_START_STATION_AREA_NAME' => '',
- 'PROD_END_STATION_RES_ID' => 0,
- 'PROD_END_STATION_RES_NAME' => '',
- 'PROD_END_STATION_SEQ_ID' => 0,
- 'PROD_END_STATION_DATE' => '',
- 'PROD_END_STATION_DATE_NUM' => 0,
- 'PROD_END_STATION_TIME' => '',
- 'PROD_END_STATION_TIME_MINUTES' => 0,
- 'PROD_END_STATION_AREA_ID' => 0,
- 'PROD_END_STATION_AREA_NAME' => '',
- 'CUSTOMER_NAME' => '',
- 'CUSTOMER_SEX' => 1,
- 'CUSTOMER_MOBILE' => '',
- 'CUSTOMER_ID_TYPE' => 0,
- 'CUSTOMER_ID_NO' => '',
- 'CUSTOMER_ADDRESS' => '',
- 'CUSTOMER_ADDRESS_AREA_ID' => 0,
- 'CUSTOMER_POSTCODE' => '',
- 'CUSTOMER_MEMO' => '',
- 'MEMBER_ID' => 0,
- 'MEMBER_SCORE_PAY' => 0,
- 'MEMBER_SCORE_GET' => 0,
- 'ORDER_STATUS' => 0,
- 'ORDER_DISABLE_TYPE' => 0,
- 'ORDER_DISABLE_USER_ID' => 0,
- 'ORDER_DISABLE_TIME' => '',
- 'ORDER_DISABLE_PERCENT' => 0,
- 'ORDER_DISABLE_FEE' => 0,
- 'ORDER_DISABLE_APPLY_USER_ID' => 0,
- 'ORDER_DISABLE_APPLY_TIME' => '',
- 'KEEP_END_TIME' => '',
- 'KEEP_END_MINUTES' => 0,
- 'if_gift' => 0,
- 'reorder_times' => 0,
- 'IF_LAST_PROD' => 1,
- 'ORDER_LEVEL' => 0,
- 'ORDER_CONFIRM_CODE' => '',
- 'OUTSIDE_SALE_ORG_ID' => 0,
- 'IS_UP' => 1,
- 'APPLY_ID' => 0,
- 'SALES_MAN' => '',
- 'PRINCIPAL_ID' => 0,
- 'RECEIVE_VALUE' => 0,
- 'REAL_PASSENGER_NUM' => -1,
- 'STOCK_TYPE' => 0,
- 'REFUSE_FLAG' => 0,
- 'PROFIT_VALUE' => 0,
- 'TOTAL_COMMISSION' => 0,
- 'ORDER_TITLE_ID' => 0,
- 'SUB_CHANNEL_ID' => 0,// int(11) NOT NULL DEFAULT '0' COMMENT '下级渠道id(用于代售)',
- 'SUB_CHANNEL_NO' => '',// varchar(100) NOT NULL DEFAULT '' COMMENT '下级渠道订单号',
- 'MAIN_CORP_ID' => 1,// int(11) NOT NULL DEFAULT '0' COMMENT '订单所属运营主体',
- 'SALE_PATH' => '',// varchar(50) NOT NULL DEFAULT '' COMMENT '销售路径(代售)eg:1001,1002,1003',
- 'AGENT_LEVEL' => 1,// int(3) NOT NULL DEFAULT '1' COMMENT '销售层级:终端1,上一级2,再上一级3',
- 'SOURCE_MAIN_CORP_ID' => 1,// int(11) NOT NULL DEFAULT '0' COMMENT '线路所属运营主体',
- ];//订单基础配置
-
- public $pay_main_base = [
- 'ID' => 0,
- 'CREATE_USER_ID' => 1,
- 'CREATE_TIME' => '',
- 'UPDATE_USER_ID' => 1,
- 'UPDATE_TIME' => '',
- 'PAY_TOTAL' => 0,
- 'ORDER_ID' => 0,
- ];//主支付记录基础配置
-
- public $pay_detail_base = [
- 'ID' => 0,
- 'CREATE_USER_ID' => 1,
- 'CREATE_TIME' => '',
- 'UPDATE_USER_ID' => 1,
- 'UPDATE_TIME' => '',
- 'PAY_MAIN_ID' => 0,
- 'PAY_TYPE_ID_1' => 0,
- 'PAY_MONEY' => 0,
- ];//支付明细
-
- public $user_id;//用户id
-
- public $create_time;//创建时间
-
- public $unique_id = 1000000;//唯一键值
-
- public $channel_id;//渠道号
-
- public $order_id_arr = [];//订单id数组
-
- public $order_main_arr = [];//订单数组
-
- public $pay_main_arr = [];//主支付记录数组
-
- public $pay_detail_arr = [];//支付明细记录
-
- public $stock_order_arr = [];//库存相关修改数组
-
- public $check_submit_date;
-
- public $get_bus_order_data;
-
- public $get_hotel_order_data;
-
- public $get_ticket_order_data;
-
- public $submit_group_data;
-
- public $final_unique_id;//最终id
-
-
- /**
- * Function Description:获取服务
- * Function Name: getService
- * @param $type
- *
- * @return CheckSubmitData|GetBusOrderData|GetHotelOrderData|GetTicketOrderData|SubmitGroupData|bool
- *
- * @author 张帅
- */
- public function getService($type)
- {
- switch ($type) {
- case 'check':
- if ($this->check_submit_date == '') {
- $this->check_submit_date = new CheckSubmitData();
- }
- return $this->check_submit_date;
- case 'bus':
- if ($this->get_bus_order_data == '') {
- $this->get_bus_order_data = new GetBusOrderData();
- }
- return $this->get_bus_order_data;
- case 'hotel':
- if ($this->get_hotel_order_data == '') {
- $this->get_hotel_order_data = new GetHotelOrderData();
- }
- return $this->get_hotel_order_data;
- case 'ticket':
- if ($this->get_ticket_order_data == '') {
- $this->get_ticket_order_data = new GetTicketOrderData();
- }
- return $this->get_ticket_order_data;
- case 'submit':
- if ($this->submit_group_data == '') {
- $this->submit_group_data = new SubmitGroupData();
- $this->submit_group_data->getBaseData($this->order_title_base, $this->order_group_connect_base, $this->order_main_base, $this->order_main_arr, $this->pay_main_base, $this->pay_main_arr, $this->pay_detail_base, $this->pay_detail_arr, $this->order_id_arr, $this->stock_order_arr, $this->product_result);
- }
- return $this->submit_group_data;
- default:
- return false;
- }
- }
-
- /**
- * Function Description:检验提交数据格式
- * Function Name: checkSubmitData
- * @param string $product_name 产品名称
- * @param string $bus_product 巴士产品
- * @param string $hotel_product 酒店产品
- * @param string $ticket_product 门票产品
- * @param string $customer_info 顾客信息
- * @param string $order_info 订单基础信息
- * @param float $group_order_price 组合产品总价格
- * @param string $tourist_mark 订单基础信息 标志该组合下单是否是自由行产品下单:0表示否,如是则传组合产品的ID值 tourist_id
- * @param float $tourist_org_id 组合产品总价格 自由行产品销售渠道id,区别于order_info里的outside_sale_org_id[运营主体所对应]内部采购渠道id
- * @param string $tourist_extra_info 自由行产品下单其他参数(成人,儿童数)
- * @param array $passenger_info 乘车人详细 [{姓名,身份证},{姓名,身份证},{姓名,身份证}] array数组json_encode
- * @return mixed
- *
- * @author 张帅
- */
- public function checkSubmitData($product_name, $bus_product, $hotel_product, $ticket_product, $customer_info, $order_info, $group_order_price, $tourist_mark, $tourist_org_id, $tourist_extra_info, $passenger_info=[])
- {
- $check_submit_date = $this->getService('check');
- $result['passenger_info'] = $passenger_info;//出行人信息列表
- $result['tourist_mark'] = $tourist_mark;
- $result['tourist_org_id'] = $tourist_org_id;
- $result['tourist_extra_info'] = json_decode($tourist_extra_info, true);
- #region 检验产品名称
- if (empty($product_name)) {
- $json['code'] = '1';
- $json['info'] = '产品名称有误';
- return $json;
- }
- $result['product_name'] = $product_name;//产品名称有误
- #endregion
-
- #region 检验巴士数据
- $result['bus_product'] = $check_submit_date->checkBusProductData($bus_product);
- if ($result['bus_product'] === false) {
- $json['code'] = '1';
- $json['info'] = '巴士产品有误';
- return $json;
- }
- #endregion
-
- #region 检验酒店数据
- $result['hotel_product'] = $check_submit_date->checkHotelProductData($hotel_product);
- if ($result['hotel_product'] === false) {
- $json['code'] = '1';
- $json['info'] = '酒店产品有误';
- return $json;
- }
- #endregion
-
- #region 检验门票数据
- $result['ticket_product'] = $check_submit_date->checkTicketProductData($ticket_product);
- if ($result['ticket_product'] === false) {
- $json['code'] = '1';
- $json['info'] = '门票产品有误';
- return $json;
- }
- #endregion
-
- #region 检验顾客数据
- $result['customer_info'] = $check_submit_date->checkCustomerInfoData($customer_info);
- if ($result['customer_info'] === false) {
- $json['code'] = '1';
- $json['info'] = '顾客数据有误';
- return $json;
- }
- #endregion
-
- #region 检验订单基本信息 和 组合产品总价
- $result['order_info'] = $check_submit_date->checkOrderInfoData($order_info, $group_order_price);
- if ($result['order_info'] === false) {
- $json['code'] = '1';
- $json['info'] = '必须数据有误';
- return $json;
- }
- #endregion
-
- //组合产品总价
- $result['group_order_price'] = $group_order_price;
-
- $this->product_result = $result;
-
- $json['code'] = '0';
- $json['info'] = '成功';
- return $json;
- }
-
- /**
- * Function Description:获取巴士订单数据
- * Function Name: getBusOrderData
- *
- * @return array|bool|mixed|\yii\db\ActiveRecord[]
- *
- * @author 张帅
- */
- public function getBusOrderData()
- {
- #region 获取巴士选购产品
- $bus_product = $this->product_result['bus_product'];
- #endregion
-
- #region 判断是否有巴士产品
- if (count($bus_product) == 0) {
- $json['code'] = '0';
- $json['info'] = '成功';
- return $json;
- }
- #endregion
-
- $get_bus_order_data = $this->getService('bus');
-
- #region 获取要选购的巴士产品详情
- $bus_product_info = $get_bus_order_data->getBusProductListData($bus_product);
- if (isset($bus_product_info['code']) && $bus_product_info['code'] == '1') {
- return $bus_product_info;
- }
- #endregion
-
- #region 检验班次是否存在并粗略检查库存
- $check_result = $get_bus_order_data->checkRunX();
- if (isset($check_result['code']) && $check_result['code'] == '1') {
- return $check_result;
- }
- #endregion
-
- #region 获取巴士产品座位并检查库存
- $bus_product_info = $get_bus_order_data->getRunBusSeat();
- if (isset($bus_product_info['code']) && $bus_product_info['code'] == '1') {
- return $bus_product_info;
- }
- #endregion
-
- $this->product_result['bus_product'] = $bus_product_info;
-
- $json['code'] = '0';
- $json['info'] = '成功';
- return $json;
- }
-
- /**
- * Function Description:获取酒店佣金相关参数
- * Function Name: getHotelCommission
- * @param string $hotel_product 酒店产品信息(json格式)eg:{"hotel_id":"81","base_room_type":"100074","room_type":"5","hotel_memo":"舟山酒店备注","run_room":[{"run_date":"2017-06-14","prod_num":"2","prod_price":766.5},{"run_date":"2017-06-15","prod_num":"2","prod_price":766.5}]}
- * @param int $channel_id 酒店渠道id
- * @return string
- *
- * @author 温依莅
- */
- public function getHotelCommission($hotel_product, $channel_id)
- {
- $hotel_arr = json_decode($hotel_product, true);
- if (!$hotel_arr) {
- return $hotel_product;
- }
- $res = (new Query())->select('commision_flag,commision_type,back_commision_type,back_commision_method,back_percent,back_value')
- ->from('base_supplier_sale')
- ->where([
- 'parent_type' => 25,
- 'supplier_id' => $channel_id,
- 'cancel_flag' => 0
- ])->one();
- //循环处理酒店产品信息
- foreach ($hotel_arr as $k => $v) {
- foreach ($v['run_room'] as $ik => $iv) {
- $hotel_arr[$k]['run_room'][$ik]['back_value'] = $res['back_value'];
- $hotel_arr[$k]['run_room'][$ik]['back_percent'] = $res['back_percent'];
- $hotel_arr[$k]['run_room'][$ik]['back_commision_method'] = $res['back_commision_method'];
- }
- }
- //重新赋值类属性中的hotel_product属性
- $this->product_result['hotel_product'] = $hotel_arr;
- return json_encode($hotel_arr);
- }
-
- /**
- * Function Description:获取酒店订单数据
- * Function Name: getTicketOrderData
- *
- * @return mixed
- *
- * @author 张帅
- */
- public function getHotelOrderData()
- {
- #region 获取酒店选购产品
- $hotel_product = $this->product_result['hotel_product'];
- #endregion
-
- #region 判断是否有酒店产品
- if (count($hotel_product) == 0) {
- $json['code'] = '0';
- $json['info'] = '成功';
- return $json;
- }
- #endregion
-
- $get_hotel_order_data = $this->getService('hotel');
-
- #region 获取酒店产品的基础房型
- $hotel_product_info = $get_hotel_order_data->getBaseRoomInfo($hotel_product);
- if (isset($hotel_product_info['code']) && $hotel_product_info['code'] == '1') {
- return $hotel_product_info;
- }
- #endregion
-
- #region 获取渠道的基础库存
- $hotel_base_stock = $get_hotel_order_data->getRoomBaseStock($this->channel_id);
- if (isset($hotel_base_stock['code']) && $hotel_base_stock['code'] == '1') {
- return $hotel_base_stock;
- }
- #endregion
-
- #region 获取渠道的详情库存
- $hotel_info_stock = $get_hotel_order_data->getRoomInfoStock();
- if (isset($hotel_info_stock['code']) && $hotel_info_stock['code'] == '1') {
- return $hotel_info_stock;
- }
- #endregion
-
- #region 判断库存是否充足
- $hotel_product_info = $get_hotel_order_data->checkHotelProductStock();
- if (isset($hotel_product_info['code']) && $hotel_product_info['code'] == '1') {
- return $hotel_product_info;
- }
- #endregion
-
- $this->product_result['hotel_product'] = $hotel_product_info;
-
- $json['code'] = '0';
- $json['info'] = '成功';
- return $json;
- }
-
- /**
- * Function Description:获取门票订单数据
- * Function Name: getTicketOrderData
- *
- * @return mixed
- *
- * @author 张帅
- */
- public function getTicketOrderData()
- {
- #region 获取门票选购产品
- $ticket_product = $this->product_result['ticket_product'];
- #endregion
-
- #region 判断是否有门票产品
- if (count($ticket_product) == 0) {
- $json['code'] = '0';
- $json['info'] = '成功';
- return $json;
- }
- #endregion
-
- $get_bus_order_data = $this->getService('ticket');
-
- #region 获取主订单数据详情
- $ticket_product_info = $get_bus_order_data->getTicketMainProductList($ticket_product);
- if (isset($ticket_product_info['code']) && $ticket_product_info['code'] == '1') {
- return $ticket_product_info;
- }
- #endregion
-
- #region 获取子订单产品详情
- $ticket_product_info = $get_bus_order_data->getTicketSonProductList();
- if (isset($ticket_product_info['code']) && $ticket_product_info['code'] == '1') {
- return $ticket_product_info;
- }
- #endregion
-
- $this->product_result['ticket_product'] = $ticket_product_info;
-
- $json['code'] = '0';
- $json['info'] = '成功';
- return $json;
- }
-
- /**
- * Function Description:生成订单各配置数据
- * Function Name: getOrderMainBase
- *
- *
- * @author 张帅
- */
- public function getOrderMainBase()
- {
- $customer_info = $this->product_result['customer_info'];//顾客信息
- $order_info = $this->product_result['order_info'];//订单信息
- $product_name = $this->product_result['product_name'];//产品名称
-
- $tourist_mark = $this->product_result['tourist_mark'];//自由行产品id,如果没有,为0
- $tourist_org_id = $this->product_result['tourist_org_id'];//自由行产品对应的渠道id
- $tourist_extra_info = $this->product_result['tourist_extra_info'];//自由行其他信息(成人儿童数)
- #region 补充订单基础配置
- $this->order_main_base['MAIN_CREATE_USER_ID'] = $order_info['user_id'];
- $this->order_main_base['CREATE_USER_ID'] = $order_info['user_id'];
- $this->order_main_base['UPDATE_USER_ID'] = $order_info['user_id'];
- $this->order_main_base['CREATE_TIME'] = date('Y-m-d H:i:s');
- $this->order_main_base['UPDATE_TIME'] = date('Y-m-d H:i:s');
- $this->order_main_base['OUTSIDE_ORDER_NO'] = $order_info['outside_sale_order_no'];
- $this->order_main_base['ORDER_BOOK_STATUS'] = $order_info['order_book_status'];
- $this->order_main_base['ORDER_PAY_STATUS'] = $order_info['order_pay_status'];
- $this->order_main_base['ORDER_PAY_USER_ID'] = $order_info['user_id'];
- $this->order_main_base['ORDER_PAY_TIME'] = date('Y-m-d H:i:s');
- $this->order_main_base['CUSTOMER_NAME'] = $customer_info['customer_name'];
- $this->order_main_base['CUSTOMER_MOBILE'] = $customer_info['customer_mobile'];
- $this->order_main_base['CUSTOMER_ID_TYPE'] = $customer_info['customer_id_type'];
- $this->order_main_base['CUSTOMER_ID_NO'] = $customer_info['customer_id_no'];
- $this->order_main_base['CUSTOMER_MEMO'] = $customer_info['customer_memo'];
- $this->order_main_base['MEMBER_ID'] = $order_info['member_id'];
- $this->order_main_base['ORDER_STATUS'] = $order_info['order_status'];
- $this->order_main_base['OUTSIDE_SALE_ORG_ID'] = $order_info['outside_sale_org_id'];
- $this->order_main_base['SALES_MAN'] = $order_info['sales_man'];
- #endregion
-
- $this->user_id = $order_info['user_id'];//用户id
- $this->create_time = date('Y-m-d H:i:s');
- $this->channel_id = $order_info['outside_sale_org_id'];//渠道id
-
- #region 补充主支付方式基础配置
- $this->pay_main_base['CREATE_USER_ID'] = $order_info['user_id'];
- $this->pay_main_base['UPDATE_USER_ID'] = $order_info['user_id'];
- $this->pay_main_base['CREATE_TIME'] = date('Y-m-d H:i:s');
- $this->pay_main_base['UPDATE_TIME'] = date('Y-m-d H:i:s');
- #endregion
-
- #region 补充支付明细基础配置
- $this->pay_detail_base['CREATE_USER_ID'] = $order_info['user_id'];
- $this->pay_detail_base['UPDATE_USER_ID'] = $order_info['user_id'];
- $this->pay_detail_base['CREATE_TIME'] = date('Y-m-d H:i:s');
- $this->pay_detail_base['UPDATE_TIME'] = date('Y-m-d H:i:s');
- $this->pay_detail_base['PAY_TYPE_ID_1'] = $order_info['pay_type'];
- #endregion
-
- #region 补充order_title基础配置
- $main_corp_id = BaseUser::find()->select('main_corp_id')->where('id = ' . $order_info['user_id'])->asArray()->one();
- $this->order_title_base['main_corp_id'] = $main_corp_id['main_corp_id'];//运营主体
- $this->order_title_base['create_date'] = date('Y-m-d');
- $this->order_title_base['create_user_id'] = $order_info['user_id'];
- $this->order_title_base['create_time'] = date('Y-m-d H:i:s');
- $this->order_title_base['update_user_id'] = $order_info['user_id'];
- $this->order_title_base['update_time'] = date('Y-m-d H:i:s');//最后更新人
- $this->order_title_base['outside_sale_org_id'] = $tourist_mark ? $tourist_org_id : $order_info['outside_sale_org_id'];//渠道【如果是组合产品下单,则取tourist_org_id,否则取order_info的outside_sale_org_id】
- $this->order_title_base['outside_order_no'] = (string)$order_info['outside_sale_order_no'];//渠道订单号
- $this->order_title_base['order_title_prod_name'] = $product_name;//产品名称
- $this->order_title_base['order_title_prod_description'] = $product_name;//产品明细
-
- $this->order_title_base['cus_name'] = $customer_info['customer_name'];//联系人
- $this->order_title_base['cus_phone'] = $customer_info['customer_mobile'];//联系手机
- $this->order_title_base['cus_id_no'] = $customer_info['customer_id_no'];//联系人身份证
- $this->order_title_base['cus_remark'] = $customer_info['customer_memo'];
- $this->order_title_base['cus_id_type'] = $customer_info['customer_id_type'];
- $this->order_title_base['order_pay_type'] = $order_info['pay_type'];//组合订单支付方式
-
- $this->order_title_base['order_title_type'] = $tourist_mark ? 2 : 1;//组合订单种类:1自由选择(CS) 2自由行产品(微信商城)
- $this->order_title_base['tourist_id'] = $tourist_mark;//自由行产品id
- $this->order_title_base['adult_num'] = $tourist_extra_info['adult_num'];//自由行产品 成人人数
- $this->order_title_base['child_num'] = $tourist_extra_info['child_num'];//自由行产品 儿童人数
-
-
- #endregion
-
- #region 补充order_group_connect基础配置
- $this->order_group_connect_base['create_time'] = date('Y-m-d H:i:s');
- $this->order_group_connect_base['update_time'] = date('Y-m-d H:i:s');
- $this->order_group_connect_base['create_user_id'] = $order_info['user_id'];
- $this->order_group_connect_base['create_date'] = date('Y-m-d');
- #endregion
- }
-
- /**
- * Function Description:获取唯一键值并补充主订单配置
- * Function Name: getUniqueId
- *
- *
- * @author 张帅
- */
- public function getUniqueId()
- {
- $agent_obj = new SubmitBusAgentOrder();
- #region 获取产品详情
- $product_result = $this->product_result;
- $order_info = $product_result['order_info'];
- #endregion
-
- //1,----------------------- 对巴士产品做进一步处理,添加代售相关信息,为进一步计算order_id做准备 -----------------------------
- $bus_prod_list = $product_result['bus_product'];
- if ($bus_prod_list) {
- foreach ($product_result['bus_product'] as $k => $v) {
- $res = $agent_obj->getTicketAgentInfo($v['ticket_id'], $order_info['outside_sale_org_id'], $order_info['user_id']);
- if ($res['code'] != '0') {
- $result['code'] = 1;
- $result['info'] = $res['info'];
- return $result;
- }
- $list = $res['list'];
- #prod_list_final里ticket对应的值存 销售层级1的数据
- $bus_prod_list[$k]['is_agent'] = $list['is_agent'];//是否是代理票种
- $bus_prod_list[$k]['agent_depth'] = $list['agent_depth'];//销售层数
- $bus_prod_list[$k]['prod_top_org_id'] = $list['ticket_agent_list'][1]['prod_top_org_id'];//供应商id
- $bus_prod_list[$k]['prod_supply_org_name'] = $list['ticket_agent_list'][1]['prod_supply_org_name'];//供应商姓名
- $bus_prod_list[$k]['outside_sale_org_id'] = $order_info['outside_sale_org_id'];//渠道商id
- $bus_prod_list[$k]['outside_order_no'] = $order_info['outside_sale_order_no'];//渠道订单号
- $bus_prod_list[$k]['sub_channel_id'] = $order_info['outside_sale_org_id'];//下级渠道id
- $bus_prod_list[$k]['sub_channel_no'] = $order_info['outside_sale_order_no'];//下级渠道订单号
- $bus_prod_list[$k]['main_corp_id'] = $list['ticket_agent_list'][1]['main_corp_id'];//订单所属运营主体
- $bus_prod_list[$k]['source_main_corp_id'] = $list['ticket_agent_list'][1]['source_main_corp_id'];//线路所属运营主体
- $bus_prod_list[$k]['sale_path'] = $list['ticket_agent_list'][1]['sale_path'];//销售路径(代售才有,自营为空)
- $bus_prod_list[$k]['agent_level'] = $list['ticket_agent_list'][1]['agent_level'];//售卖层级:终端1,上一级2,再上一级3
- $bus_prod_list[$k]['base_price'] = $list['ticket_agent_list'][1]['base_price'];//子订单成本
- $bus_prod_list[$k]['total_base_price'] = $bus_prod_list[$k]['base_price'] * $bus_prod_list[$k]['prod_num'];//主订单成本
- #根据销售层级得到代收数组
- $bus_prod_list[$k]['agent_list'] = $list['ticket_agent_list'];
- }
- }
- //2,---------------- 生成订单号:其中主订单id直接嵌入数组相关字段,子订单给出起始id,完成base_unique_id2表的更新 --------------------
- #2.1,计算BaseUniqueId 需要增加的值(主订单和子订单的id个数),更新唯一键值
- #region order_title基础配置所需数据
- $addCnt = 0;
- $unique_id_add = 0;
- $total_price = 0;//总价
- $total_num = 0;//总人数
- $order_prod_type = '';//组合订单种类
- $start_date = [];//出发日期
- $start_time = [];//出发时刻
- $order_title_status = 2;//组合订单状态
- $confirm_time = '';//确认时间
- #endregion
-
- #region 遍历巴士订单
- /*if (count($product_result['bus_product']) > 0) {
- $order_prod_type .= '1';//组合订单种类
- foreach ($product_result['bus_product'] as $key => $vel) {
- $final_unique_id = $final_unique_id + 2 + $vel['prod_num'];//最终唯一id
- $total_price += $vel['price'] * $vel['prod_num'];//总价
- $total_num += $vel['prod_num'];//总人数
- $start_date[] = $vel['run_date'];//出发日期
- $start_time[] = $vel['start_time'];//出发时刻
- }
- } else {
- $order_prod_type .= '0';//组合订单种类
- }*/
- if (count($bus_prod_list) > 0) {
- $order_prod_type .= '1';//组合订单种类
- foreach ($bus_prod_list as $key => $vel) {
- $addCnt += ($vel['prod_num'] + 1) * $vel['agent_depth'];
- $unique_id_add += $vel['agent_depth'];//此处修改接下来的订单分配id起始值,刨除了巴士代售的主订单号
- $total_price += $vel['price'] * $vel['prod_num'];//总价
- $total_num += $vel['prod_num'];//总人数
- $start_date[] = $vel['run_date'];//出发日期
- $start_time[] = $vel['start_time'];//出发时刻
- }
- } else {
- $order_prod_type .= '0';//组合订单种类
- }
- #endregion
-
- #region 遍历酒店订单
- if (count($product_result['hotel_product']) > 0) {
- $order_prod_type .= '1';//组合订单种类
- foreach ($product_result['hotel_product'] as $hotel_key => $hotel_vel) {
- $addCnt += 2;
- foreach ($hotel_vel['run_room'] as $room_key => $room_vel) {
- $total_price += $room_vel['total_price'];//总价
- $total_num += $room_vel['prod_num'];//总人数
- $addCnt += $room_vel['prod_num'];
- $start_date[] = $room_vel['run_date'];//出发日期
- }
- }
- $order_title_status = 1;
- } else {
- $confirm_time = date('Y-m-d H:i:s');
- $order_prod_type .= '0';//组合订单种类
- }
- #endregion
-
- #region 遍历门票订单
- if (count($product_result['ticket_product']) > 0) {
- $order_prod_type .= '1';//组合订单种类
- foreach ($product_result['ticket_product'] as $main_key => $main_vel) {
- $addCnt += 2;
- foreach ($main_vel['son_ticket'] as $son_key => $son_vel) {
- $total_price += $son_vel['price'] * $son_vel['prod_num'];//总价
- $total_num += $son_vel['prod_num'];//总人数
- $addCnt += $son_vel['prod_num'];
- $start_date[] = $main_vel['run_date'];//出发日期
- }
- }
- } else {
- $order_prod_type .= '0';//组合订单种类
- }
- #endregion
- // $do = false;
- // do{
- #region 获取唯一主键
- // $unique_id = BaseUniqueId2::find()->select('unique_id')->where('id = 1')->asArray()->one();
- // $base_main_id = $unique_id['unique_id'] + 0;
- // $this->unique_id = $unique_id['unique_id'] + 1 + $unique_id_add;
- // $final_unique_id = $unique_id['unique_id'] + 1 + $addCnt;//最终唯一id
- #endregion
- #region 更新唯一键值
- // $unique_id = BaseUniqueId2::findOne(['id' => 1]);
- // $unique_id->UNIQUE_ID = $final_unique_id;
- // $json = array();
- $time=time().rand(0,999999);
- $sql="update base_unique_id2 set unique_id=(unique_id + 1 + $addCnt),update_time='$time' where id =1";
- if (!Yii::$app->getDb()->createCommand($sql)->execute()) {
- $json['code'] = '1';
- $json['info'] = 'unique_id更新错误' . serialize($sql);
- return $json;
- } else {
- $unique_id = BaseUniqueLog::find()->select('unique_id1,unique_id2')->where(['update_time'=>$time])->asArray()->one();
- $base_main_id = $unique_id['unique_id1'] + 0;
- $this->unique_id = $unique_id['unique_id1'] + 1 + $unique_id_add;
- $final_unique_id = $unique_id['unique_id1'] + 1 + $addCnt;//最终唯一id
-
- // if ($unique_id['unique_id'] != $final_unique_id) {//更新成功
- // $do = true;
- // }else{
- // $do=false;
- // }
- }
- // sleep(rand(1,5));
- // }while($do == true);
- // while ($do == true) {//再来一次
- // $base_main_id = $unique_id['unique_id'] + 0;
- // $this->unique_id = $unique_id['unique_id'] + 1 + $unique_id_add;
- // $final_unique_id = $unique_id['unique_id'] + 1 + $addCnt;//最终唯一id
- // $unique_id = BaseUniqueId2::findOne(['id' => 1]);
- // $unique_id->UNIQUE_ID = $final_unique_id;
- // $json = array();
- // if (!$unique_id->update()) {
- // $json['code'] = '1';
- // $json['info'] = 'unique_id更新错误do' . serialize($unique_id->getErrors());
- // return $json;
- // }
- // }
- #endregion
- #2.2,生成巴士主订单号,按需求重组进bus_prod_list数组里
- $main_bus_order_id_arr = array();//主订单号数组
- foreach ($bus_prod_list as $k => $v) {
- $agent_depth = $v['agent_depth'];
- $id_arr = $agent_obj->getPointNum($base_main_id, $agent_depth);//array(1001,1002,1003)
- $base_main_id += $agent_depth;//增加初始值
- $id_str = implode(',', $id_arr);//1001,1002,1003
- $main_bus_order_id_arr[$k] = $id_arr;
- $bus_prod_list[$k]['order_id'] = $id_arr[1];
- $bus_prod_list[$k]['sale_path'] = $v['is_agent'] ? $id_str : '';//如果是代售票种,写入销售路径,否则为空字符串
- foreach ($v['agent_list'] as $ak => $av) {
- $bus_prod_list[$k]['agent_list'][$ak]['order_id'] = $id_arr[$ak];//主订单号
- $bus_prod_list[$k]['agent_list'][$ak]['sale_path'] = $bus_prod_list[$k]['sale_path'];//销售路径
-
- $av['price'] = $av['order_price'];
- $bus_prod_list[$k]['agent_list'][$ak]['price'] = $av['order_price'];
-
- if ($ak == 1) { //agent_level_1
- $bus_prod_list[$k]['agent_list'][$ak]['outside_order_no'] = $bus_prod_list[$k]['outside_order_no'];//agent_level_1 渠道订单号
- $bus_prod_list[$k]['agent_list'][$ak]['sub_channel_no'] = $bus_prod_list[$k]['sub_channel_no'];//agent_level_1 下级订单号
- $bus_prod_list[$k]['agent_list'][$ak]['price'] = $bus_prod_list[$k]['price'];//agent_level_1 子订单售价
- $bus_prod_list[$k]['agent_list'][$ak]['total_order_price'] = $bus_prod_list[$k]['price'] * $bus_prod_list[$k]['prod_num'];//agent_level_1 主订单售价
- $bus_prod_list[$k]['agent_list'][$ak]['total_base_price'] = $bus_prod_list[$k]['total_base_price'];//agent_level_1 主订单成本
- } else if ($ak == 2) { //agent_level_2
- $bus_prod_list[$k]['agent_list'][$ak]['outside_order_no'] = 'SPIDER-' . $id_arr[1];//agent_level_2 渠道订单号
- $bus_prod_list[$k]['agent_list'][$ak]['sub_channel_no'] = $bus_prod_list[$k]['outside_order_no'];//agent_level_2 下级订单号
- $bus_prod_list[$k]['agent_list'][$ak]['total_order_price'] = $av['price'] * $bus_prod_list[$k]['prod_num'];//agent_level_2 主订单售价
- $bus_prod_list[$k]['agent_list'][$ak]['total_base_price'] = $av['base_price'] * $bus_prod_list[$k]['prod_num'];//agent_level_2 主订单成本
- } else if ($ak == 3) { //agent_level_3
- $bus_prod_list[$k]['agent_list'][$ak]['outside_order_no'] = 'SPIDER-' . $id_arr[2];//agent_level_3 渠道订单号
- $bus_prod_list[$k]['agent_list'][$ak]['sub_channel_no'] = 'SPIDER-' . $id_arr[1];//agent_level_3 下级订单号
- $bus_prod_list[$k]['agent_list'][$ak]['total_order_price'] = $av['price'] * $bus_prod_list[$k]['prod_num'];//agent_level_3 主订单售价
- $bus_prod_list[$k]['agent_list'][$ak]['total_base_price'] = $av['base_price'] * $bus_prod_list[$k]['prod_num'];//agent_level_3 主订单成本
- }
- }
-
- }
-
- $this->product_result['bus_product'] = $bus_prod_list;
-
- #region 获取出发日期和出发时刻
- sort($start_date);
- $start_date = $start_date[0];
- if (count($start_time) > 0) {
- sort($start_time);
- $start_time = $start_time[0];
- } else {
- $start_time = '00:00';
- }
- #endregion
-
- #region 补充order_title基础配置
- $this->order_title_base['start_date'] = $start_date;//出发日期
- $this->order_title_base['start_time'] = $start_time;//出发时刻
- $this->order_title_base['cus_num'] = $total_num;//总人数
- $this->order_title_base['order_title_all_price'] = round($this->product_result['group_order_price'], 2);//round($total_price, 2);//总收入
- $this->order_title_base['order_title_per_price'] = round($this->order_title_base['order_title_all_price'] / $total_num, 2);//单人收入
- $this->order_title_base['order_prod_type'] = $order_prod_type;//组合订单种类:[100]单车票[010]单酒店[001]单门票[110]车+酒[101]车+门[011]酒+门[111]车+酒+门
- $this->order_title_base['order_title_status'] = $order_title_status;//组合订单状态
- $this->order_title_base['confirm_time'] = $confirm_time;//确认时间
- #endregion
-
-
- $this->final_unique_id = $final_unique_id;
-
- $json['code'] = '0';
- $json['info'] = '唯一键值配置成功';
- return $json;
- }
-
- function addCnt($addCnt)
- {
-
- }
-
- /**
- * Function Description:获取订单提交数据配置
- * Function Name: getSubmitGroupOrderData
- *
- *
- * @author 张帅
- */
- public function getSubmitGroupOrderData()
- {
- #region 获取巴士订单提交所需数据
- if (count($this->product_result['bus_product']) > 0) {
- $result = $this->getService('bus')->getSubmitBusData($this->unique_id, $this->order_main_base, $this->pay_main_base, $this->pay_detail_base, $this->user_id, $this->create_time, $this->product_result['bus_product']);
-
- #region 补充设置数据
- $this->unique_id = $result['unique_id'];//唯一键值
- $this->order_main_arr = array_merge($this->order_main_arr, $result['order_main_arr']);//订单数据
- $this->pay_main_arr = array_merge($this->pay_main_arr, $result['pay_main_arr']);//主支付记录
- $this->pay_detail_arr = array_merge($this->pay_detail_arr, $result['pay_detail_arr']);//支付明细
- $this->order_id_arr['bus_product'] = $result['main_order_id_arr'];//唯一键值
- $this->stock_order_arr = array_merge($this->stock_order_arr,
- [
- 'run_x_arr' => $result['run_x_arr'],//run_x需要修改数据
- 'run_bus_arr' => $result['run_bus_arr'],//run_bus需要修改数据
- 'run_prod_arr' => $result['run_prod_arr'],//run_prod需要修改数据
- 'run_stock_arr' => $result['run_stock_arr'],//run_stock需要更新数据
- ]
- );
- #endregion
- }
- #endregion
-
- #region 获取酒店订单提交所需数据
- if (count($this->product_result['hotel_product']) > 0) {
- $result = $this->getService('hotel')->getSubmitHotelData($this->unique_id, $this->order_main_base, $this->pay_main_base, $this->pay_detail_base, $this->user_id, $this->create_time);
-
- #region 补充设置数据
- $this->unique_id = $result['unique_id'];//唯一键值
- $this->order_main_arr = array_merge($this->order_main_arr, $result['order_main_arr']);//订单数据
- $this->pay_main_arr = array_merge($this->pay_main_arr, $result['pay_main_arr']);//主支付记录
- $this->pay_detail_arr = array_merge($this->pay_detail_arr, $result['pay_detail_arr']);//支付明细
- $this->order_id_arr['hotel_product'] = $result['main_order_id_arr'];//唯一键值
- $this->stock_order_arr = array_merge($this->stock_order_arr,
- [
- 'run_hotel_arr' => $result['run_hotel_arr'],//run_hotel需要修改的库存
- 'run_hotel_distrib_arr' => $result['run_hotel_distrib_arr'],//run_hotel_distrib需要修改的库存
- 'run_hotel_disperse_result' => $result['run_hotel_disperse_result'],//run_hotel_distrib需要分摊数据
- 'order_comment_arr' => $result['order_comment_arr'],
- ]
- );
- #endregion
- }
- #endregion
-
- #region 获取门票订单提交所需数据
- if (count($this->product_result['ticket_product']) > 0) {
- $result = $this->getService('ticket')->getSubmitTicketData($this->unique_id, $this->order_main_base, $this->pay_main_base, $this->pay_detail_base, $this->user_id, $this->create_time);
-
- #region 补充设置数据
- $this->unique_id = $result['unique_id'];//唯一键值
- $this->order_main_arr = array_merge($this->order_main_arr, $result['order_main_arr']);//订单数据
- $this->pay_main_arr = array_merge($this->pay_main_arr, $result['pay_main_arr']);//主支付记录
- $this->pay_detail_arr = array_merge($this->pay_detail_arr, $result['pay_detail_arr']);//支付明细
- $this->order_id_arr['ticket_product'] = $result['main_order_id_arr'];//唯一键值
- $this->stock_order_arr = array_merge($this->stock_order_arr,
- [
- 'opera_product_run_arr' => $result['opera_product_run_arr'],//opera_product_run需要修改数据
- ]
- );
- #endregion
- }
- #endregion
- }
-
- /**
- * Function Description:提交订单数据
- * Function Name: submitGroupOrder
- *
- * @return mixed
- *
- * @author 张帅
- */
- public function submitGroupOrder()
- {
- if ($this->unique_id != $this->final_unique_id) {
- $json['code'] = '1';
- $json['info'] = '计数异常,下单失败';
- return $json;
- }
-
- $submit_data = $this->getService('submit');
-
- $transaction = Yii::$app->db->beginTransaction();
- try {
- #region 1.order_pay_main插入数据
- $result = $submit_data->submitOrderPayMain();
- if (!isset($result['code']) || $result['code'] == '1') {
- throw new Exception($result['error']);
- }
- #endregion
-
- #region 2.order_pay_detail插入数据
- $result = $submit_data->submitOrderPayDetail();
- if (!isset($result['code']) || $result['code'] == '1') {
- throw new Exception($result['error']);
- }
- #endregion
-
- #region 3.修改巴士库存
- if (count($this->product_result['bus_product']) > 0) {
- $result = $submit_data->updateBusStockInfo();
- if (!isset($result['code']) || $result['code'] == '1') {
- throw new Exception($result['error']);
- }
- }
- #endregion
-
- #region 4.修改酒店库存
- if (count($this->product_result['hotel_product']) > 0) {
- $result = $submit_data->updateHotelStockInfo();
- if (!isset($result['code']) || $result['code'] == '1') {
- throw new Exception($result['error']);
- }
- }
- #endregion
-
- #region 5.修改门票库存
- if (count($this->product_result['ticket_product']) > 0) {
- $result = $submit_data->updateTicketStockInfo();
- if (!isset($result['code']) || $result['code'] == '1') {
- throw new Exception($result['error']);
- }
- }
- #endregion
-
- #region 6.新增组合订单数据
- $result = $submit_data->submitOrderTitle();
- if (!isset($result['code']) || $result['code'] == '1') {
- throw new Exception($result['error']);
- }
- $order_title_id = $result['order_title_id'];
- #endregion
-
- #region 7.order_main插入数据
- $result = $submit_data->submitOrderMain();
- if (!isset($result['code']) || $result['code'] == '1') {
- throw new Exception($result['error']);
- }
- #endregion
-
- #region 8.插入巴士日志
- if (isset($this->order_id_arr['bus_product'])) {
- $result = $submit_data->submitBusLog();
- if (!isset($result['code']) || $result['code'] == '1') {
- throw new Exception($result['error']);
- }
- }
- #endregion
-
- #region 9.插入酒店日志
- if (isset($this->order_id_arr['hotel_product'])) {
- $result = $submit_data->submitHotelLog();
- if (!isset($result['code']) || $result['code'] == '1') {
- throw new Exception($result['error']);
- }
- }
- #endregion
-
- #region 10.插入巴士订单出行人
- if (isset($this->product_result['passenger_info']) && count($this->product_result['bus_product']) > 0) {
- $passenger_info = $this->product_result['passenger_info'];
- $agent_obj = $agent_obj = new SubmitBusAgentOrder();
- if (count($passenger_info) != 0) {
- $order_id_str = implode(',', $this->order_id_arr['bus_product']);
- $agent_obj->IstPassengerInfo($order_id_str, $passenger_info);
- }
- }
- #endregion
- $transaction->commit();
-
- $json['code'] = '0';
- $json['info'] = '下单成功';
- $json['order_title_id'] = $order_title_id;
- $json['order_id'] = $this->order_id_arr;
- //add by qius on 2017.08.21 发送预定短信
- // $bus_id_array = implode(',', $this->order_id_arr['bus_product']);
- if (count($this->product_result['bus_product']) > 0) {
- foreach ($this->order_id_arr['bus_product'] as $key => $vel) {
- $url = 'http://' . CS1_DOMAIN . '/api/msg/order-send-msg';
- $sendInfo = array();
- $sendInfo['order_id'] = $vel;
- $sendInfo['msg_type'] = 'cs';
- Msg::httpRequest($url, $sendInfo);
- }
- }
- } catch (Exception $e) {
- $json['code'] = '1';
- $json['info'] = '下单失败';
- $json['error'] = $e->getMessage();
- }
-
- return $json;
- }
-
- /**
- * Function Description:供应商扣款
- * Function Name: insertBalance
- * @param $order_title_id
- *
- * @return array
- *
- * @author LUOCJ
- */
- public function insertBalance($order_title_id)
- {
- $res_data = ['code' => '0', 'info' => '供应商扣款成功'];
- $order_hotel_models = OrderMain::find()->from(OrderMain::tableName())
- ->where(['and', ['=', 'order_title_id', $order_title_id], ['=', 'cancel_flag', 0], ['in', 'order_prod_type', [25, 81]]])->all();
- if (!$order_hotel_models) {
- $res_data['code'] = '1';
- $res_data['info'] = '无该酒店订单数据,不需要进行扣款';
- return $res_data;
- }
- $submit_order = new SubmitOrder();
- foreach ($order_hotel_models as $k => $v) {
- $submit_order->SupplierBalance($v->ORDER_ID, 1, '组合订单:下单扣款');
- }
- return $res_data;
- }
-
- }
|