更新
This commit is contained in:
parent
5396290624
commit
7d858959df
@ -19,9 +19,8 @@ class IndexController extends BaseApiController
|
||||
|
||||
public function index()
|
||||
{
|
||||
$app=new WeChatMnpService();
|
||||
$a= $app->delivery('PF171564998868869065');
|
||||
d($a);
|
||||
|
||||
d(config('payment.wechat.default.mch_id'));
|
||||
$queue = 'send-mail';
|
||||
// 数据,可以直接传数组,无需序列化
|
||||
$data = ['to' => 'tom@gmail.com', 'content' => 'hello'];
|
||||
|
@ -9,6 +9,7 @@ use app\common\model\recharge\RechargeOrder;
|
||||
use app\common\model\retail\Cashierclass;
|
||||
use app\common\model\user\User;
|
||||
use app\common\service\PushService;
|
||||
use app\common\service\wechat\WeChatMnpService;
|
||||
use support\Log;
|
||||
use think\facade\Db;
|
||||
|
||||
@ -72,6 +73,9 @@ class PayNotifyLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
PushService::push('cash_register_'.$order['user_id'], $order['user_id'], '您有一笔订单已支付');
|
||||
if(isset($orderSn,$extra['payer']['openid'])){
|
||||
(new WeChatMnpService)->delivery($orderSn,$extra['payer']['openid']);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ class WeChatMnpService
|
||||
/**
|
||||
* @notes 发货
|
||||
*/
|
||||
public function delivery($order_id)
|
||||
public function delivery($order_id,$openid)
|
||||
{
|
||||
$token=Cache::get('mmp_access_token');
|
||||
if(!$token){
|
||||
@ -108,10 +108,11 @@ class WeChatMnpService
|
||||
}
|
||||
$dateTime = new DateTime(date('Y-m-d H:i:s'));
|
||||
$formattedDateTime = $dateTime->format('Y-m-d\TH:i:s.uP');
|
||||
return $this->app->getClient()->post("wxa/sec/order/upload_shipping_info?access_token=$token", [
|
||||
return $this->app->getClient()->postJson("wxa/sec/order/upload_shipping_info?access_token=$token", [
|
||||
'order_key' =>[
|
||||
'order_number_type'=>1,
|
||||
'out_trade_no'=>$order_id
|
||||
'out_trade_no'=>$order_id,
|
||||
'mchid'=>config('payment.wechat.default.mch_id')
|
||||
],
|
||||
'logistics_type'=>4,
|
||||
'delivery_mode'=>'UNIFIED_DELIVERY',
|
||||
@ -120,7 +121,7 @@ class WeChatMnpService
|
||||
],
|
||||
'upload_time'=>$formattedDateTime,
|
||||
'payer'=>[
|
||||
'openid'=>'onoIP7VVWhCZSWX8zazdNS4KazPE'
|
||||
'openid'=>$openid
|
||||
]
|
||||
])->toArray();
|
||||
}
|
||||
@ -134,6 +135,8 @@ class WeChatMnpService
|
||||
if($token){
|
||||
Cache::set('mmp_access_token',$token,7200);
|
||||
return $token;
|
||||
}else{
|
||||
throw new Exception('获取access_token失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user