feat: 添加'开通时间'字段到用户列表,修改线下分润、支付通知等逻辑
This commit is contained in:
parent
eae37a1142
commit
99dc835cb1
app
@ -150,7 +150,8 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS
|
|||||||
'store_name' => '门店',
|
'store_name' => '门店',
|
||||||
'total_recharge_amount' => '累计消费',
|
'total_recharge_amount' => '累计消费',
|
||||||
'purchase_funds' => '采购款',
|
'purchase_funds' => '采购款',
|
||||||
'format_address'=>'地址'
|
'format_address'=>'地址',
|
||||||
|
'vip_time'=>'开通时间'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -64,14 +64,21 @@ class CommissionLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 走线下分润
|
* 零售分润
|
||||||
*/
|
*/
|
||||||
public static function setStore($order, $transaction_id = 0)
|
public static function setStore($order, $village_uid = 0, $brigade_uid = 0, $transaction_id = 0)
|
||||||
{
|
{
|
||||||
|
if($order['spread_uid']<=0){
|
||||||
|
$uid=$order['uid'];
|
||||||
|
}else{
|
||||||
|
$uid=$order['spread_uid'];
|
||||||
|
}
|
||||||
|
self::user($order, 0, $transaction_id, $uid, 12); //会员、厨师
|
||||||
|
self::user($order, 5, $transaction_id, $uid, 12); //会员、厨师
|
||||||
|
self::user($order, 3, $transaction_id, $village_uid, 14); //村长
|
||||||
|
self::user($order, 4, $transaction_id, $brigade_uid, 15); //队长
|
||||||
self::platform($order, 2, $transaction_id); //平台
|
self::platform($order, 2, $transaction_id); //平台
|
||||||
self::store($order, 1, $transaction_id, 0); //门店
|
self::store($order, 1, $transaction_id, 0); //门店
|
||||||
// $attrition = self::attrition($order, 0.01, $transaction_id, 16); //损耗
|
|
||||||
// $moeny = bcadd($platform, $store, 2);
|
|
||||||
self::suppliter($order, $transaction_id);
|
self::suppliter($order, $transaction_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
];
|
];
|
||||||
self::dealGoodsLeft($checkArr, $order['uid'], $order['id']);
|
self::dealGoodsLeft($checkArr, $order['uid'], $order['id']);
|
||||||
}
|
}
|
||||||
if ($order && $order['store_id'] && $order['reservation'] !=1 && $order['source']==1) {
|
if ($order && $order['store_id'] && $order['reservation'] != 1 && $order['source'] == 1) {
|
||||||
$params = [
|
$params = [
|
||||||
'verify_code' => $order['verify_code'],
|
'verify_code' => $order['verify_code'],
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
@ -112,7 +112,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
];
|
];
|
||||||
OrderLogic::writeOff($params);
|
OrderLogic::writeOff($params);
|
||||||
}
|
}
|
||||||
if(in_array($order['shipping_type'],[1,2])){
|
if (in_array($order['shipping_type'], [1, 2])) {
|
||||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -209,7 +209,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
// }
|
// }
|
||||||
// self::addUserSing($order);
|
// self::addUserSing($order);
|
||||||
self::afterPay($order);
|
self::afterPay($order);
|
||||||
if ($order && $order['store_id'] && $order['reservation'] !=1 && $order['source']==1) {
|
if ($order && $order['store_id'] && $order['reservation'] != 1 && $order['source'] == 1) {
|
||||||
$params = [
|
$params = [
|
||||||
'verify_code' => $order['verify_code'],
|
'verify_code' => $order['verify_code'],
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
@ -227,7 +227,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
||||||
if(in_array($order['shipping_type'],[1,2])){
|
if (in_array($order['shipping_type'], [1, 2])) {
|
||||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,7 +434,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$uid = $order->uid;
|
$uid = $order->uid;
|
||||||
$user = User::where('id', $uid)->findOrEmpty();
|
$user = User::where('id', $uid)->findOrEmpty();
|
||||||
//check store_id
|
//check store_id
|
||||||
if($user->store_id==0){
|
if ($user->store_id == 0) {
|
||||||
$user->store_id = $order['store_id'];
|
$user->store_id = $order['store_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
|
|
||||||
//更新等级
|
//更新等级
|
||||||
$user->user_ship = $order['user_ship'];
|
$user->user_ship = $order['user_ship'];
|
||||||
if($user['vip_time']==null){
|
if ($user['vip_time'] == null) {
|
||||||
$user->vip_time = time();
|
$user->vip_time = time();
|
||||||
}
|
}
|
||||||
$user->purchase_funds = bcadd($user->purchase_funds, $price, 2);
|
$user->purchase_funds = bcadd($user->purchase_funds, $price, 2);
|
||||||
@ -483,7 +483,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$order->paid = 1;
|
$order->paid = 1;
|
||||||
$order->pay_time = time();
|
$order->pay_time = time();
|
||||||
$order->status = 2;
|
$order->status = 2;
|
||||||
if ($order['reservation'] ==1) {
|
if ($order['reservation'] == 1) {
|
||||||
$order->status = 1;
|
$order->status = 1;
|
||||||
}
|
}
|
||||||
if (!$order->save()) {
|
if (!$order->save()) {
|
||||||
@ -497,7 +497,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$cashFlowLogic->insert($order['store_id'], $order['pay_price']);
|
$cashFlowLogic->insert($order['store_id'], $order['pay_price']);
|
||||||
self::dealProductLog($order);
|
self::dealProductLog($order);
|
||||||
|
|
||||||
if ($order && $order['store_id'] && $order['reservation'] !=1) {
|
if ($order && $order['store_id'] && $order['reservation'] != 1) {
|
||||||
$params = [
|
$params = [
|
||||||
'verify_code' => $order['verify_code'],
|
'verify_code' => $order['verify_code'],
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
@ -576,10 +576,9 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
//用户下单该用户等级为1得时候才处理冻结金额
|
//用户下单该用户等级为1得时候才处理冻结金额
|
||||||
$user = User::where('id', $order['uid'])->find();
|
$user = User::where('id', $order['uid'])->find();
|
||||||
$user_ship = $user['user_ship'];
|
$user_ship = $user['user_ship'];
|
||||||
|
|
||||||
}
|
}
|
||||||
//积分写入
|
//积分写入
|
||||||
if(isset($user) && $user['user_ship']==0){
|
if (isset($user) && $user['user_ship'] == 0) {
|
||||||
UserSignLogic::OrderWrite($order);
|
UserSignLogic::OrderWrite($order);
|
||||||
}
|
}
|
||||||
if ($off_activity == 1) {
|
if ($off_activity == 1) {
|
||||||
@ -597,7 +596,6 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
// if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY && $off_activity !=1) {
|
// if ($user_ship>0 && $order['pay_type'] != PayEnum::CASH_PAY && $off_activity !=1) {
|
||||||
// $order['dealVipAmount']= self::dealVipAmount($order, $order['pay_type']);
|
// $order['dealVipAmount']= self::dealVipAmount($order, $order['pay_type']);
|
||||||
// }
|
// }
|
||||||
if ($order['spread_uid'] > 0 || $user_ship > 0) {
|
|
||||||
if ($order['spread_uid'] > 0 && $user_ship == 0) {
|
if ($order['spread_uid'] > 0 && $user_ship == 0) {
|
||||||
$user_ship = User::where('id', $order['spread_uid'])->value('user_ship');
|
$user_ship = User::where('id', $order['spread_uid'])->value('user_ship');
|
||||||
if ($user_ship == 2) {
|
if ($user_ship == 2) {
|
||||||
@ -618,7 +616,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
|
$address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
|
||||||
if ($address) {
|
if ($address) {
|
||||||
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||||
@ -645,10 +643,10 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$info = StoreOrderCartInfo::where('oid',$order['id'])->field('store_id,product_id,cart_num')->select();
|
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select();
|
||||||
$comm=new CommissionProductLogic();
|
$comm = new CommissionProductLogic();
|
||||||
foreach ($info as $v) {
|
foreach ($info as $v) {
|
||||||
$comm->calculate_product_flow($v,$order['id'],$order['store_id'],$v['product_id'],$village_uid,$brigade_uid,$order['uid'],$order['spread_uid']);
|
$comm->calculate_product_flow($v, $order['id'], $order['store_id'], $v['product_id'], $village_uid, $brigade_uid, $order['uid'], $order['spread_uid']);
|
||||||
}
|
}
|
||||||
switch ($user_ship) {
|
switch ($user_ship) {
|
||||||
case 1: // 厨师
|
case 1: // 厨师
|
||||||
@ -666,12 +664,9 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
CommissionLogic::setBrigade($order, $village_uid, $brigade_uid, $transaction_id);
|
CommissionLogic::setBrigade($order, $village_uid, $brigade_uid, $transaction_id);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CommissionLogic::setStore($order, $transaction_id);
|
CommissionLogic::setStore($order,$village_uid, $brigade_uid, $transaction_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
CommissionLogic::setStore($order, $transaction_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user