Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
ef7f100767
@ -46,7 +46,7 @@ class CommissionLogic extends BaseLogic
|
||||
*/
|
||||
public static function setCook($order, $village_uid = 0, $brigade_uid = 0, $transaction_id = 0)
|
||||
{
|
||||
$user_1 = self::user($order, 0.07, $transaction_id, 0, 12); //会员、厨师
|
||||
$user_1 = self::user($order, 0.07, $transaction_id, $order['spread_uid'], 12); //会员、厨师
|
||||
$user_2 = self::user($order, 0.01, $transaction_id, $village_uid, 14); //村长
|
||||
$user_3 = self::user($order, 0.01, $transaction_id, $brigade_uid, 15); //队长
|
||||
|
||||
|
@ -141,7 +141,7 @@ class PayNotifyLogic extends BaseLogic
|
||||
$sing[] = [
|
||||
'uid' => $order['uid'],
|
||||
'order_id' => $order['order_id'],
|
||||
// 'title' => '订单扣除兑换券',
|
||||
// 'title' => '订单扣除兑换券',
|
||||
'title' => 5,
|
||||
'financial_pm' => 0,
|
||||
'store_id' => $order['store_id'],
|
||||
@ -427,22 +427,22 @@ class PayNotifyLogic extends BaseLogic
|
||||
$orderRe->refund_time = time();
|
||||
$orderRe->remarks = '';
|
||||
$orderRe->save();
|
||||
$purchase_funds = User::where('id',$orderRe['uid'])->value('purchase_funds');
|
||||
$user = User::where('id',$orderRe['uid'])->find();
|
||||
$purchase_funds = User::where('id', $orderRe['uid'])->value('purchase_funds');
|
||||
$user = User::where('id', $orderRe['uid'])->find();
|
||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||
if($purchase_funds >= $orderRe['price']){
|
||||
User::where('id',$orderRe['uid'])->dec('purchase_funds',$orderRe['refund_price'])->update();
|
||||
if ($purchase_funds >= $orderRe['price']) {
|
||||
User::where('id', $orderRe['uid'])->dec('purchase_funds', $orderRe['refund_price'])->update();
|
||||
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $orderRe['id'], $orderRe['refund_price'], '', 1, $orderRe['store_id']);
|
||||
}else{
|
||||
User::where('id',$orderRe['uid'])->dec('purchase_funds',$purchase_funds)->update();
|
||||
} else {
|
||||
User::where('id', $orderRe['uid'])->dec('purchase_funds', $purchase_funds)->update();
|
||||
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $orderRe['id'], $purchase_funds, '', 1, $orderRe['store_id']);
|
||||
}
|
||||
//退还 充值得兑换券
|
||||
self::addNewUserSing($orderRe,3,$orderRe->refund_price);//冻结
|
||||
self::addNewUserSing($orderRe, 3, $orderRe->refund_price); //冻结
|
||||
|
||||
self::addNewUserSing($orderRe,6,$orderRe->refund_price,0,1);//解冻
|
||||
self::addNewUserSing($orderRe, 6, $orderRe->refund_price, 0, 1); //解冻
|
||||
self::descUserSing($orderRe);
|
||||
// d($purchase_funds,$orderRe['refund_price'],$orderRe);
|
||||
// d($purchase_funds,$orderRe['refund_price'],$orderRe);
|
||||
return true;
|
||||
}
|
||||
$order->status = OrderEnum::REFUND_PAY;
|
||||
@ -476,16 +476,16 @@ class PayNotifyLogic extends BaseLogic
|
||||
}
|
||||
if ($check_user_sing) {
|
||||
//退还 兑换券
|
||||
self::addNewUserSing($order,3,$order->refund_price);//冻结
|
||||
self::addNewUserSing($order,6,$order->refund_price,0,1);//解冻
|
||||
self::addNewUserSing($order, 3, $order->refund_price); //冻结
|
||||
self::addNewUserSing($order, 6, $order->refund_price, 0, 1); //解冻
|
||||
self::descUserSing($order);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//积分
|
||||
if ($check_user_sing) {
|
||||
self::addNewUserSing($order,3,$order->refund_price);//冻结
|
||||
self::addNewUserSing($order,6,$order->refund_price,0,1);//解冻
|
||||
self::addNewUserSing($order, 3, $order->refund_price); //冻结
|
||||
self::addNewUserSing($order, 6, $order->refund_price, 0, 1); //解冻
|
||||
self::descUserSing($order);
|
||||
}
|
||||
//微信日志 user_order_refund
|
||||
@ -507,14 +507,14 @@ class PayNotifyLogic extends BaseLogic
|
||||
* @type $type //类型 0冻结 1解冻
|
||||
* @return true
|
||||
*/
|
||||
public static function addNewUserSing($order, $category, $number, int $pm=0, $type=0)
|
||||
public static function addNewUserSing($order, $category, $number, int $pm = 0, $type = 0)
|
||||
{
|
||||
$user_sing = new UserSign();
|
||||
$sing = [
|
||||
'uid' => $order['uid'],
|
||||
'order_id' => $order['order_id'],
|
||||
// 'title' => '购买商品获得兑换券',
|
||||
// 'title' => PayNotifyLogic::getTitle($category,$number),
|
||||
// 'title' => '购买商品获得兑换券',
|
||||
// 'title' => PayNotifyLogic::getTitle($category,$number),
|
||||
'title' => $category,
|
||||
'financial_pm' => $pm,
|
||||
'store_id' => $order['store_id'],
|
||||
@ -531,23 +531,23 @@ class PayNotifyLogic extends BaseLogic
|
||||
//退积分-->订单
|
||||
public static function descUserSing($order)
|
||||
{
|
||||
// $user_sing = new UserSign();
|
||||
// $user_sing = new UserSign();
|
||||
if ($order['uid'] > 0) {
|
||||
$user_number = bcmul($order['refund_price'], '0.10', 2);
|
||||
// $sing = [
|
||||
// 'uid' => $order['uid'],
|
||||
// 'order_id' => $order['order_id'],
|
||||
// 'title' => '退款扣除兑换券',
|
||||
// 'financial_pm' => 0,
|
||||
// 'store_id' => $order['store_id'],
|
||||
// 'number' => $user_number,
|
||||
// ];
|
||||
// $user_sing->save($sing);
|
||||
// //删除之前获得的兑换券
|
||||
// UserSign::where([
|
||||
// 'order_id' => $order['order_id'],
|
||||
// 'financial_pm' => 1,
|
||||
// ])->update(['delete_time' => time()]);
|
||||
// $sing = [
|
||||
// 'uid' => $order['uid'],
|
||||
// 'order_id' => $order['order_id'],
|
||||
// 'title' => '退款扣除兑换券',
|
||||
// 'financial_pm' => 0,
|
||||
// 'store_id' => $order['store_id'],
|
||||
// 'number' => $user_number,
|
||||
// ];
|
||||
// $user_sing->save($sing);
|
||||
// //删除之前获得的兑换券
|
||||
// UserSign::where([
|
||||
// 'order_id' => $order['order_id'],
|
||||
// 'financial_pm' => 1,
|
||||
// ])->update(['delete_time' => time()]);
|
||||
|
||||
$now_int = User::where('id', $order['uid'])->withTrashed()->find();
|
||||
if ($now_int) {
|
||||
@ -646,12 +646,12 @@ class PayNotifyLogic extends BaseLogic
|
||||
$sing[] = [
|
||||
'uid' => $order['uid'],
|
||||
'order_id' => $order['order_id'],
|
||||
// 'title' => '充值获得冻结兑换券',
|
||||
// 'title' => self::getTitle(7,$total_vip),
|
||||
'title' =>7,
|
||||
// 'title' => '充值获得冻结兑换券',
|
||||
// 'title' => self::getTitle(7,$total_vip),
|
||||
'title' => 7,
|
||||
'financial_pm' => 1,
|
||||
'store_id' => $order['store_id'],
|
||||
// 'type' => 1,
|
||||
// 'type' => 1,
|
||||
'status' => 1,
|
||||
'number' => $total_vip,
|
||||
'back_num' => $total_vip,
|
||||
@ -660,8 +660,8 @@ class PayNotifyLogic extends BaseLogic
|
||||
$sing[] = [
|
||||
'uid' => $order['uid'],
|
||||
'order_id' => $order['order_id'],
|
||||
// 'title' => '充值获得冻结兑换券',
|
||||
// 'title' => self::getTitle(4,$total_vip),
|
||||
// 'title' => '充值获得冻结兑换券',
|
||||
// 'title' => self::getTitle(4,$total_vip),
|
||||
'title' => 4,
|
||||
'financial_pm' => 1,
|
||||
'store_id' => $order['store_id'],
|
||||
@ -845,15 +845,17 @@ class PayNotifyLogic extends BaseLogic
|
||||
$financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
|
||||
$financeLogic->out($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
|
||||
$financeLogic->save();
|
||||
$user_ship = User::where('id', $order['uid'])->value('user_ship');//会员不加兑换券
|
||||
if ($order['uid'] > 0 && $order['total_price'] >= 500
|
||||
&& $order['pay_type'] !=PayEnum::PURCHASE_FUNDS && $user_ship !=1) {
|
||||
$user_ship = User::where('id', $order['uid'])->value('user_ship'); //会员不加兑换券
|
||||
if (
|
||||
$order['uid'] > 0 && $order['total_price'] >= 500
|
||||
&& $order['pay_type'] != PayEnum::PURCHASE_FUNDS && $user_ship != 1
|
||||
) {
|
||||
$user_number = bcmul($order['pay_price'], '0.10', 2);
|
||||
$sing = [
|
||||
'uid' => $order['uid'],
|
||||
'order_id' => $order['order_id'],
|
||||
// 'title' => '购买商品获得兑换券',
|
||||
// 'title' => self::getTitle(1,$user_number),
|
||||
// 'title' => '购买商品获得兑换券',
|
||||
// 'title' => self::getTitle(1,$user_number),
|
||||
'title' => 1,
|
||||
'financial_pm' => 1,
|
||||
'store_id' => $order['store_id'],
|
||||
@ -893,21 +895,41 @@ class PayNotifyLogic extends BaseLogic
|
||||
}
|
||||
|
||||
}
|
||||
//查询用户对应的村长和队长
|
||||
$address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||
if ($arr1) {
|
||||
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
||||
}
|
||||
$arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
|
||||
if ($arr2) {
|
||||
$brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
|
||||
}
|
||||
}
|
||||
if ($order['spread_uid'] > 0 || $user_ship>0) {
|
||||
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');
|
||||
if ($user_ship == 2) {
|
||||
$village_uid = $order['spread_uid'];
|
||||
$address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
|
||||
if ($arr2) {
|
||||
$brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
|
||||
}
|
||||
}
|
||||
} elseif ($user_ship == 3) {
|
||||
$brigade_uid = $order['spread_uid'];
|
||||
$address = UserAddress::where(['uid' => $order['spread_uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||
if ($arr1) {
|
||||
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//查询用户对应的村长和队长
|
||||
$address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find();
|
||||
if ($address) {
|
||||
$arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
|
||||
if ($arr1) {
|
||||
$village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id') ?? 0;
|
||||
}
|
||||
$arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
|
||||
if ($arr2) {
|
||||
$brigade_uid = User::where('id', 'in', $arr2)->where('user_ship', 3)->value('id') ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch ($user_ship) {
|
||||
case 1: // 行业会员
|
||||
@ -1128,8 +1150,8 @@ class PayNotifyLogic extends BaseLogic
|
||||
public static function getTitle($category, $amount)
|
||||
{
|
||||
switch ($category) {
|
||||
/**冻结券**/
|
||||
//收入
|
||||
/**冻结券**/
|
||||
//收入
|
||||
case 1:
|
||||
return "购买商品{$amount}元获得冻结卷";
|
||||
case 7:
|
||||
@ -1139,11 +1161,11 @@ class PayNotifyLogic extends BaseLogic
|
||||
return "核销商品{$amount}元解冻冻结卷";
|
||||
case 3:
|
||||
return "退款{$amount}元扣除冻结卷";
|
||||
/**礼品券**/
|
||||
//收入
|
||||
/**礼品券**/
|
||||
//收入
|
||||
case 4:
|
||||
return "核销金额{$amount}元获得礼品卷";
|
||||
//支出
|
||||
//支出
|
||||
case 5:
|
||||
return "兑换{$amount}元商品扣除礼品卷";
|
||||
case 6:
|
||||
@ -1154,6 +1176,4 @@ class PayNotifyLogic extends BaseLogic
|
||||
return "订单支付{$amount}元";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user