账单函数

账单函数

在线付款结单做账函数

平台运营sadmin 发表了文章 • 0 个评论 • 239 次浏览 • 2020-04-22 10:27 • 来自相关话题

/*支付处理金额流向
*费用字段:
+ dabaofei (打包费|餐盒费)
- manjian (满减)
- youhuiquan (优惠券,如果平台发放的,就平台出资,否则就是店主出资)
- zhekou (折扣)
+ psfei (自定义配送费用)
+ yunshufei (配送费)
+ productmoney (产品总价)
= orderamount (订单总价)

*店主活动费用:
- hongbao (下单红包)
- shareMoney (推荐返利金额)

** 如果新增了费用,需要修改此函数
*/

public function onlinepay_order_done_deal2(array $order){
$user = $this->_getOneBy("user","id",$order['user_id']);
$shopSet = $this->_getOneBy("shop_set","shopid",$order['shopid']);
//平台扣点金额,仅扣产品的,打包费不扣点
$koudian = round( (($order['productmoney'])*(floatval($user['dingdanTax'])/100)), 2 );
//店主收入=============================================
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>$order['productmoney'],'desc'=>"订单({$order['id']})产品入账",'flag'=>100) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>$order['dabaofei'],'desc'=>"订单({$order['id']})打包费入账",'flag'=>101) );
//店主的支出
=============================================
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$koudian),'desc'=>"订单({$order['id']})扣点支出",'flag'=>94) );


if( floatval($shopSet['manjian_chuzibili'])<0 || floatval($shopSet['manjian_chuzibili'])>100 ){
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['manjian']),'desc'=>"订单({$order['id']})满减优惠支出100%",'flag'=>98) );
}else{
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['manjian']*floatval($shopSet['manjian_chuzibili'])/100),'desc'=>"订单({$order['id']})满减优惠支出{$shopSet['manjian_chuzibili']}%",'flag'=>98) );
}

$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['zhekou']),'desc'=>"订单({$order['id']})折扣优惠支出",'flag'=>97) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['hongbao']),'desc'=>"订单({$order['id']})红包返利支出",'flag'=>96) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['shareMoney']),'desc'=>"订单({$order['id']})推荐返利支出",'flag'=>95) );


//平台的收入============================================

$this->userAccountChange( array('user_id'=>1,'newYue'=>-1*$order['psfei'],'desc'=>"订单({$order['id']})自定义配送费划出",'flag'=>102) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>-1*$order['yunshufei'],'desc'=>"订单({$order['id']})配送费划出",'flag'=>103) );


$this->userAccountChange( array('user_id'=>1,'newYue'=>$order['psfei'],'desc'=>"订单({$order['id']})自定义配送费入账",'flag'=>102) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>$order['yunshufei'],'desc'=>"订单({$order['id']})配送费入账",'flag'=>103) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>$koudian,'desc'=>"订单({$order['id']})扣点收入",'flag'=>103) );
//平台的支出=============================================

if($order['coupon_id']>0){
//店主添加的优惠券由店主自己出资
$couponOrder = $this->_getOneBy("admin_coupon_order","id",$order['coupon_id']);
$coupon = $this->_getOneBy("admin_coupon","id",$couponOrder['coupon_id']);
if($coupon['user_id']>1){
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['youhuiquan']),'desc'=>"订单({$order['id']})优惠券支出",'flag'=>99) );
}else{
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$order['youhuiquan']),'desc'=>"订单({$order['id']})折扣券支出",'flag'=>99) );
}

}else{

//这里平台承担一部分,店主承担一部分
$shoujian_bili_pt = floatval($user['shoujianTax'])/100;//平台出资比例
$shoujian_bili_dz = 1-$shoujian_bili_pt;//店主出资比例
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-($order['youhuiquan']*$shoujian_bili_pt)),'desc'=>"订单({$order['id']})首单减优惠支出{$user['shoujianTax']}%",'flag'=>99) );
$shoujian_bili_dz_percent = $shoujian_bili_dz*100;
$this->userAccountChange( array('user_id'=>$user['id'],'newYue'=>(0-($order['youhuiquan']*$shoujian_bili_dz)),'desc'=>"订单({$order['id']})首单减优惠支出{$shoujian_bili_dz_percent}%",'flag'=>99) );

}

