where('user_id', '=', $userId) ->order(['create_time' => 'desc']) ->paginate(15); } /** * 记录分佣明细 * @param $userId * @param $scene * @param $money * @param string $describe * @param string $remark * @return bool * @throws Exception */ /* public static function addNewLog($userId,$scene,$money,$describe='',$remark=''){ $log = new self(); $user = User::find($userId); try { $log->save([ 'user_id' => $userId, 'scene' => $scene, 'money' => $money, 'describe' => $describe, 'remark' => $remark, ]); //提现余额也要累加计算 $user->can_withdraw_money = Db::raw('can_withdraw_money+'.$money); //可提现金额 $user->ktxyj_amount = Db::raw('ktxyj_amount+'.$money); $user->save(); }catch (Exception $e){ Log::error('order_id::'.$remark.',desc::'.$describe.','.$e->getMessage()); throw $e; } $user = User::find($userId); return $user->can_withdraw_money; }*/ public static function sumGiveOutOrder(){ $userId = UserService::getCurrentLoginUserId(); return self::where('user_id',$userId)->where('scene',50)->sum('money'); } /** * 批量加入余额变更 * @param $lists * @return bool * @throws Exception */ public static function addNewLogBatch($lists){ $log = new self(); try { $log->saveAll($lists); }catch (Exception $e){ throw $e; //return false; } return true; } }