post()->goCheck('add'); // 添加数据 try { $result = UserBalance::create([ 'user_id' => $params['user_id'], 'record_id' => $params['record_id'], 'record_table' => $params['record_table'], 'amount' => $params['amount'], 'type' => $params['type'], 'pay_type' => $params['pay_type'], 'mark' => $params['mark'], 'appid' => $this->request->header('appid'), 'create_time' => time(), ]); if(!empty($result->id)){ return $this->success('添加成功'); }else{ return $this->fail('添加失败'); } }catch (\Exception $e) { //记录日志 Log::error($e->getMessage()); return $this->fail('系统错误'); } } }