Files
yusheng-php/application/api/controller/Xxiaoshi.php
2025-12-29 12:44:49 +08:00

52 lines
1.4 KiB
PHP

<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Log;
use app\common\controller\Push;
class Xxiaoshi extends Controller
{
public function test()
{
$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();
}
}
}
}
}
//测试数据
public function testData()
{
$res = db::name('vs_user_gift_pack_log')->alias('a')
->join('user b','a.user_id = b.id')
->field('a.gid,b.nickname,a.user_id,a.gid,a.after_num')
// ->where(['a.updatetime'=> ['<=', 1766332800]])
->group('a.user_id')->select();
$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;
echo '<br>';
var_dump($res);
}
}