if( floatval($shopSet['manjian_chuzibili'])<0 || floatval($shopSet['manjian_chuzibili'])>100 ){
//平台不出资
}else{
$chuzibili = 100-$shopSet['manjian_chuzibili'];
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$order['manjian']*(100-floatval($shopSet['manjian_chuzibili']))/100),'desc'=>"订单({$order['id']})满减优惠支出{$chuzibili}",'flag'=>98) );
}


//计算店主的收入+支出的和。算作平台的支出
$dianzhu_juedui_shouru = $order['productmoney']+$order['dabaofei'] -($koudian +($order['manjian']*floatval($shopSet['manjian_chuzibili'])/100)+$order['zhekou'] + $order['hongbao'] + $order['shareMoney']);
if($dianzhu_juedui_shouru < 0 ){
$dianzhu_juedui_shouru = 0;
}
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$dianzhu_juedui_shouru),'desc'=>"店主订单({$order['id']})的绝对收入支出",'flag'=>98) );

//新增推荐店主收入支出。店主提成=平台提点收入($koudian)*每个店铺的比例
if($koudian>0 && $shopSet['dianzhu_ticheng']*1>0 && $user['recommend_id']*1>1 && $user['role_id']==2){
//划出平台账户
$ticheng = round(($koudian*$shopSet['dianzhu_ticheng']/100),2);
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$ticheng),'desc'=>"推荐者{$user['recommend_id']}提成(订单{$order['id']})¥{$ticheng},比例{$shopSet['dianzhu_ticheng']}%",'flag'=>666) );
//划入推荐者账户
$this->userAccountChange( array('user_id'=>$user['recommend_id'],'newYue'=>$ticheng,'desc'=>"{$shopSet['shopname']}提成(订单{$order['id']})¥{$ticheng},比例{$shopSet['dianzhu_ticheng']}%",'flag'=>666,'flag2'=>$user['id']) );
}

} 查看全部
/*支付处理金额流向
*费用字段:
+ dabaofei (打包费|餐盒费)
- manjian (满减)
- youhuiquan (优惠券,如果平台发放的,就平台出资,否则就是店主出资)
- zhekou (折扣)
+ psfei (自定义配送费用)
+ yunshufei (配送费)
+ productmoney (产品总价)
= orderamount (订单总价)

*店主活动费用:
- hongbao (下单红包)
- shareMoney (推荐返利金额)

** 如果新增了费用,需要修改此函数
*/

public function onlinepay_order_done_deal2(array $order){
$user = $this->_getOneBy("user","id",$order['user_id']);
$shopSet = $this->_getOneBy("shop_set","shopid",$order['shopid']);
//平台扣点金额,仅扣产品的,打包费不扣点
$koudian = round( (($order['productmoney'])*(floatval($user['dingdanTax'])/100)), 2 );
//店主收入=============================================
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>$order['productmoney'],'desc'=>"订单({$order['id']})产品入账",'flag'=>100) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>$order['dabaofei'],'desc'=>"订单({$order['id']})打包费入账",'flag'=>101) );
//店主的支出
=============================================
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$koudian),'desc'=>"订单({$order['id']})扣点支出",'flag'=>94) );


if( floatval($shopSet['manjian_chuzibili'])<0 || floatval($shopSet['manjian_chuzibili'])>100 ){
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['manjian']),'desc'=>"订单({$order['id']})满减优惠支出100%",'flag'=>98) );
}else{
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['manjian']*floatval($shopSet['manjian_chuzibili'])/100),'desc'=>"订单({$order['id']})满减优惠支出{$shopSet['manjian_chuzibili']}%",'flag'=>98) );
}

$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['zhekou']),'desc'=>"订单({$order['id']})折扣优惠支出",'flag'=>97) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['hongbao']),'desc'=>"订单({$order['id']})红包返利支出",'flag'=>96) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['shareMoney']),'desc'=>"订单({$order['id']})推荐返利支出",'flag'=>95) );


