feature/main20240421
lqmac 6 months ago
parent 17f983bf5c
commit 8f78dee6cc
  1. 12
      app/command/ProfitSharing.php
  2. 8
      app/command/ProfitSharingResult.php
  3. 8
      app/common/library/payment/gateway/driver/wechat/V3.php

@ -48,7 +48,7 @@ class ProfitSharing extends Command
echo "没有多商户商城了".PHP_EOL;
return false;
}
var_dump($stores);
//var_dump($stores);
foreach ($stores as $store) {
$where = [];
@ -62,7 +62,7 @@ class ProfitSharing extends Command
$where[] = ['merchant_id','>', 0];
$where[] = ['commission_ratio','>', 0];
$orders = Order::where($where)
->field('order_id,total_price,order_price,pay_price,pay_method,cost_price,merchant_id,store_id,order_status,pay_status,delivery_status,receipt_status,delivery_type,delivery_time,create_time,trade_id')
->field('order_id,total_price,order_price,pay_price,pay_method,cost_price,merchant_id,store_id,order_status,pay_status,delivery_status,receipt_status,delivery_type,delivery_time,create_time,trade_id,commission_ratio')
->select();
// var_dump($orders->toArray());
// exit();
@ -151,13 +151,11 @@ class ProfitSharing extends Command
continue;
}
$model = \app\store\model\Merchant::detail($order->merchant_id, $order->store_id);
if ($model['commission_ratio'] <= 0) {
if ($order->commission_ratio <= 0) {
echo $order->merchant_id."当前商户无需抽佣".PHP_EOL;
continue;
}
$precent = $model['commission_ratio'] / 1000;
$precent = $order->commission_ratio / 1000;
$precentPrice = round($precent * $order->pay_price * 100, 2);
var_dump($precentPrice);
//$precentPrice = 100;
@ -190,7 +188,7 @@ class ProfitSharing extends Command
} catch (\Exception $e) {
Log::append('微信支付分账失败', [$order->order_id.":".$e->getMessage()]);
echo $order->order_id.":".$e->getMessage();
$ret = Order::where('order_id',$order->order_id)->update(['profitsharing_status' => 3, 'profitsharing_time' => time(),'out_order_no' => $out_trade_no]);
//$ret = Order::where('order_id',$order->order_id)->update(['profitsharing_status' => 3, 'profitsharing_time' => time(),'out_order_no' => $out_trade_no]);
continue;
}
}

@ -48,7 +48,7 @@ class ProfitSharingResult extends Command
}
$orders = Order::where($where)
->field('order_id,total_price,order_price,pay_price,pay_method,cost_price,merchant_id,store_id,order_status,pay_status,delivery_status,receipt_status,delivery_type,delivery_time,create_time,out_order_no')
->field('order_id,total_price,order_price,pay_price,pay_method,cost_price,merchant_id,store_id,order_status,pay_status,delivery_status,receipt_status,delivery_type,delivery_time,create_time,out_order_no,trade_id,commission_ratio')
->select();
// var_dump($orders->toArray());
// exit();
@ -66,12 +66,12 @@ class ProfitSharingResult extends Command
echo $order['store_id']."微信支付方式没有配置".PHP_EOL;
continue;
}
$payment_template = PaymentTemplate::where('template_id', $payment->template_id)->where('is_delete', 1)->find();
$payment_template = PaymentTemplate::where('template_id', $payment->template_id)->where('is_delete', 0)->find();
if (!$payment_template) {
echo $order['store_id'].$payment->template_id."微信支付模版没有配置".PHP_EOL;
continue;
}
$wechat_config = $payment_template['config'] ? json_decode($payment_template['config'], true) : [];
$wechat_config = $payment_template['config'] ?? [];
if (!$wechat_config) {
echo $order['store_id'].$payment->template_id."微信支付模版没有配置11".PHP_EOL;
continue;
@ -83,7 +83,7 @@ class ProfitSharingResult extends Command
echo $order['store_id']."小程序配置没有".PHP_EOL;
continue;
}
$mini_config = $mini['values'] ? json_decode($mini['config'], true) : [];
$mini_config = $mini['values'] ?? [];
if (!$mini_config) {
echo $order['store_id'].$payment->template_id."微信支付模版没有配置11".PHP_EOL;
continue;

@ -169,11 +169,13 @@ class V3
{
// 下单的参数
$params = ['transaction_id' => $transaction_id];
var_dump($params);
$url = $this->getProfitUrl()."/".$out_order_no."?transaction_id=".$transaction_id;
echo $url;
try {
$resp = $this->getApp()
->chain($this->getProfitUrl()."/".$out_order_no)
->get(['query' => $params]);
->chain($url)
->get();
// 记录api返回的数据
$result = helper::jsonDecode((string)$resp->getBody());
var_dump($result);

Loading…
Cancel
Save