'datetime', 'amount' => 'decimal:2', 'balance' => 'decimal:2', ]; //检查账号是否存在 public static function CheckUserId($user){ return UserAccount::where([ 'chat_id' => $user['chat_id'], 'user_id' => $user['user_id'], ])->exists(); } //更新账号资料 public static function UpdateUser($user){ UserAccount::where([ 'chat_id' => $user['chat_id'], 'user_id' => $user['user_id'], ])->increment('balance', $user['amount']); $balance = UserAccount::where([ 'chat_id' => $user['chat_id'], 'user_id' => $user['user_id'], ])->value('balance'); return $balance; } //新建账号 public static function CreatUser($user){ $UserAccount=new UserAccount(); $UserAccount->chat_id=$user['chat_id']; $UserAccount->user_id=$user['user_id']; $UserAccount->username=$user['username']; $UserAccount->stime=now(); $UserAccount->balance=$user['amount']; $UserAccount->subjection=$user['token']; $UserAccount->save(); return $user['amount']; } }