mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-03-03 16:37:04 +00:00
commit
48be787903
@ -131,7 +131,7 @@ class User extends ModelBasic
|
||||
if($storeBrokerageStatu == 1){
|
||||
if(!User::be(['uid'=>$userInfoTwo['spread_uid'],'is_promoter'=>1])) return true;
|
||||
}
|
||||
$brokerageRatio = (SystemConfigService::get('store_brokerage_ratio_two') ?: 0)/100;
|
||||
$brokerageRatio = (SystemConfigService::get('store_brokerage_two') ?: 0)/100;
|
||||
if($brokerageRatio <= 0) return true;
|
||||
$cost = isset($orderInfo['cost']) ? $orderInfo['cost'] : 0;//成本价
|
||||
if($cost > $orderInfo['pay_price']) return true;//成本价大于支付价格时直接返回
|
||||
|
||||
@ -110,6 +110,29 @@ class User extends ModelBasic
|
||||
$res2 = self::bcInc($userInfo['spread_uid'],'now_money',$brokeragePrice,'uid');
|
||||
$res = $res1 && $res2;
|
||||
self::checkTrans($res);
|
||||
if(res) self::backOrderBrokerageTwo($orderInfo);
|
||||
return $res;
|
||||
}
|
||||
public static function backOrderBrokerageTwo($orderInfo){
|
||||
$userInfo = User::getUserInfo($orderInfo['uid']);
|
||||
$userInfoTwo = User::getUserInfo($userInfo['spread_uid']);
|
||||
if(!$userInfoTwo || !$userInfoTwo['spread_uid']) return true;
|
||||
$storeBrokerageStatu = SystemConfigService::get('store_brokerage_statu') ? : 1;//获取后台分销类型
|
||||
if($storeBrokerageStatu == 1){
|
||||
if(!User::be(['uid'=>$userInfoTwo['spread_uid'],'is_promoter'=>1])) return true;
|
||||
}
|
||||
$brokerageRatio = (SystemConfigService::get('store_brokerage_ratio_two') ?: 0)/100;
|
||||
if($brokerageRatio <= 0) return true;
|
||||
$cost = isset($orderInfo['cost']) ? $orderInfo['cost'] : 0;//成本价
|
||||
if($cost > $orderInfo['pay_price']) return true;//成本价大于支付价格时直接返回
|
||||
$brokeragePrice = bcmul(bcsub($orderInfo['pay_price'],$cost,2),$brokerageRatio,2);
|
||||
if($brokeragePrice <= 0) return true;
|
||||
$mark = '二级推广人'.$userInfo['nickname'].'成功消费'.floatval($orderInfo['pay_price']).'元,奖励推广佣金'.floatval($brokeragePrice);
|
||||
self::beginTrans();
|
||||
$res1 = UserBill::income('获得推广佣金',$userInfoTwo['spread_uid'],'now_money','brokerage',$brokeragePrice,$orderInfo['id'],0,$mark);
|
||||
$res2 = self::bcInc($userInfoTwo['spread_uid'],'now_money',$brokeragePrice,'uid');
|
||||
$res = $res1 && $res2;
|
||||
self::checkTrans($res);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
@ -65,13 +65,13 @@ class RoutineService{
|
||||
$array = self::xml($xml);//全要大写
|
||||
if($array['RETURN_CODE'] == 'SUCCESS' && $array['RESULT_CODE'] == 'SUCCESS'){
|
||||
$time = time();
|
||||
$tmp='';//临时数组用于签名
|
||||
$tmp=array();//临时数组用于签名
|
||||
$tmp['appId'] = $appid;
|
||||
$tmp['nonceStr'] = $nonce_str;
|
||||
$tmp['package'] = 'prepay_id='.$array['PREPAY_ID'];
|
||||
$tmp['signType'] = 'MD5';
|
||||
$tmp['timeStamp'] = "$time";
|
||||
|
||||
$data=array();
|
||||
$data['state'] = 1;
|
||||
$data['timeStamp'] = "$time";//时间戳
|
||||
$data['nonceStr'] = $nonce_str;//随机字符串
|
||||
@ -80,6 +80,7 @@ class RoutineService{
|
||||
$data['paySign'] = self::sign($tmp);//签名,具体签名方案参见微信公众号支付帮助文档;
|
||||
$data['out_trade_no'] = $out_trade_no;
|
||||
}else{
|
||||
$data=array();
|
||||
$data['state'] = 0;
|
||||
$data['text'] = "错误";
|
||||
$data['RETURN_CODE'] = $array['RETURN_CODE'];
|
||||
|
||||
@ -630,7 +630,7 @@ CREATE TABLE `eb_store_product` (
|
||||
`id` mediumint(11) NOT NULL AUTO_INCREMENT COMMENT '商品id',
|
||||
`mer_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)',
|
||||
`image` varchar(128) NOT NULL COMMENT '商品图片',
|
||||
`slider_image` varchar(512) NOT NULL COMMENT '轮播图',
|
||||
`slider_image` text NOT NULL COMMENT '轮播图',
|
||||
`store_name` varchar(128) NOT NULL COMMENT '商品名称',
|
||||
`store_info` varchar(256) NOT NULL COMMENT '商品简介',
|
||||
`keyword` varchar(256) NOT NULL COMMENT '关键字',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user