Files
yusheng-php/application/api/controller/Xxiaoshi.php

54 lines
1.3 KiB
PHP
Raw Normal View History

2025-10-20 10:02:41 +08:00
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Log;
use app\common\controller\Push;
2026-01-09 10:30:45 +08:00
class Xxiaoshi extends Controllers
2025-10-20 10:02:41 +08:00
{
public function test()
2025-10-20 10:02:41 +08:00
{
$res = db::name('user_zone')->where(['is_delete'=> 2,'delete_time'=> ['<>', 0]])->select();
if($res){
foreach ($res as $v){
//删除动态下的标签引用
$top_zone = db::name('user_zone_topic')->where('zone_id',$v['id'])->select();
if($top_zone){
foreach ($top_zone as $vs){
db::name('user_zone_topic')->where('id',$vs['id'])->delete();
2025-10-20 10:02:41 +08:00
}
}
}
}
}
2025-12-29 12:39:04 +08:00
//测试数据
public function testData()
{
$res = db::name('vs_user_gift_pack')
->field('gid,after_num')
2025-12-29 12:51:51 +08:00
->where(['a.updatetime'=> ['<=', 1766332800]])
->group('a.gid')
2025-12-29 12:50:45 +08:00
->select();
2025-12-29 12:39:04 +08:00
$total_price = 0;
if($res){
foreach ($res as $v){
$gft_price = db::name('vs_gift')->where('gid',$v['gid'])->value('gift_price');
$total_price += $gft_price * $v['after_num'];
}
}
echo $total_price;
2025-12-29 12:40:10 +08:00
echo '<br>';
var_dump($res);
2025-12-29 12:39:04 +08:00
}
2026-01-08 17:52:28 +08:00
2026-01-16 09:07:31 +08:00
2025-10-20 10:02:41 +08:00
}