//平台的收入============================================

$this->userAccountChange( array('user_id'=>1,'newYue'=>-1*$order['psfei'],'desc'=>"订单({$order['id']})自定义配送费划出",'flag'=>102) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>-1*$order['yunshufei'],'desc'=>"订单({$order['id']})配送费划出",'flag'=>103) );


$this->userAccountChange( array('user_id'=>1,'newYue'=>$order['psfei'],'desc'=>"订单({$order['id']})自定义配送费入账",'flag'=>102) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>$order['yunshufei'],'desc'=>"订单({$order['id']})配送费入账",'flag'=>103) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>$koudian,'desc'=>"订单({$order['id']})扣点收入",'flag'=>103) );
//平台的支出=============================================

if($order['coupon_id']>0){
//店主添加的优惠券由店主自己出资
$couponOrder = $this->_getOneBy("admin_coupon_order","id",$order['coupon_id']);
$coupon = $this->_getOneBy("admin_coupon","id",$couponOrder['coupon_id']);
if($coupon['user_id']>1){
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['youhuiquan']),'desc'=>"订单({$order['id']})优惠券支出",'flag'=>99) );
}else{
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$order['youhuiquan']),'desc'=>"订单({$order['id']})折扣券支出",'flag'=>99) );
}

}else{

//这里平台承担一部分,店主承担一部分
$shoujian_bili_pt = floatval($user['shoujianTax'])/100;//平台出资比例
$shoujian_bili_dz = 1-$shoujian_bili_pt;//店主出资比例
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-($order['youhuiquan']*$shoujian_bili_pt)),'desc'=>"订单({$order['id']})首单减优惠支出{$user['shoujianTax']}%",'flag'=>99) );
$shoujian_bili_dz_percent = $shoujian_bili_dz*100;
$this->userAccountChange( array('user_id'=>$user['id'],'newYue'=>(0-($order['youhuiquan']*$shoujian_bili_dz)),'desc'=>"订单({$order['id']})首单减优惠支出{$shoujian_bili_dz_percent}%",'flag'=>99) );

}

if( floatval($shopSet['manjian_chuzibili'])<0 || floatval($shopSet['manjian_chuzibili'])>100 ){
//平台不出资
}else{
$chuzibili = 100-$shopSet['manjian_chuzibili'];
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$order['manjian']*(100-floatval($shopSet['manjian_chuzibili']))/100),'desc'=>"订单({$order['id']})满减优惠支出{$chuzibili}",'flag'=>98) );
}


//计算店主的收入+支出的和。算作平台的支出
$dianzhu_juedui_shouru = $order['productmoney']+$order['dabaofei'] -($koudian +($order['manjian']*floatval($shopSet['manjian_chuzibili'])/100)+$order['zhekou'] + $order['hongbao'] + $order['shareMoney']);
if($dianzhu_juedui_shouru < 0 ){
$dianzhu_juedui_shouru = 0;
}
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$dianzhu_juedui_shouru),'desc'=>"店主订单({$order['id']})的绝对收入支出",'flag'=>98) );

//新增推荐店主收入支出。店主提成=平台提点收入($koudian)*每个店铺的比例
if($koudian>0 && $shopSet['dianzhu_ticheng']*1>0 && $user['recommend_id']*1>1 && $user['role_id']==2){
//划出平台账户
$ticheng = round(($koudian*$shopSet['dianzhu_ticheng']/100),2);
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$ticheng),'desc'=>"推荐者{$user['recommend_id']}提成(订单{$order['id']})¥{$ticheng},比例{$shopSet['dianzhu_ticheng']}%",'flag'=>666) );
//划入推荐者账户
$this->userAccountChange( array('user_id'=>$user['recommend_id'],'newYue'=>$ticheng,'desc'=>"{$shopSet['shopname']}提成(订单{$order['id']})¥{$ticheng},比例{$shopSet['dianzhu_ticheng']}%",'flag'=>666,'flag2'=>$user['id']) );
}

}

在线付款结单做账函数

平台运营sadmin 发表了文章 • 0 个评论 • 239 次浏览 • 2020-04-22 10:27 • 来自相关话题

