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| |||
A1UdDgQWBBTIibbUnV9kTejncwyzXb81/xqj9TCBvwYDVR0jBIG3MIG0gBQ+BSb2 | |||
ImK0FVuIzWR+sNRip+WGdKGBkKSBjTCBijELMAkGA1UEBhMCQ04xEjAQBgNVBAgT | |||
CUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNVBAoTB1RlbmNlbnQx | |||
DDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEfMB0GCSqGSIb3DQEJ | |||
ARYQbW1wYXltY2hAdGVuY2VudIIJALtUlyu8AOhXMA4GA1UdDwEB/wQEAwIGwDAW | |||
BgNVHSUBAf8EDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQAHelavW3WB | |||
2qBtcG0uEVPLYlWKMvYpO79QUaWPYWh9bywA9d2zqoM8LfWgkOJtmetNdiqh3RVf | |||
/DrKWsLalluaLIMEHuX2chnvtT7vIO4ILijgP/4MZ9k8Jpmi3tKUfFpJVA7E4MXa | |||
7vM5gl21FRuqB96m24tynWHjmgshc4Kk2g== | |||
-----END CERTIFICATE----- |
@@ -0,0 +1,28 @@ | |||
-----BEGIN PRIVATE KEY----- | |||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDCajxxHlEL1mUF | |||
peVv0LyPzEfe4wmOogK53zz5CwYFmOpRIe3BhZ+Ragtg7Ex8blAv+7IvUquUBwNi | |||
vFWi5PKmA49grq09MkRVQFbLPzWHz3q2epxy2xAeKXWIOo1L0FVnu5+YSUnKvvPT | |||
DRlDqYBeLggg/x8lA6UU/DBUUPshg06bgo6mcHsYDHtIzUysLwl1cC3IEfSxZJ0o | |||
iQsQxwKmrqneK/mQIw1OAmfyVnXsi7kVKsMc+JBAhEvYgu/ZocqPysKFLqbGSqfE | |||
SmnK4R8m6jI4MmTRbFbnix43A6WJDIK6VEFOkASb+qS6jj3o0kIPfXXSTQUyScMH | |||
31NpqwxtAgMBAAECggE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yM9PZa7T2dNgfi | |||
tPv/b/vNHHdH7jPJbyEV123d4QgcCeIhp9ZWGikPAoGBAMUbx9snnBwswUae+Dv2 | |||
NkH02dv7oPQnPWKbk8b1s/LQEuisYO+34Aofx1ik5MmAZBN/3x8Cn7/i0eOKEUnd | |||
TRsJuiiSFLYdNISDUBQ4R263uSewow9kagrk/lwQgZ/6pJSXQH9G1ycNeZxmR3dq | |||
XevCR+GjHIwTFaYo4XOBYoNw | |||
-----END PRIVATE KEY----- |
@@ -11,16 +11,16 @@ return array ( | |||
), | |||
'value' => | |||
array ( | |||
'appid' => '', | |||
'app_id' => '', | |||
'app_secret' => '', | |||
'appid' => 'wxbe6da4af3e529e0c', | |||
'app_id' => 'wxbe6da4af3e529e0c', | |||
'app_secret' => '7c1b14020e87e9e213696e870da0e549', | |||
'miniapp_id' => '', | |||
'mch_id' => '', | |||
'key' => '', | |||
'notify_url' => '/addons/epay/api/notifyx/type/wechat', | |||
'mch_id' => '1329733601', | |||
'key' => 'a6654d342eedd8e293692a3e211a5e53', | |||
'notify_url' => '', | |||
'cert_client' => '/epay/certs/apiclient_cert.pem', | |||
'cert_key' => '/epay/certs/apiclient_key.pem', | |||
'log' => 1, | |||
'log' => '1', | |||
), | |||
'rule' => '', | |||
'msg' => '', | |||
@@ -39,8 +39,8 @@ return array ( | |||
'value' => | |||
array ( | |||
'app_id' => '2016102100728544', | |||
'notify_url' => '/addons/epay/api/notifyx/type/alipay', | |||
'return_url' => '/addons/epay/api/returnx/type/alipay', | |||
'notify_url' => '', | |||
'return_url' => '', | |||
'ali_public_key' => 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApIVSOQhGhke6xjf0yvd8dBTH34lrzdLnybz0mysN54Zq5r854hBFf2BNyoRG5HL+gUWT+nbB7cfzhsf/Co3cfAb6WLfYc4dKDqJQYNK/AZhxJD/yTXp41jTTRPqqYT9vkIh4Y0H2uOEeBehWql+wx+KOkhhgLFFsanyU0++pR8Zqzzh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eJ5vqpSD9Ks9waDG5fFKW7wYioE4excCgYEAwbNh2624Dz+1SaAbbQ9wP5ursTGbbmTuz/092zNss9sXtfbmZHhiVGBV8DEygNQvW/1Sdyv+R0Q/TyHYBav8t55ON+AGaJ0KLexmeYqR1ksZ93RdN4bo/0zFel07qFdD+qKX+sKiazsh79liKg3yjuv7iKyVzAFqWHuNDDDk4GMCgYEAiTI2+3+TsDCQzkpA32FwmxgnDgaRCjoTPQVHg7Xrj0NOdsIPP/3avC5ljFfuUxqL6K4e0izcaEyueZ0l8SECTyevf5Oym4aHovO/tYlQm80D6m2mh+XMvdxWlmeu0PnP9M/nbh8uqY1V7qT5bpF/WpBRIo2/Ep+MvdWUAGrfj70CgYEAh9PGF0ml++tssIg5MyzURYZfyw1CNRNJ80ddjMxuuWA1LEBKJsHUEd7L5HZbN8OSwirNHQwYbtkIm/Dbjn6f5BJ6Puw1Ej6s2K8g3LGyulZHiyJqC3nrALtQ7xFZuB4ZaTOC5zB8vDzm+02wbFUDdf08kQaUtE15yTo6GgZfOIkCgYEAgv+VQZMX5cENxdUo2jw7FsNNo8jsK99iLkjri0R4wpP6x2OFZKBe0oqXN+bIGXRhAEU8F11uD1l+nnZhnRjB3P6vB16JNn691DjQf0R4SNECQcVU+BDb2DHG9PywwYcIM2x0idvd2QEYMLukJ0CPk5k5cIjzHE0mgblN2ktnhVg=', | |||
'log' => '1', | |||
@@ -65,7 +65,7 @@ class Pay extends Base | |||
{ | |||
$orderId = $this->request->request('order_id', 0); | |||
$orderId = Hashids::decodeHex($orderId); | |||
// $orderId = Hashids::decodeHex($orderId); | |||
$orderModel = new \addons\unishop\model\Order(); | |||
$order = $orderModel->where(['id' => $orderId])->find(); | |||
@@ -75,6 +75,12 @@ class Pay extends Base | |||
$this->error(__('Order does not exist')); | |||
} | |||
$products = $order->products()->select(); | |||
$body = Config::getByName('name')['value']; | |||
foreach ($products as $product) { | |||
$body .= '_' . $product['title']; | |||
} | |||
//MWEB | |||
$platfrom = $this->request->header('platform', 'MP-WEIXIN'); | |||
@@ -87,55 +93,20 @@ class Pay extends Base | |||
$trade_type = 'MWEB'; | |||
break; | |||
} | |||
// 如果是微信内访问 公众号等 | |||
if (Wechat::h5InWechat()) { | |||
$trade_type = 'JSAPI'; | |||
} | |||
$products = $order->products()->select(); | |||
$body = Config::getByName('name')['value']; | |||
foreach ($products as $product) { | |||
$body .= '_' . $product['title']; | |||
} | |||
$app = Wechat::initEasyWechat('payment'); | |||
$result = $app->order->unify([ | |||
'body' => $body, | |||
'out_trade_no' => $order['out_trade_no'], | |||
'total_fee' => bcmul($order['total_price'], 100), | |||
'spbill_create_ip' => $_SERVER['REMOTE_ADDR'], // 可选,如不传该参数,SDK 将会自动获取相应 IP 地址 | |||
'trade_type' => $trade_type, // 请对应换成你的支付方式对应的值类型 | |||
'openid' => Wechat::getOpenidByUserId($this->auth->id) | |||
]); | |||
if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS') { | |||
if ($trade_type == 'JSAPI') { | |||
// 二次签名 | |||
$result['timeStamp'] = (string)time(); | |||
$result['paySign'] = Wechat::paySign([ | |||
'appId' => Config::getByName('app_id')['value'], | |||
'nonceStr' => $result['nonce_str'], | |||
'package' => 'prepay_id=' . $result['prepay_id'], | |||
'timeStamp' => $result['timeStamp'], | |||
'signType' => 'MD5' | |||
], Config::getByName('key')['value']); | |||
} elseif ($trade_type == 'MWEB') { | |||
$page = '/pages/order/order?state=0'; | |||
if ($platfrom == 'APP-PLUS') { | |||
$page = '/pages/index/index'; | |||
} | |||
$result['mweb_url'] .= '&redirect_url=' . urlencode('https://' . $_SERVER['HTTP_HOST'] . '/h5/#' . $page); | |||
$result['referer'] = 'https://' . $_SERVER['HTTP_HOST']; | |||
} | |||
$this->success('', $result); | |||
} else { | |||
$this->error($result['return_msg']); | |||
$trade_type = 'wap'; | |||
} | |||
$params = [ | |||
'amount' => bcmul($order['total_price'], 100), | |||
'orderid' => $order->out_trade_no, | |||
'type' => "wechat", | |||
'title' => $body, | |||
'notifyurl' => Config::getByName('notify_url')['value'], | |||
'trade_type' => $trade_type, | |||
]; | |||
return Service::submitOrder($params); | |||
} catch (Exception $e) { | |||
$this->error($e->getMessage()); | |||
} | |||
@@ -3,7 +3,7 @@ import store from './store' | |||
import App from './App' | |||
// 后端api地址 | |||
Vue.prototype.$unishow = "http://nwx.zhizhuchuxing.cn/addons/unishop"; | |||
Vue.prototype.$unishow = "http://127.0.0.1/addons/unishop"; | |||
// Vue.prototype.$unishow = "http://shop1.com/index.php/addons/unishop"; | |||
//Vue.prototype.$unishow = "http://t.fastadmin-ceshi.com:8888/addons/unishop"; | |||
//Vue.prototype.$unishow = "http://shop.weivee.com/addons/unishop"; | |||
@@ -13,7 +13,7 @@ uni.getSystemInfo({ | |||
success(res) { | |||
//console.log(res) | |||
if (res.platform != "devtools") { | |||
Vue.prototype.$unishow = "http://nwx.zhizhuchuxing.cn/addons/unishop"; | |||
Vue.prototype.$unishow = "http://127.0.0.1/addons/unishop"; | |||
// Vue.prototype.$unishow = "http://shop1.com/index.php/addons/unishop"; | |||
} | |||
} | |||