1.本地生活二维码支付相关改动

This commit is contained in:
xucong 2024-08-26 16:23:09 +08:00
parent 585a57c19e
commit 26c9f6ecdd
4 changed files with 50 additions and 8 deletions

@ -271,7 +271,7 @@ class User extends Api
// and b.store_state = 1 group by a.first_leader";
// $count = Db::query($sql);
// $count = $count[0]['cont'];
$count = $local_count = Db::name("local_store")
$count = $local_count = Db::name("local_store")
->alias("a")
->join("user b","a.user_id = b.id","left")
->where("b.first_leader",$user_id)

@ -23,6 +23,7 @@ class LocalStoreLogic extends Logic
$count = $model->where('is_delete',0)
->where($s1)
->where("store_state",1)
->where("shopLogo is not null")
->count();
// $lists = $model->where('is_delete',0)
@ -35,7 +36,7 @@ class LocalStoreLogic extends Logic
// $sql = "SELECT *, ST_Distance_Sphere(POINT(".$data['longitude'].",".$data['latitude']."),POINT(longitude, latitude)) AS distance
// FROM ls_local_store where is_delete = 0 $s
// ORDER BY distance limit $page,$size";
$sql = "SELECT * FROM ls_local_store where is_delete = 0 and shopLogo is not null $s ORDER BY lstore_id asc limit ".$page.",".$size;
$sql = "SELECT * FROM ls_local_store where is_delete = 0 and store_state = 1 and shopLogo is not null $s ORDER BY lstore_id asc limit ".$page.",".$size;
// var_dump($sql);
$lists = Db::query($sql);
foreach($lists as $key=>$value){

@ -682,7 +682,7 @@ class PayLogic extends Logic
$dt['lstore_id'] = $post['lid'];
$dt['payment_type'] = $company['bankType'];
$dt['total_amount'] = $post['money'];
$dt['account_name'] = $company['store_nickname'];
$dt['account_name'] = $company['shopName'];
$dt['bank_name'] = $company['bankName'];
$dt['bank_card'] = $company['bankCard'];
$dt['large_number'] = $company['largeNumber'];
@ -690,6 +690,7 @@ class PayLogic extends Logic
$dt['create_time'] = date("Y-m-d H:i:s");
$dt['user_id'] = $user_id;
$dt['order_no'] = $out_trade_no;
$dt['pay_shop_type'] = 1;
$r = Db::name("local_store_order")->save($dt);
// 基本户 5%
$dt1['lstore_id'] = $post['lid'];
@ -722,7 +723,8 @@ class PayLogic extends Logic
$dt3['payment_type'] = 1;
$dt3['account_name'] = "东龙汇";
$dt3['bank_name'] = "中国工商银行";
$dt3['bank_card'] = "1204064419000115357";
// $dt3['bank_card'] = "1204064419000115357";
$dt3['bank_card'] = "1204068809100138961";
$dt3['large_number'] = "102335006448";
$dt3['separate_account'] = round($post['money']*0.1,2);
$dt3['create_time'] = date("Y-m-d H:i:s");
@ -784,13 +786,12 @@ class PayLogic extends Logic
'remark' => '本地商家支付佣金增加'
]);
}
}
$company = Db::name("local_store")->where("lstore_id",$post['lid'])->where("is_delete",0)->find();
$dt['lstore_id'] = $post['lid'];
$dt['payment_type'] = $company['bankType'];
$dt['account_name'] = $company['store_nickname'];
$dt['account_name'] = $company['shopName'];
$dt['bank_name'] = $company['bankName'];
$dt['bank_card'] = $company['bankCard'];
$dt['total_amount'] = $post['money'];
@ -844,7 +845,8 @@ class PayLogic extends Logic
$dt3['payment_type'] = 1;
$dt3['account_name'] = "东龙汇";
$dt3['bank_name'] = "中国工商银行";
$dt3['bank_card'] = "1204064419000115357";
// $dt3['bank_card'] = "1204064419000115357";
$dt3['bank_card'] = "1204068809100138961";
$dt3['large_number'] = "102335006448";
$dt3['separate_account'] = round($post['money']*0.1,2);
$dt3['create_time'] = date("Y-m-d H:i:s");

@ -235,6 +235,7 @@ class PayNotifyLogic
if($result != null){
$d['pay_time'] = date("Y-m-d H:i:s");
$d['pay_status'] = 1;
$order['lstore_id']= $result['local_id'];
$r = Db::name("local_pay")->where("id",$result['id'])->update($d);
}
$order['id']= 0;
@ -705,9 +706,47 @@ class PayNotifyLogic
// END
// WHERE billions_id IN ($billion_arr_id)";
// $query = Db::query($sql);
// 本地生活微信支付 推广商家收益
if(isset($order['lstore_id'])){
$local_msg = Db::name("local_store")
->where("lstore_id",$order['lstore_id'])
->where("is_delete",0)
->where("store_state",1)
->find();
if($local_msg != null){
$local_first_leader = Db::name("user")
->where("id",$local_msg['user_id'])
->where("del",0)
->where("disable",0)
->find();
if($local_first_leader != null){
if($local_first_leader['first_leader']!=0){
$is_local_d = Distribution::where('user_id', $local_first_leader['first_leader'] )->where('is_distribution', 1 )->find();
if($is_local_d!=null){
$local_earnings = round($order['order_amount']*$store_subsidy/100,2);
User::where('id', $local_first_leader['first_leader'])
->inc('earnings', $local_earnings)->update();
$local_earnings_buy = AccountLog::where('user_id', $local_first_leader['first_leader'])->order("create_time desc")->limit(1)->value('left_amount');
$sn = createSn('account_log', 'log_sn', '', 4);
AccountLog::create([
'log_sn' => $sn,
'user_id' => $local_first_leader['first_leader'],
'source_type' => AccountLog::local_inc_earnings, //todo 改为充值类型
'source_id' => 0, //todo 改为充值订单主键
'source_sn' => 0, // todo 改为充值订单编号
'change_amount' => $local_earnings,
'left_amount' => $local_earnings_buy + $local_earnings,
'change_type' => 1,
'remark' => '本地商家支付佣金增加'
]);
}
}
}
}
}
if($is_d!=null){
if($user['first_leader']>0){
$first_leader_percent = round($order['order_amount'] * $first_leader / 100, 8);
$first_leader_percent = round($order['order_amount'] * $first_leader / 100, 2);
// Order::where('id', $order['id'])
// ->inc('distribution_money',$first_leader_percent)->update();
UserDistribution::where('user_id', $user['first_leader'])