/*支付处理金额流向
*费用字段:
+ dabaofei (打包费|餐盒费)
- manjian (满减)
- youhuiquan (优惠券,如果平台发放的,就平台出资,否则就是店主出资)
- zhekou (折扣)
+ psfei (自定义配送费用)
+ yunshufei (配送费)
+ productmoney (产品总价)
= orderamount (订单总价)

*店主活动费用:
- hongbao (下单红包)
- shareMoney (推荐返利金额)

** 如果新增了费用,需要修改此函数
*/

public function onlinepay_order_done_deal2(array $order){
$user = $this->_getOneBy("user","id",$order['user_id']);
$shopSet = $this->_getOneBy("shop_set","shopid",$order['shopid']);
//平台扣点金额,仅扣产品的,打包费不扣点
$koudian = round( (($order['productmoney'])*(floatval($user['dingdanTax'])/100)), 2 );
//店主收入=============================================
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>$order['productmoney'],'desc'=>"订单({$order['id']})产品入账",'flag'=>100) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>$order['dabaofei'],'desc'=>"订单({$order['id']})打包费入账",'flag'=>101) );
//店主的支出
=============================================
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$koudian),'desc'=>"订单({$order['id']})扣点支出",'flag'=>94) );


if( floatval($shopSet['manjian_chuzibili'])<0 || floatval($shopSet['manjian_chuzibili'])>100 ){
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['manjian']),'desc'=>"订单({$order['id']})满减优惠支出100%",'flag'=>98) );
}else{
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['manjian']*floatval($shopSet['manjian_chuzibili'])/100),'desc'=>"订单({$order['id']})满减优惠支出{$shopSet['manjian_chuzibili']}%",'flag'=>98) );
}

$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['zhekou']),'desc'=>"订单({$order['id']})折扣优惠支出",'flag'=>97) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['hongbao']),'desc'=>"订单({$order['id']})红包返利支出",'flag'=>96) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['shareMoney']),'desc'=>"订单({$order['id']})推荐返利支出",'flag'=>95) );


//平台的收入============================================

$this->userAccountChange( array('user_id'=>1,'newYue'=>-1*$order['psfei'],'desc'=>"订单({$order['id']})自定义配送费划出",'flag'=>102) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>-1*$order['yunshufei'],'desc'=>"订单({$order['id']})配送费划出",'flag'=>103) );


$this->userAccountChange( array('user_id'=>1,'newYue'=>$order['psfei'],'desc'=>"订单({$order['id']})自定义配送费入账",'flag'=>102) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>$order['yunshufei'],'desc'=>"订单({$order['id']})配送费入账",'flag'=>103) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>$koudian,'desc'=>"订单({$order['id']})扣点收入",'flag'=>103) );
//平台的支出=============================================

if($order['coupon_id']>0){
//店主添加的优惠券由店主自己出资
$couponOrder = $this->_getOneBy("admin_coupon_order","id",$order['coupon_id']);
$coupon = $this->_getOneBy("admin_coupon","id",$couponOrder['coupon_id']);
if($coupon['user_id']>1){
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['youhuiquan']),'desc'=>"订单({$order['id']})优惠券支出",'flag'=>99) );
}else{
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$order['youhuiquan']),'desc'=>"订单({$order['id']})折扣券支出",'flag'=>99) );
}

}else{

//这里平台承担一部分,店主承担一部分
$shoujian_bili_pt = floatval($user['shoujianTax'])/100;//平台出资比例
$shoujian_bili_dz = 1-$shoujian_bili_pt;//店主出资比例
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-($order['youhuiquan']*$shoujian_bili_pt)),'desc'=>"订单({$order['id']})首单减优惠支出{$user['shoujianTax']}%",'flag'=>99) );
$shoujian_bili_dz_percent = $shoujian_bili_dz*100;
$this->userAccountChange( array('user_id'=>$user['id'],'newYue'=>(0-($order['youhuiquan']*$shoujian_bili_dz)),'desc'=>"订单({$order['id']})首单减优惠支出{$shoujian_bili_dz_percent}%",'flag'=>99) );

}

