getMemberRechargeOrderInfo([ ['order_id', '=', $order_id] ]); $order_info = $order_detail_result['data']; $params['site_id'] = $order_info['site_id'] ?? 0; $member = new Member(); $member_info = $member->getMemberInfo([ ['member_id', '=',$order_info['member_id']] ], 'balance, balance_money')['data'] ?? []; $account = number_format($member_info['balance'] + $member_info['balance_money'], 2, '.', ''); //获取店铺信息 $shop_model = new Shop(); $shop = $shop_model->getShopInfo([['site_id', '=', $params['site_id']]]); $shop_info = $shop['data']; //获取打印机列表 $print_model = new Printer(); $printer_data = $print_model->getPrinterList([['site_id', '=', $params['site_id']],['store_id','=',0], ['recharge_open', '=', 1]])['data'] ?? []; $res_data = []; foreach ($printer_data as $k => $v){ //此处应该根据打印机不同分别设置返回不同的数据。当前为易联云 $array = []; $array['printer_info'] = $v; $print_template_model = new PrinterTemplate(); $template_id = $v['recharge_template_id']; $print_template_data = $print_template_model->getPrinterTemplateInfo([['template_id', '=', $template_id]]); $print_template = $print_template_data['data']; $array['printer_code'] = $v['printer_code']; //商户授权机器码 $array['origin_id'] = $order_info['order_no']; //内部订单号(32位以内) /**文本接口开始**/ $content = "" . $v['recharge_print_num'] . ""; //小票名称 if ($print_template['title'] != '') { $content .= "
" . $print_template['title'] . "
"; $content .= str_repeat('.', 32); } //商城名称 if ($print_template['head'] == 1) { $content .= "
" . $print_template['site_name'] . "
"; $content .= str_repeat('.', 32); } $content .= "订单时间:" . date("Y-m-d H:i", $order_info['pay_time']) . "\n"; $content .= "订单编号:" . $order_info['order_no'] . "\n"; $content .= "支付方式:" . $order_info['pay_type_name'] . "\n"; $content .= str_repeat('.', 32); $content .= "充值金额:¥" . $order_info["face_value"] . "\n"; $content .= "实付金额:¥" . $order_info["price"] . "\n"; $content .= "会员余额:¥" . $account . "\n"; /******************** 买家信息 **************************/ //买家姓名 if ($print_template['buy_name'] == 1) { $content .= "会员:" . $order_info["nickname"] . "\n"; $content .= str_repeat('.', 32); } /******************** 商城信息 **************************/ //联系方式 if ($print_template['shop_mobile'] == 1) { $content .= "" . $shop_info["mobile"] . "\n"; } //地址 if ($print_template['shop_address'] == 1) { $content .= "" . $shop_info['province_name'] . $shop_info['city_name'] . $shop_info['district_name'] . $shop_info['address'] . "\n"; } if ($print_template['shop_mobile'] == 1 || $print_template['shop_address'] == 1) { $content .= str_repeat('.', 32); } //二维码 if ($print_template['shop_qrcode'] == 1) { $content .= "" . $print_template['qrcode_url'] . ""; $content .= str_repeat('.', 32); } //底部内容 if (!empty($print_template['bottom'])) { $content .= "
" . $print_template['bottom'] . "
"; } $array['content'] = $content; $res_data[] = $array; } return $res_data; } } }