|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|