if( floatval($shopSet['manjian_chuzibili'])<0 || floatval($shopSet['manjian_chuzibili'])>100 ){
//平台不出资
}else{
$chuzibili = 100-$shopSet['manjian_chuzibili'];
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$order['manjian']*(100-floatval($shopSet['manjian_chuzibili']))/100),'desc'=>"订单({$order['id']})满减优惠支出{$chuzibili}",'flag'=>98) );
}


//计算店主的收入+支出的和。算作平台的支出
$dianzhu_juedui_shouru = $order['productmoney']+$order['dabaofei'] -($koudian +($order['manjian']*floatval($shopSet['manjian_chuzibili'])/100)+$order['zhekou'] + $order['hongbao'] + $order['shareMoney']);
if($dianzhu_juedui_shouru < 0 ){
$dianzhu_juedui_shouru = 0;
}
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$dianzhu_juedui_shouru),'desc'=>"店主订单({$order['id']})的绝对收入支出",'flag'=>98) );

//新增推荐店主收入支出。店主提成=平台提点收入($koudian)*每个店铺的比例
if($koudian>0 && $shopSet['dianzhu_ticheng']*1>0 && $user['recommend_id']*1>1 && $user['role_id']==2){
//划出平台账户
$ticheng = round(($koudian*$shopSet['dianzhu_ticheng']/100),2);
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$ticheng),'desc'=>"推荐者{$user['recommend_id']}提成(订单{$order['id']})¥{$ticheng},比例{$shopSet['dianzhu_ticheng']}%",'flag'=>666) );
//划入推荐者账户
$this->userAccountChange( array('user_id'=>$user['recommend_id'],'newYue'=>$ticheng,'desc'=>"{$shopSet['shopname']}提成(订单{$order['id']})¥{$ticheng},比例{$shopSet['dianzhu_ticheng']}%",'flag'=>666,'flag2'=>$user['id']) );
}

} 查看全部
/*支付处理金额流向
*费用字段:
+ dabaofei (打包费|餐盒费)
- manjian (满减)
- youhuiquan (优惠券,如果平台发放的,就平台出资,否则就是店主出资)
- zhekou (折扣)
+ psfei (自定义配送费用)
+ yunshufei (配送费)
+ productmoney (产品总价)
= orderamount (订单总价)

*店主活动费用:
- hongbao (下单红包)
- shareMoney (推荐返利金额)

** 如果新增了费用,需要修改此函数
*/

public function onlinepay_order_done_deal2(array $order){
$user = $this->_getOneBy("user","id",$order['user_id']);
$shopSet = $this->_getOneBy("shop_set","shopid",$order['shopid']);
//平台扣点金额,仅扣产品的,打包费不扣点
$koudian = round( (($order['productmoney'])*(floatval($user['dingdanTax'])/100)), 2 );
//店主收入=============================================
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>$order['productmoney'],'desc'=>"订单({$order['id']})产品入账",'flag'=>100) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>$order['dabaofei'],'desc'=>"订单({$order['id']})打包费入账",'flag'=>101) );
//店主的支出
=============================================
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$koudian),'desc'=>"订单({$order['id']})扣点支出",'flag'=>94) );


if( floatval($shopSet['manjian_chuzibili'])<0 || floatval($shopSet['manjian_chuzibili'])>100 ){
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['manjian']),'desc'=>"订单({$order['id']})满减优惠支出100%",'flag'=>98) );
}else{
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['manjian']*floatval($shopSet['manjian_chuzibili'])/100),'desc'=>"订单({$order['id']})满减优惠支出{$shopSet['manjian_chuzibili']}%",'flag'=>98) );
}

$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['zhekou']),'desc'=>"订单({$order['id']})折扣优惠支出",'flag'=>97) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['hongbao']),'desc'=>"订单({$order['id']})红包返利支出",'flag'=>96) );
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['shareMoney']),'desc'=>"订单({$order['id']})推荐返利支出",'flag'=>95) );


//平台的收入============================================

