From 6f43c6d4acde5836ae0cdd867f8c91e2011d86c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Sat, 22 Nov 2025 19:01:20 +0800 Subject: [PATCH] =?UTF-8?q?cp=20=E7=AD=89=E7=BA=A7=E5=8D=87=E7=BA=A7=20?= =?UTF-8?q?=E8=A3=85=E6=89=AE=E6=8C=82=E4=BB=B6=E5=92=8C=E7=89=B9=E6=95=88?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/UserCp.php | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/application/api/model/UserCp.php b/application/api/model/UserCp.php index ff72baf..4730822 100644 --- a/application/api/model/UserCp.php +++ b/application/api/model/UserCp.php @@ -248,20 +248,23 @@ class UserCp extends Model //添加一个记录 $pendant = db::name('vs_decorate_price')->where('id',$level['pendant_id'])->field('did,day')->find(); - $pendant_title = '装扮-'.$pendant['day'].'天-'.db::name('vs_decorate')->where('did',$pendant['did'])->value('title'); - $datas = [ - 'room_id' => $room_id, - 'from_user_id' => $from_user_id, - 'to_user_id' => $to_user_id, - 'gift_id' => 0, - 'num' => 0, - 'cp_zone_id' => $cp_zone_id, - 'exp' => 0, - 'exp_total' => 0, - 'remark' => '我们等级达到了'.$level['level'].'级,获得奖励'.$pendant_title, - 'createtime' => time(), - ]; - Db::name('user_cp_gift_log')->insert($datas); + if($pendant){ + $pendant_title = '装扮-'.$pendant['day'].'天-'.db::name('vs_decorate')->where('did',$pendant['did'])->value('title'); + $datas = [ + 'room_id' => $room_id, + 'from_user_id' => $from_user_id, + 'to_user_id' => $to_user_id, + 'gift_id' => 0, + 'num' => 0, + 'cp_zone_id' => $cp_zone_id, + 'exp' => 0, + 'exp_total' => 0, + 'remark' => '我们等级达到了'.$level['level'].'级,获得奖励'.$pendant_title, + 'createtime' => time(), + ]; + Db::name('user_cp_gift_log')->insert($datas); + } + } $data['exp'] = $yuan_exp + $exp; Db::name('user_cp_zone')->where(['id' => $cp_zone_id])->update($data);