|
@@ -65,6 +65,62 @@ class Notify extends Controller
|
|
|
|
|
|
|
|
$response->send();
|
|
$response->send();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public function phorder2(){
|
|
|
|
|
+ $config = config('app.wx_mini_config_ph');
|
|
|
|
|
+ $app = Factory::payment($config);
|
|
|
|
|
+ $response = $app->handlePaidNotify(function ($message, $fail) {
|
|
|
|
|
+ if ($message['return_code'] === 'SUCCESS' && $message['result_code'] === 'SUCCESS') { // return_code 表示通信状态,不代表支付状态
|
|
|
|
|
+ // 用户是否支付成功
|
|
|
|
|
+ $tradeNo = $message['out_trade_no'];
|
|
|
|
|
+ // 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单
|
|
|
|
|
+ $order = Db::name('ph_order_pay')->where('sn',$tradeNo)->find();
|
|
|
|
|
+ if (!$order || $order['status'] != 0) { // 如果订单不存在 或者 订单已经支付过了
|
|
|
|
|
+ return true; // 告诉微信,我已经处理完了,订单没找到,别再通知我了
|
|
|
|
|
+ }
|
|
|
|
|
+ $ret = model('PhOrderPay')->paySuccess($order['id'],2);
|
|
|
|
|
+ if(!$ret){
|
|
|
|
|
+ trace('订单修改失败');
|
|
|
|
|
+ $fail('订单修改失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return $fail('通信失败,请稍后再通知我');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true; // 返回处理完成
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ $response->send();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //萍乡市人民医院
|
|
|
|
|
+ public function phOrderPx2(){
|
|
|
|
|
+ $config = config('app.wx_mini_config_ph_px');
|
|
|
|
|
+ $app = Factory::payment($config);
|
|
|
|
|
+ $response = $app->handlePaidNotify(function ($message, $fail) {
|
|
|
|
|
+ if ($message['return_code'] === 'SUCCESS' && $message['result_code'] === 'SUCCESS') { // return_code 表示通信状态,不代表支付状态
|
|
|
|
|
+ // 用户是否支付成功
|
|
|
|
|
+ $tradeNo = $message['out_trade_no'];
|
|
|
|
|
+ // 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单
|
|
|
|
|
+ $order = Db::name('ph_order_pay')->where('sn',$tradeNo)->find();
|
|
|
|
|
+ if (!$order || $order['status'] != 0) { // 如果订单不存在 或者 订单已经支付过了
|
|
|
|
|
+ return true; // 告诉微信,我已经处理完了,订单没找到,别再通知我了
|
|
|
|
|
+ }
|
|
|
|
|
+ $ret = model('PhOrderPay')->paySuccess($order['id'],2);
|
|
|
|
|
+ if(!$ret){
|
|
|
|
|
+ trace('订单修改失败');
|
|
|
|
|
+ $fail('订单修改失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return $fail('通信失败,请稍后再通知我');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true; // 返回处理完成
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ $response->send();
|
|
|
|
|
+ }
|
|
|
public function xshopOrder(){
|
|
public function xshopOrder(){
|
|
|
$config = config('app.wx_config');
|
|
$config = config('app.wx_config');
|
|
|
$app = Factory::payment($config);
|
|
$app = Factory::payment($config);
|
|
@@ -79,9 +135,9 @@ class Notify extends Controller
|
|
|
}
|
|
}
|
|
|
$ret = Db::name('g_orders')->where('id',$order['id'])->update(['status'=>1,'pay_time'=>date('Y-m-d H:i:s')]);
|
|
$ret = Db::name('g_orders')->where('id',$order['id'])->update(['status'=>1,'pay_time'=>date('Y-m-d H:i:s')]);
|
|
|
$goods = Db::name('g_order_goods')->where('order_id',$order['id'])->select();
|
|
$goods = Db::name('g_order_goods')->where('order_id',$order['id'])->select();
|
|
|
- //增加销量
|
|
|
|
|
|
|
+ //增加销量
|
|
|
foreach ($goods as $k=>$v){
|
|
foreach ($goods as $k=>$v){
|
|
|
- Db::name('g_goods')
|
|
|
|
|
|
|
+ Db::name('g_goods')
|
|
|
->where('id',$v['id'])
|
|
->where('id',$v['id'])
|
|
|
->inc('sale',$v['nums'])
|
|
->inc('sale',$v['nums'])
|
|
|
->update();
|
|
->update();
|