barCodeAll($data); if ($cache) { return $cache; } else { self::$errmsg = $obj->getMsg(); return false; } } /**统一刷卡接口 * @param $order_no * @param $code * @param $total_fee * @param $body * @return bool */ public function slotCard($order_no, $code, $total_fee, $body) { $merinfo = self::$merinfo; $obj = new CloudObj($merinfo); $cache = $obj->slotCard($order_no, $code, $total_fee, $body, "wechat"); if ($cache) { return true; } else { self::$errmsg = $obj->getMsg(); return false; } } /**统一刷卡接口 2020-10-17 * @param $order_no * @param $code * @param $total_fee * @param $body * @return bool */ public function slotCard_v1($order_no, $code, $total_fee, $body) { $merinfo = self::$merinfo; $obj = new CloudObj($merinfo); $cache = $obj->slotCard_v1($order_no, $code, $total_fee, $body, "wechat"); if ($cache) { return true; } else { self::$errmsg = $obj->getMsg(); return false; } } /** 查询订单信息 * @param $out_trade_no * @return bool|mixed|string * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function queryOrder($out_trade_no) { $merinfo = self::$merinfo; $obj = new CloudObj($merinfo); $re = $obj->queryOrder($out_trade_no, 'wechat'); if ($re) { return $re; } else { self::$errmsg = $obj->getMsg(); return false; } } /** 微信退款事件 * @param $order_no * @param string $refund_id * @param $total_fee * @param $refund_fee * @param $type 1, 普通微信 2,小程序微信 * @return mixed|string $total_fee*100 */ public function refund($order_no, $total_fee, $refund_fee, $refund_id = '') { $merinfo = self::$merinfo; $obj = new CloudObj($merinfo); $cache = $obj->Refund($order_no, $total_fee, 'wechat', $refund_fee, $refund_id); if ($cache) { return true; } else { self::$errmsg = $obj->getMsg(); return false; } } /** 查询微信退款订单信息 * @param $out_trade_no * @return bool|mixed|string * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function refundQuery($out_trade_no) { $merinfo = self::$merinfo; $obj = new CloudObj($merinfo); $re = $obj->refundQuery($out_trade_no); if ($re) { return $re; } else { self::$errmsg = $obj->getMsg(); return false; } } /** 统一下单功能 * @param $data * @return bool */ public function unifiedorder($order_no, $open_id, $payPrice, $orderType = 'wechatJs', $body = '') { $merinfo = self::$merinfo; $data["pay_price"] = $payPrice; $data["order_no"] = $order_no; $data["open_id"] = $open_id; $data['orderType'] = $orderType; $data['body'] = $body; $data['appid'] = $this->upwxconfig($orderType); if (!$data['appid']) { return false; } $obj = new CloudObj($merinfo); $cache = $obj->unifiedorder($data); if ($cache) { return $cache; } else { self::$errmsg = $obj->getMsg(); return false; } } /** * 查找渠道的appid或者商户自己的appid参数 */ public function upwxconfig($orderType) { if ($orderType == 'wechatJs') { return self::$merinfo['cloud_sub_appid']; } else if ($orderType == 'wechatMiniProgram') { return self::$merinfo['cloud_xcx_appid']; } self::$errmsg = '商家appId未正确设置'; return false; } /** 返回错误报告数据 * @return string */ public function getMsg() { return self::$errmsg; } }