1.本地生活支付添加备注

This commit is contained in:
xucong 2024-09-19 22:55:27 +08:00
parent 906d2894e0
commit 07d0888f23
2 changed files with 23 additions and 17 deletions

@ -700,7 +700,9 @@ class PayLogic extends Logic
$dt['user_id'] = $user_id;
$dt['order_no'] = $out_trade_no;
$dt['pay_shop_type'] = 1;
$dt['remark'] = $post['remark'];
if( isset($post['remark'])){
$dt['remark'] = $post['remark'];
}
$r = Db::name("local_store_order")->save($dt);
// 基本户 5%
$dt1['lstore_id'] = $post['lid'];
@ -756,18 +758,6 @@ class PayLogic extends Logic
return JsonServer::success('微信支付发起成功', $res, 1);
}
public function cancelPay($post){
$sku_num_msg = Db::name("local_store_goods_item")
->where("id",$post['spec_item_id'])
->find();
if($sku_num_msg['stock'] < $post['buy_shop_num']){
return JsonServer::error('库存不足');
}
$sku_num_msg = Db::name("local_store_goods_item")
->where("id",$post['spec_item_id'])
->dec("stock",$post['buy_shop_num'])
->update();
}
// 本地生活余额支付
public static function localBalance($user_id,$post){
$user_balance = User::where(['id' => $user_id])->value('user_money');
@ -840,7 +830,10 @@ class PayLogic extends Logic
$dt['user_id'] = $user_id;
$dt['pay_shop_type'] = 1;
$dt['state'] = 1;
$dt['remark'] = $post['remark'];
if( isset($post['remark'])){
$dt['remark'] = $post['remark'];
}
$dt['order_no'] = $local_store_order_no;
$r = Db::name("local_store_order")->save($dt);
if (!$r) {

@ -252,7 +252,8 @@ class PayNotifyLogic
$order['lstore_id']= $result['local_id'];
$r = Db::name("local_pay")->where("id",$result['id'])->update($d);
}
$order['id']= 0;
$order['id']= $result['id'];
$order['type']= 4;
$order['order_amount']= $result['order_amount'];
$order['order_sn']= $order_sn;
$type = "local_pay";
@ -407,13 +408,15 @@ class PayNotifyLogic
$user->user_growth = ['inc', $order['give_growth']];
$user->total_recharge_amount = ['inc', $total_money];
$user->save();
$remark = "余额充值";
//记录余额
$total_money > 0 && AccountLogLogic::AccountRecord($user->id, $total_money, 1, AccountLog::recharge_money, '', $order['id'], $order_sn);
$total_money > 0 && AccountLogLogic::AccountRecord($user->id, $total_money, 1, AccountLog::recharge_money, $remark, $order['id'], $order_sn);
//记录积分
$total_integral > 0 && AccountLogLogic::AccountRecord($user->id, $total_integral, 1, AccountLog::recharge_give_integral);
//记录成长值
$order['give_growth'] > 0 && AccountLogLogic::AccountRecord($user->id, $order['give_growth'], 1, AccountLog::recharge_give_growth);
$type = "balance_rechange";
$order['type'] = 2;
// 余额充值参与百亿补贴
self::recharge_billions($order, $order['user_id'],$type);
}
@ -422,6 +425,16 @@ class PayNotifyLogic
private static function recharge_billions($order, $user_id,$type="")
{
if(isset($order['id'])){
$check_order = Db::name("user_billions")
->where("order_id",$order['id'])
->where("type",$order['type'])
->find();
if($check_order != null){
return true;
}
}
$user_subsidy = 2; // 自我补贴
$all_user_subsidy = 20; //全用户获取的比例
$user_start_num = 1; // 补贴前几位数量
@ -443,7 +456,7 @@ class PayNotifyLogic
$data['goods_num'] = 1; // 充值接口设置为1
$data['order_id'] = $order['id'];
$data['dtime'] = date("Y-m-d H:i:s");
$data['type'] = 2; // 类型是充值
$data['type'] = $order['type']; // 类型是充值
$data['subsidy_price'] = round($order['order_amount'] * $user_subsidy / 100,8);
$res = Db::name("user_billions")->save($data);
$subsidy = $order['order_amount'] * $all_user_subsidy / 100;