$this->userAccountChange( array('user_id'=>1,'newYue'=>-1*$order['psfei'],'desc'=>"订单({$order['id']})自定义配送费划出",'flag'=>102) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>-1*$order['yunshufei'],'desc'=>"订单({$order['id']})配送费划出",'flag'=>103) );


$this->userAccountChange( array('user_id'=>1,'newYue'=>$order['psfei'],'desc'=>"订单({$order['id']})自定义配送费入账",'flag'=>102) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>$order['yunshufei'],'desc'=>"订单({$order['id']})配送费入账",'flag'=>103) );
$this->userAccountChange( array('user_id'=>1,'newYue'=>$koudian,'desc'=>"订单({$order['id']})扣点收入",'flag'=>103) );
//平台的支出=============================================

if($order['coupon_id']>0){
//店主添加的优惠券由店主自己出资
$couponOrder = $this->_getOneBy("admin_coupon_order","id",$order['coupon_id']);
$coupon = $this->_getOneBy("admin_coupon","id",$couponOrder['coupon_id']);
if($coupon['user_id']>1){
$this->userAccountChange( array('user_id'=>$order['user_id'],'newYue'=>(0-$order['youhuiquan']),'desc'=>"订单({$order['id']})优惠券支出",'flag'=>99) );
}else{
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$order['youhuiquan']),'desc'=>"订单({$order['id']})折扣券支出",'flag'=>99) );
}

}else{

//这里平台承担一部分,店主承担一部分
$shoujian_bili_pt = floatval($user['shoujianTax'])/100;//平台出资比例
$shoujian_bili_dz = 1-$shoujian_bili_pt;//店主出资比例
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-($order['youhuiquan']*$shoujian_bili_pt)),'desc'=>"订单({$order['id']})首单减优惠支出{$user['shoujianTax']}%",'flag'=>99) );
$shoujian_bili_dz_percent = $shoujian_bili_dz*100;
$this->userAccountChange( array('user_id'=>$user['id'],'newYue'=>(0-($order['youhuiquan']*$shoujian_bili_dz)),'desc'=>"订单({$order['id']})首单减优惠支出{$shoujian_bili_dz_percent}%",'flag'=>99) );

}

if( floatval($shopSet['manjian_chuzibili'])<0 || floatval($shopSet['manjian_chuzibili'])>100 ){
//平台不出资
}else{
$chuzibili = 100-$shopSet['manjian_chuzibili'];
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$order['manjian']*(100-floatval($shopSet['manjian_chuzibili']))/100),'desc'=>"订单({$order['id']})满减优惠支出{$chuzibili}",'flag'=>98) );
}


//计算店主的收入+支出的和。算作平台的支出
$dianzhu_juedui_shouru = $order['productmoney']+$order['dabaofei'] -($koudian +($order['manjian']*floatval($shopSet['manjian_chuzibili'])/100)+$order['zhekou'] + $order['hongbao'] + $order['shareMoney']);
if($dianzhu_juedui_shouru < 0 ){
$dianzhu_juedui_shouru = 0;
}
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$dianzhu_juedui_shouru),'desc'=>"店主订单({$order['id']})的绝对收入支出",'flag'=>98) );

//新增推荐店主收入支出。店主提成=平台提点收入($koudian)*每个店铺的比例
if($koudian>0 && $shopSet['dianzhu_ticheng']*1>0 && $user['recommend_id']*1>1 && $user['role_id']==2){
//划出平台账户
$ticheng = round(($koudian*$shopSet['dianzhu_ticheng']/100),2);
$this->userAccountChange( array('user_id'=>1,'newYue'=>(0-$ticheng),'desc'=>"推荐者{$user['recommend_id']}提成(订单{$order['id']})¥{$ticheng},比例{$shopSet['dianzhu_ticheng']}%",'flag'=>666) );
//划入推荐者账户
$this->userAccountChange( array('user_id'=>$user['recommend_id'],'newYue'=>$ticheng,'desc'=>"{$shopSet['shopname']}提成(订单{$order['id']})¥{$ticheng},比例{$shopSet['dianzhu_ticheng']}%",'flag'=>666,'flag2'=>$user['id']) );
}

}