where($where)->find(); if (!$find) { $w = [ 'app_type' => 'aliapp', 'appid' => $param['mini_app_id'] ]; $regInfo = Db::name('applet_reg')->where($w)->order('id desc')->find(); Db::name('website')->where('site_id', '=', $regInfo['ag_site_id']) ->dec('agent_money', $regInfo['reg_fee']) ->update(); //记录扣款 $bill = [ 'ag_site_id' => $regInfo['ag_site_id'], 'user_id' => $regInfo['user_id'], 'site_id' => $regInfo['site_id'], 'appid' => $param['mini_app_id'], 'account_data' => $regInfo['reg_fee'], 'from_type' => 'aliapp', 'type_name' => '支付宝小程序注册', 'create_time' => time(), ];//插入扣款流水 Db::name('agent_account')->insert($bill); } } return success(); } }